mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 22:38:02 -04:00
Remove user-configurable polling interval from keenetic_ndms2 (#184257)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL, Platform
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
@@ -14,7 +14,6 @@ from .const import (
|
||||
CONF_TRY_HOTSPOT,
|
||||
DEFAULT_CONSIDER_HOME,
|
||||
DEFAULT_INTERFACE,
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
)
|
||||
from .router import KeeneticConfigEntry, KeeneticRouter
|
||||
|
||||
@@ -88,7 +87,6 @@ async def async_unload_entry(
|
||||
def async_add_defaults(hass: HomeAssistant, entry: KeeneticConfigEntry) -> None:
|
||||
"""Populate default options."""
|
||||
options = {
|
||||
CONF_SCAN_INTERVAL: DEFAULT_SCAN_INTERVAL,
|
||||
CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME,
|
||||
CONF_INTERFACES: [DEFAULT_INTERFACE],
|
||||
CONF_TRY_HOTSPOT: True,
|
||||
|
||||
@@ -12,13 +12,7 @@ from homeassistant.config_entries import (
|
||||
ConfigFlowResult,
|
||||
OptionsFlowWithReload,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.service_info.ssdp import (
|
||||
@@ -36,7 +30,6 @@ from .const import (
|
||||
CONF_TRY_HOTSPOT,
|
||||
DEFAULT_CONSIDER_HOME,
|
||||
DEFAULT_INTERFACE,
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
DEFAULT_TELNET_PORT,
|
||||
DOMAIN,
|
||||
)
|
||||
@@ -199,14 +192,6 @@ class KeeneticOptionsFlowHandler(OptionsFlowWithReload):
|
||||
|
||||
options = probatio.Schema(
|
||||
{
|
||||
# Polling interval is user-configurable, which is no longer allowed
|
||||
# pylint: disable-next=home-assistant-config-flow-polling-field
|
||||
probatio.Required(
|
||||
CONF_SCAN_INTERVAL,
|
||||
default=self.config_entry.options.get(
|
||||
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
|
||||
),
|
||||
): int,
|
||||
probatio.Required(
|
||||
CONF_CONSIDER_HOME,
|
||||
default=self.config_entry.options.get(
|
||||
|
||||
@@ -8,13 +8,7 @@ from ndms2_client import Client, ConnectionException, Device, TelnetConnection
|
||||
from ndms2_client.client import RouterInfo
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
@@ -28,6 +22,7 @@ from .const import (
|
||||
CONF_INCLUDE_ASSOCIATED,
|
||||
CONF_INTERFACES,
|
||||
CONF_TRY_HOTSPOT,
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
@@ -153,7 +148,7 @@ class KeeneticRouter:
|
||||
await self.request_update()
|
||||
self._cancel_periodic_update = async_call_later(
|
||||
self.hass,
|
||||
self.config_entry.options[CONF_SCAN_INTERVAL],
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
async_update_data,
|
||||
)
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
"include_arp": "Use ARP data (ignored if hotspot data used)",
|
||||
"include_associated": "Use Wi-Fi AP associations data (ignored if hotspot data used)",
|
||||
"interfaces": "Choose interfaces to scan",
|
||||
"scan_interval": "Scan interval",
|
||||
"try_hotspot": "Use 'ip hotspot' data (most accurate)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
"""Tests for the Keenetic NDMS2 component."""
|
||||
|
||||
from homeassistant.components.keenetic_ndms2 import const
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
from homeassistant.helpers.service_info.ssdp import (
|
||||
ATTR_UPNP_FRIENDLY_NAME,
|
||||
ATTR_UPNP_UDN,
|
||||
@@ -32,7 +26,6 @@ MOCK_RECONFIGURE = {
|
||||
}
|
||||
|
||||
MOCK_OPTIONS = {
|
||||
CONF_SCAN_INTERVAL: 15,
|
||||
const.CONF_CONSIDER_HOME: 150,
|
||||
const.CONF_TRY_HOTSPOT: False,
|
||||
const.CONF_INCLUDE_ARP: True,
|
||||
|
||||
Reference in New Issue
Block a user