mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Remove remnants of configurable RainMachine scan interval (#42239)
* Remove remnants of configurable RainMachine scan interval * Clean up tests * Cleanup
This commit is contained in:
parent
6e53aa1155
commit
536f1186b0
@ -12,7 +12,6 @@ from homeassistant.const import (
|
|||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SCAN_INTERVAL,
|
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -32,7 +31,6 @@ from .const import (
|
|||||||
DATA_RESTRICTIONS_UNIVERSAL,
|
DATA_RESTRICTIONS_UNIVERSAL,
|
||||||
DATA_ZONES,
|
DATA_ZONES,
|
||||||
DATA_ZONES_DETAILS,
|
DATA_ZONES_DETAILS,
|
||||||
DEFAULT_SCAN_INTERVAL,
|
|
||||||
DEFAULT_ZONE_RUN,
|
DEFAULT_ZONE_RUN,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
PROGRAM_UPDATE_TOPIC,
|
PROGRAM_UPDATE_TOPIC,
|
||||||
@ -48,6 +46,7 @@ CONF_ZONE_ID = "zone_id"
|
|||||||
|
|
||||||
DEFAULT_ATTRIBUTION = "Data provided by Green Electronics LLC"
|
DEFAULT_ATTRIBUTION = "Data provided by Green Electronics LLC"
|
||||||
DEFAULT_ICON = "mdi:water"
|
DEFAULT_ICON = "mdi:water"
|
||||||
|
DEFAULT_SCAN_INTERVAL = timedelta(seconds=60)
|
||||||
DEFAULT_SSL = True
|
DEFAULT_SSL = True
|
||||||
|
|
||||||
SERVICE_ALTER_PROGRAM = vol.Schema({vol.Required(CONF_PROGRAM_ID): cv.positive_int})
|
SERVICE_ALTER_PROGRAM = vol.Schema({vol.Required(CONF_PROGRAM_ID): cv.positive_int})
|
||||||
@ -113,9 +112,6 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
hass,
|
hass,
|
||||||
controller,
|
controller,
|
||||||
config_entry.data.get(CONF_ZONE_RUN_TIME, DEFAULT_ZONE_RUN),
|
config_entry.data.get(CONF_ZONE_RUN_TIME, DEFAULT_ZONE_RUN),
|
||||||
config_entry.data.get(
|
|
||||||
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL.total_seconds()
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update the data object, which at this point (prior to any sensors registering
|
# Update the data object, which at this point (prior to any sensors registering
|
||||||
@ -231,10 +227,9 @@ async def async_unload_entry(hass, config_entry):
|
|||||||
class RainMachine:
|
class RainMachine:
|
||||||
"""Define a generic RainMachine object."""
|
"""Define a generic RainMachine object."""
|
||||||
|
|
||||||
def __init__(self, hass, controller, default_zone_runtime, scan_interval):
|
def __init__(self, hass, controller, default_zone_runtime):
|
||||||
"""Initialize."""
|
"""Initialize."""
|
||||||
self._async_cancel_time_interval_listener = None
|
self._async_cancel_time_interval_listener = None
|
||||||
self._scan_interval_seconds = scan_interval
|
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.data = {}
|
self.data = {}
|
||||||
self.default_zone_runtime = default_zone_runtime
|
self.default_zone_runtime = default_zone_runtime
|
||||||
@ -296,7 +291,7 @@ class RainMachine:
|
|||||||
self._async_cancel_time_interval_listener = async_track_time_interval(
|
self._async_cancel_time_interval_listener = async_track_time_interval(
|
||||||
self.hass,
|
self.hass,
|
||||||
self._async_update_listener_action,
|
self._async_update_listener_action,
|
||||||
timedelta(seconds=self._scan_interval_seconds),
|
DEFAULT_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._api_category_count[api_category] += 1
|
self._api_category_count[api_category] += 1
|
||||||
|
@ -4,19 +4,12 @@ from regenmaschine.errors import RainMachineError
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||||
CONF_IP_ADDRESS,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_PORT,
|
|
||||||
CONF_SCAN_INTERVAL,
|
|
||||||
CONF_SSL,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
|
||||||
from .const import ( # pylint: disable=unused-import
|
from .const import ( # pylint: disable=unused-import
|
||||||
CONF_ZONE_RUN_TIME,
|
CONF_ZONE_RUN_TIME,
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
DEFAULT_SCAN_INTERVAL,
|
|
||||||
DEFAULT_ZONE_RUN,
|
DEFAULT_ZONE_RUN,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
@ -77,9 +70,6 @@ class RainMachineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
||||||
CONF_PORT: user_input[CONF_PORT],
|
CONF_PORT: user_input[CONF_PORT],
|
||||||
CONF_SSL: user_input.get(CONF_SSL, True),
|
CONF_SSL: user_input.get(CONF_SSL, True),
|
||||||
CONF_SCAN_INTERVAL: user_input.get(
|
|
||||||
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL.total_seconds()
|
|
||||||
),
|
|
||||||
CONF_ZONE_RUN_TIME: user_input.get(
|
CONF_ZONE_RUN_TIME: user_input.get(
|
||||||
CONF_ZONE_RUN_TIME, DEFAULT_ZONE_RUN
|
CONF_ZONE_RUN_TIME, DEFAULT_ZONE_RUN
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"""Define constants for the SimpliSafe component."""
|
"""Define constants for the SimpliSafe component."""
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
DOMAIN = "rainmachine"
|
DOMAIN = "rainmachine"
|
||||||
|
|
||||||
CONF_ZONE_RUN_TIME = "zone_run_time"
|
CONF_ZONE_RUN_TIME = "zone_run_time"
|
||||||
@ -14,7 +12,6 @@ DATA_ZONES = "zones"
|
|||||||
DATA_ZONES_DETAILS = "zones_details"
|
DATA_ZONES_DETAILS = "zones_details"
|
||||||
|
|
||||||
DEFAULT_PORT = 8080
|
DEFAULT_PORT = 8080
|
||||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=60)
|
|
||||||
DEFAULT_ZONE_RUN = 60 * 10
|
DEFAULT_ZONE_RUN = 60 * 10
|
||||||
|
|
||||||
PROGRAM_UPDATE_TOPIC = f"{DOMAIN}_program_update"
|
PROGRAM_UPDATE_TOPIC = f"{DOMAIN}_program_update"
|
||||||
|
@ -4,13 +4,7 @@ from regenmaschine.errors import RainMachineError
|
|||||||
from homeassistant import data_entry_flow
|
from homeassistant import data_entry_flow
|
||||||
from homeassistant.components.rainmachine import CONF_ZONE_RUN_TIME, DOMAIN, config_flow
|
from homeassistant.components.rainmachine import CONF_ZONE_RUN_TIME, DOMAIN, config_flow
|
||||||
from homeassistant.config_entries import SOURCE_USER
|
from homeassistant.config_entries import SOURCE_USER
|
||||||
from homeassistant.const import (
|
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||||
CONF_IP_ADDRESS,
|
|
||||||
CONF_PASSWORD,
|
|
||||||
CONF_PORT,
|
|
||||||
CONF_SCAN_INTERVAL,
|
|
||||||
CONF_SSL,
|
|
||||||
)
|
|
||||||
|
|
||||||
from tests.async_mock import patch
|
from tests.async_mock import patch
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
@ -76,7 +70,6 @@ async def test_step_user(hass):
|
|||||||
CONF_PASSWORD: "password",
|
CONF_PASSWORD: "password",
|
||||||
CONF_PORT: 8080,
|
CONF_PORT: 8080,
|
||||||
CONF_SSL: True,
|
CONF_SSL: True,
|
||||||
CONF_SCAN_INTERVAL: 60,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flow = config_flow.RainMachineFlowHandler()
|
flow = config_flow.RainMachineFlowHandler()
|
||||||
@ -96,6 +89,5 @@ async def test_step_user(hass):
|
|||||||
CONF_PASSWORD: "password",
|
CONF_PASSWORD: "password",
|
||||||
CONF_PORT: 8080,
|
CONF_PORT: 8080,
|
||||||
CONF_SSL: True,
|
CONF_SSL: True,
|
||||||
CONF_SCAN_INTERVAL: 60,
|
|
||||||
CONF_ZONE_RUN_TIME: 600,
|
CONF_ZONE_RUN_TIME: 600,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user