mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Move RainMachine utils to the correct location (#76051)
* Move RainMachine utils to the correct location * Imports
This commit is contained in:
parent
84747ada66
commit
fbde347e64
@ -1,8 +1,6 @@
|
|||||||
"""Define constants for the SimpliSafe component."""
|
"""Define constants for the SimpliSafe component."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.backports.enum import StrEnum
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__package__)
|
LOGGER = logging.getLogger(__package__)
|
||||||
|
|
||||||
DOMAIN = "rainmachine"
|
DOMAIN = "rainmachine"
|
||||||
@ -19,18 +17,3 @@ DATA_ZONES = "zones"
|
|||||||
|
|
||||||
DEFAULT_PORT = 8080
|
DEFAULT_PORT = 8080
|
||||||
DEFAULT_ZONE_RUN = 60 * 10
|
DEFAULT_ZONE_RUN = 60 * 10
|
||||||
|
|
||||||
|
|
||||||
class RunStates(StrEnum):
|
|
||||||
"""Define an enum for program/zone run states."""
|
|
||||||
|
|
||||||
NOT_RUNNING = "Not Running"
|
|
||||||
QUEUED = "Queued"
|
|
||||||
RUNNING = "Running"
|
|
||||||
|
|
||||||
|
|
||||||
RUN_STATE_MAP = {
|
|
||||||
0: RunStates.NOT_RUNNING,
|
|
||||||
1: RunStates.RUNNING,
|
|
||||||
2: RunStates.QUEUED,
|
|
||||||
}
|
|
||||||
|
@ -31,14 +31,12 @@ from .const import (
|
|||||||
DATA_RESTRICTIONS_UNIVERSAL,
|
DATA_RESTRICTIONS_UNIVERSAL,
|
||||||
DATA_ZONES,
|
DATA_ZONES,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
RUN_STATE_MAP,
|
|
||||||
RunStates,
|
|
||||||
)
|
)
|
||||||
from .model import (
|
from .model import (
|
||||||
RainMachineDescriptionMixinApiCategory,
|
RainMachineDescriptionMixinApiCategory,
|
||||||
RainMachineDescriptionMixinUid,
|
RainMachineDescriptionMixinUid,
|
||||||
)
|
)
|
||||||
from .util import key_exists
|
from .util import RUN_STATE_MAP, RunStates, key_exists
|
||||||
|
|
||||||
DEFAULT_ZONE_COMPLETION_TIME_WOBBLE_TOLERANCE = timedelta(seconds=5)
|
DEFAULT_ZONE_COMPLETION_TIME_WOBBLE_TOLERANCE = timedelta(seconds=5)
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ from .const import (
|
|||||||
DATA_ZONES,
|
DATA_ZONES,
|
||||||
DEFAULT_ZONE_RUN,
|
DEFAULT_ZONE_RUN,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
RUN_STATE_MAP,
|
|
||||||
)
|
)
|
||||||
from .model import RainMachineDescriptionMixinUid
|
from .model import RainMachineDescriptionMixinUid
|
||||||
|
from .util import RUN_STATE_MAP
|
||||||
|
|
||||||
ATTR_AREA = "area"
|
ATTR_AREA = "area"
|
||||||
ATTR_CS_ON = "cs_on"
|
ATTR_CS_ON = "cs_on"
|
||||||
|
@ -3,6 +3,23 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from homeassistant.backports.enum import StrEnum
|
||||||
|
|
||||||
|
|
||||||
|
class RunStates(StrEnum):
|
||||||
|
"""Define an enum for program/zone run states."""
|
||||||
|
|
||||||
|
NOT_RUNNING = "Not Running"
|
||||||
|
QUEUED = "Queued"
|
||||||
|
RUNNING = "Running"
|
||||||
|
|
||||||
|
|
||||||
|
RUN_STATE_MAP = {
|
||||||
|
0: RunStates.NOT_RUNNING,
|
||||||
|
1: RunStates.RUNNING,
|
||||||
|
2: RunStates.QUEUED,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def key_exists(data: dict[str, Any], search_key: str) -> bool:
|
def key_exists(data: dict[str, Any], search_key: str) -> bool:
|
||||||
"""Return whether a key exists in a nested dict."""
|
"""Return whether a key exists in a nested dict."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user