Move RainMachine utils to the correct location (#76051)

* Move RainMachine utils to the correct location

* Imports
This commit is contained in:
Aaron Bach 2022-08-03 13:24:55 -06:00 committed by GitHub
parent 84747ada66
commit fbde347e64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 21 deletions

View file

@ -1,8 +1,6 @@
"""Define constants for the SimpliSafe component."""
import logging
from homeassistant.backports.enum import StrEnum
LOGGER = logging.getLogger(__package__)
DOMAIN = "rainmachine"
@ -19,18 +17,3 @@ DATA_ZONES = "zones"
DEFAULT_PORT = 8080
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,
}

View file

@ -31,14 +31,12 @@ from .const import (
DATA_RESTRICTIONS_UNIVERSAL,
DATA_ZONES,
DOMAIN,
RUN_STATE_MAP,
RunStates,
)
from .model import (
RainMachineDescriptionMixinApiCategory,
RainMachineDescriptionMixinUid,
)
from .util import key_exists
from .util import RUN_STATE_MAP, RunStates, key_exists
DEFAULT_ZONE_COMPLETION_TIME_WOBBLE_TOLERANCE = timedelta(seconds=5)

View file

@ -30,9 +30,9 @@ from .const import (
DATA_ZONES,
DEFAULT_ZONE_RUN,
DOMAIN,
RUN_STATE_MAP,
)
from .model import RainMachineDescriptionMixinUid
from .util import RUN_STATE_MAP
ATTR_AREA = "area"
ATTR_CS_ON = "cs_on"

View file

@ -3,6 +3,23 @@ from __future__ import annotations
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:
"""Return whether a key exists in a nested dict."""