electrolux-group-developer-sdk 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- electrolux_group_developer_sdk/__init__.py +0 -0
- electrolux_group_developer_sdk/appliance_config/__init__.py +0 -0
- electrolux_group_developer_sdk/appliance_config/ac_config.py +167 -0
- electrolux_group_developer_sdk/appliance_config/ap_config.py +204 -0
- electrolux_group_developer_sdk/appliance_config/config.py +31 -0
- electrolux_group_developer_sdk/appliance_config/cr_config.py +156 -0
- electrolux_group_developer_sdk/appliance_config/dam_ac_config.py +112 -0
- electrolux_group_developer_sdk/appliance_config/dh_config.py +104 -0
- electrolux_group_developer_sdk/appliance_config/dw_config.py +120 -0
- electrolux_group_developer_sdk/appliance_config/hb_config.py +166 -0
- electrolux_group_developer_sdk/appliance_config/hd_config.py +137 -0
- electrolux_group_developer_sdk/appliance_config/ov_config.py +230 -0
- electrolux_group_developer_sdk/appliance_config/rvc_config.py +217 -0
- electrolux_group_developer_sdk/appliance_config/so_config.py +277 -0
- electrolux_group_developer_sdk/appliance_config/td_config.py +120 -0
- electrolux_group_developer_sdk/appliance_config/wd_config.py +247 -0
- electrolux_group_developer_sdk/appliance_config/wm_config.py +246 -0
- electrolux_group_developer_sdk/auth/__init__.py +0 -0
- electrolux_group_developer_sdk/auth/auth_data.py +5 -0
- electrolux_group_developer_sdk/auth/invalid_credentials_exception.py +5 -0
- electrolux_group_developer_sdk/auth/invalid_token_exception.py +5 -0
- electrolux_group_developer_sdk/auth/token_manager.py +130 -0
- electrolux_group_developer_sdk/cli_test.py +139 -0
- electrolux_group_developer_sdk/client/__init__.py +0 -0
- electrolux_group_developer_sdk/client/appliance_client.py +447 -0
- electrolux_group_developer_sdk/client/appliance_data_factory.py +71 -0
- electrolux_group_developer_sdk/client/appliances/__init__.py +0 -0
- electrolux_group_developer_sdk/client/appliances/ac_appliance.py +113 -0
- electrolux_group_developer_sdk/client/appliances/ap_appliance.py +85 -0
- electrolux_group_developer_sdk/client/appliances/appliance_data.py +18 -0
- electrolux_group_developer_sdk/client/appliances/cr_appliance.py +105 -0
- electrolux_group_developer_sdk/client/appliances/dam_ac_appliance.py +113 -0
- electrolux_group_developer_sdk/client/appliances/dh_appliance.py +100 -0
- electrolux_group_developer_sdk/client/appliances/dw_appliance.py +107 -0
- electrolux_group_developer_sdk/client/appliances/hb_appliance.py +135 -0
- electrolux_group_developer_sdk/client/appliances/hd_appliance.py +132 -0
- electrolux_group_developer_sdk/client/appliances/ov_appliance.py +174 -0
- electrolux_group_developer_sdk/client/appliances/rvc_appliance.py +162 -0
- electrolux_group_developer_sdk/client/appliances/so_appliance.py +172 -0
- electrolux_group_developer_sdk/client/appliances/td_appliance.py +107 -0
- electrolux_group_developer_sdk/client/appliances/wd_appliance.py +207 -0
- electrolux_group_developer_sdk/client/appliances/wm_appliance.py +207 -0
- electrolux_group_developer_sdk/client/client_exception.py +6 -0
- electrolux_group_developer_sdk/client/client_util.py +80 -0
- electrolux_group_developer_sdk/client/dto/__init__.py +0 -0
- electrolux_group_developer_sdk/client/dto/appliance.py +9 -0
- electrolux_group_developer_sdk/client/dto/appliance_details.py +18 -0
- electrolux_group_developer_sdk/client/dto/appliance_state.py +10 -0
- electrolux_group_developer_sdk/client/dto/interactive_map.py +24 -0
- electrolux_group_developer_sdk/client/dto/livestream_config.py +11 -0
- electrolux_group_developer_sdk/client/dto/memory_map.py +14 -0
- electrolux_group_developer_sdk/client/failed_connection_exception.py +5 -0
- electrolux_group_developer_sdk/client/rate_limiter.py +35 -0
- electrolux_group_developer_sdk/config.py +12 -0
- electrolux_group_developer_sdk/constants.py +79 -0
- electrolux_group_developer_sdk/feature_constants.py +132 -0
- electrolux_group_developer_sdk-0.1.0.dist-info/METADATA +102 -0
- electrolux_group_developer_sdk-0.1.0.dist-info/RECORD +60 -0
- electrolux_group_developer_sdk-0.1.0.dist-info/WHEEL +4 -0
- electrolux_group_developer_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""Dehum configuration."""
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from .config import ApplianceConfig
|
|
5
|
+
from ..constants import DH, HUSKY, VALUES, MIN, MAX, STEP, APPLIANCE_STATE_RUNNING
|
|
6
|
+
from ..feature_constants import *
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
DH_CONFIG = {
|
|
10
|
+
DH: {
|
|
11
|
+
MODE: "mode",
|
|
12
|
+
TARGET_HUMIDITY: "targetHumidity",
|
|
13
|
+
SENSOR_HUMIDITY: "sensorHumidity",
|
|
14
|
+
FAN_SPEED: "fanSpeedSetting",
|
|
15
|
+
EXECUTE_COMMAND: "executeCommand",
|
|
16
|
+
APPLIANCE_STATE: "applianceState",
|
|
17
|
+
EXECUTE_COMMAND_OFF: "OFF",
|
|
18
|
+
EXECUTE_COMMAND_ON: "ON",
|
|
19
|
+
MODE_OFF: "OFF"
|
|
20
|
+
},
|
|
21
|
+
HUSKY: {
|
|
22
|
+
MODE: "mode",
|
|
23
|
+
TARGET_HUMIDITY: "targetHumidity",
|
|
24
|
+
SENSOR_HUMIDITY: "sensorHumidity",
|
|
25
|
+
FAN_SPEED: "fanSpeedSetting",
|
|
26
|
+
EXECUTE_COMMAND: "executeCommand",
|
|
27
|
+
APPLIANCE_STATE: "applianceState",
|
|
28
|
+
EXECUTE_COMMAND_OFF: "OFF",
|
|
29
|
+
EXECUTE_COMMAND_ON: "ON",
|
|
30
|
+
MODE_OFF: "OFF"
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DhConfig(ApplianceConfig):
|
|
36
|
+
"""Config for DH devices."""
|
|
37
|
+
|
|
38
|
+
def get_supported_modes(self) -> list[str]:
|
|
39
|
+
"""Get appliance modes."""
|
|
40
|
+
key = self.get_property(MODE)
|
|
41
|
+
values = self.capabilities.get(key, {}).get(VALUES, {})
|
|
42
|
+
return list(values.keys())
|
|
43
|
+
|
|
44
|
+
def get_supported_fan_speeds(self) -> list[str]:
|
|
45
|
+
"""Get appliance fan speeds."""
|
|
46
|
+
key = self.get_property(FAN_SPEED)
|
|
47
|
+
values = self.capabilities.get(key, {}).get(VALUES, {})
|
|
48
|
+
return list(values.keys())
|
|
49
|
+
|
|
50
|
+
def _get_target_humidity_capability(self) -> dict[str, Any]:
|
|
51
|
+
"""Get target humidity capability."""
|
|
52
|
+
return self.capabilities.get(
|
|
53
|
+
self.get_property(TARGET_HUMIDITY)
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
def get_supported_min_humidity(self) -> float:
|
|
57
|
+
"""Get MIN target humidity."""
|
|
58
|
+
return self._get_target_humidity_capability().get(MIN)
|
|
59
|
+
|
|
60
|
+
def get_supported_max_humidity(self) -> float:
|
|
61
|
+
"""Get MAX target humidity."""
|
|
62
|
+
return self._get_target_humidity_capability().get(MAX)
|
|
63
|
+
|
|
64
|
+
def get_supported_step_humidity(self) -> float:
|
|
65
|
+
"""Get humidity STEP."""
|
|
66
|
+
return self._get_target_humidity_capability().get(STEP)
|
|
67
|
+
|
|
68
|
+
def get_current_mode(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
69
|
+
"""Get the current mode from the reported state."""
|
|
70
|
+
return self._get_state(MODE, reported_appliance_state)
|
|
71
|
+
|
|
72
|
+
def get_current_sensor_humidity(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
73
|
+
"""Get the current sensor humidity from the reported state."""
|
|
74
|
+
return self._get_state(SENSOR_HUMIDITY, reported_appliance_state)
|
|
75
|
+
|
|
76
|
+
def get_current_target_humidity(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
77
|
+
"""Get the current target humidity from the reported state."""
|
|
78
|
+
return self._get_state(TARGET_HUMIDITY, reported_appliance_state)
|
|
79
|
+
|
|
80
|
+
def is_appliance_on(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
81
|
+
"""Get the current appliance state from the reported state."""
|
|
82
|
+
appliance_state = self.get_current_appliance_state(reported_appliance_state)
|
|
83
|
+
return appliance_state == APPLIANCE_STATE_RUNNING
|
|
84
|
+
|
|
85
|
+
def get_current_appliance_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
86
|
+
"""Get the current appliance state from the reported state."""
|
|
87
|
+
return self._get_state(APPLIANCE_STATE, reported_appliance_state)
|
|
88
|
+
|
|
89
|
+
def get_current_fan_speed(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
90
|
+
"""Get the current fan speed from the reported state."""
|
|
91
|
+
return self._get_state(FAN_SPEED, reported_appliance_state)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class DhConfigManager:
|
|
95
|
+
"""Manager for DH device configuration by model."""
|
|
96
|
+
|
|
97
|
+
def __init__(self) -> None:
|
|
98
|
+
"""Initialize with configuration data in DH_CONFIG."""
|
|
99
|
+
self._config = DH_CONFIG
|
|
100
|
+
|
|
101
|
+
def get_config(self, model_type: str, capabilities: dict[str, Any]) -> DhConfig:
|
|
102
|
+
"""Return the appliance_config for a given model type."""
|
|
103
|
+
|
|
104
|
+
return DhConfig(mapping=self._config.get(model_type, {}), capabilities=capabilities)
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Dishwasher configuration."""
|
|
2
|
+
import datetime
|
|
3
|
+
from typing import Any
|
|
4
|
+
from zoneinfo import ZoneInfo
|
|
5
|
+
|
|
6
|
+
from .config import ApplianceConfig
|
|
7
|
+
from ..constants import VALUES, DW, APPLIANCE_STATE_DELAYED_START
|
|
8
|
+
from ..feature_constants import *
|
|
9
|
+
|
|
10
|
+
# Configuration
|
|
11
|
+
DW_CONFIG = {
|
|
12
|
+
DW: {
|
|
13
|
+
PROGRAM_UID: "programUID",
|
|
14
|
+
USER_SELECTIONS: "userSelections",
|
|
15
|
+
PROGRAM_CAPABILITY: "userSelections/programUID",
|
|
16
|
+
EXECUTE_COMMAND: "executeCommand",
|
|
17
|
+
APPLIANCE_STATE: "applianceState",
|
|
18
|
+
CYCLE_PHASE: "cyclePhase",
|
|
19
|
+
TIME_TO_END: "timeToEnd",
|
|
20
|
+
EXECUTE_COMMAND_START: "START",
|
|
21
|
+
EXECUTE_COMMAND_STOP: "STOPRESET",
|
|
22
|
+
EXECUTE_COMMAND_PAUSE: "PAUSE",
|
|
23
|
+
EXECUTE_COMMAND_RESUME: "RESUME",
|
|
24
|
+
REMOTE_CONTROL: "remoteControl",
|
|
25
|
+
DOOR_STATE: "doorState",
|
|
26
|
+
UI_LOCK_MODE: "uiLockMode",
|
|
27
|
+
WATER_HARDNESS: "waterHardness",
|
|
28
|
+
ALERTS: "alerts",
|
|
29
|
+
STOP_TIME: "stopTime",
|
|
30
|
+
START_TIME: "startTime"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class DwConfig(ApplianceConfig):
|
|
36
|
+
"""Config for DW devices."""
|
|
37
|
+
|
|
38
|
+
def get_supported_programs(self) -> list[str]:
|
|
39
|
+
"""Get appliance programs."""
|
|
40
|
+
key = self.get_property(PROGRAM_CAPABILITY)
|
|
41
|
+
values = self.capabilities.get(key, {}).get(VALUES, {})
|
|
42
|
+
return [
|
|
43
|
+
program
|
|
44
|
+
for program, meta in values.items()
|
|
45
|
+
if not meta.get("disabled", False)
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
def get_current_program(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
49
|
+
"""Get the current program from the reported state."""
|
|
50
|
+
return reported_appliance_state.get(self.get_property(USER_SELECTIONS)).get(self.get_property(PROGRAM_UID))
|
|
51
|
+
|
|
52
|
+
def get_current_cycle_phase(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
53
|
+
"""Get the current cycle phase from the reported state."""
|
|
54
|
+
return self._get_state(CYCLE_PHASE, reported_appliance_state)
|
|
55
|
+
|
|
56
|
+
def get_current_time_to_end(self, reported_appliance_state: dict[str, Any]) -> float:
|
|
57
|
+
"""Get the current time to end from the reported state."""
|
|
58
|
+
return self._get_state(TIME_TO_END, reported_appliance_state)
|
|
59
|
+
|
|
60
|
+
def get_current_door_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
61
|
+
"""Get the current door state from the reported state."""
|
|
62
|
+
return self._get_state(DOOR_STATE, reported_appliance_state)
|
|
63
|
+
|
|
64
|
+
def get_current_remote_control(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
65
|
+
"""Get the current remote control from the reported state."""
|
|
66
|
+
return self._get_state(REMOTE_CONTROL, reported_appliance_state)
|
|
67
|
+
|
|
68
|
+
def get_current_water_hardness(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
69
|
+
"""Get the current water hardness from the reported state."""
|
|
70
|
+
return self._get_state(WATER_HARDNESS, reported_appliance_state)
|
|
71
|
+
|
|
72
|
+
def get_current_ui_lock_mode(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
73
|
+
"""Get the current ui lock mode from the reported state."""
|
|
74
|
+
return self._get_state(UI_LOCK_MODE, reported_appliance_state)
|
|
75
|
+
|
|
76
|
+
def get_current_alerts(self, reported_appliance_state: dict[str, Any]) -> list[str]:
|
|
77
|
+
"""Get the current alerts from the reported state."""
|
|
78
|
+
return self._get_state(ALERTS, reported_appliance_state)
|
|
79
|
+
|
|
80
|
+
def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[datetime, datetime]:
|
|
81
|
+
"""Get the current start at time and end at time from the reported state."""
|
|
82
|
+
appliance_state = self.get_current_appliance_state(reported_appliance_state)
|
|
83
|
+
|
|
84
|
+
if appliance_state != APPLIANCE_STATE_DELAYED_START:
|
|
85
|
+
return None, None
|
|
86
|
+
|
|
87
|
+
stop_time = self._get_state(STOP_TIME, reported_appliance_state)
|
|
88
|
+
time_to_end = self.get_current_time_to_end(reported_appliance_state)
|
|
89
|
+
now = datetime.datetime.now(ZoneInfo("UTC"))
|
|
90
|
+
|
|
91
|
+
if stop_time is not None and stop_time not in (-1, 0):
|
|
92
|
+
end_at = now + datetime.timedelta(seconds=stop_time)
|
|
93
|
+
start_at = end_at - datetime.timedelta(seconds=time_to_end)
|
|
94
|
+
return start_at, end_at
|
|
95
|
+
|
|
96
|
+
start_time = self._get_state(START_TIME, reported_appliance_state)
|
|
97
|
+
|
|
98
|
+
if start_time is not None and start_time not in (-1, 0):
|
|
99
|
+
start_at = now + datetime.timedelta(seconds=start_time)
|
|
100
|
+
end_at = start_at + datetime.timedelta(seconds=time_to_end)
|
|
101
|
+
|
|
102
|
+
return start_at, end_at
|
|
103
|
+
return None, None
|
|
104
|
+
|
|
105
|
+
def get_current_appliance_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
106
|
+
"""Get the current appliance state from the reported state."""
|
|
107
|
+
return self._get_state(APPLIANCE_STATE, reported_appliance_state)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class DwConfigManager:
|
|
111
|
+
"""Manager for DW device configuration by model."""
|
|
112
|
+
|
|
113
|
+
def __init__(self) -> None:
|
|
114
|
+
"""Initialize with configuration data in DW_CONFIG."""
|
|
115
|
+
self._config = DW_CONFIG
|
|
116
|
+
|
|
117
|
+
def get_config(self, model_type: str, capabilities: dict[str, Any]) -> DwConfig:
|
|
118
|
+
"""Return the appliance_config for a given model type."""
|
|
119
|
+
|
|
120
|
+
return DwConfig(mapping=self._config.get(model_type, {}), capabilities=capabilities)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""Hood configuration."""
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from .config import ApplianceConfig
|
|
5
|
+
from ..constants import VALUES, HB
|
|
6
|
+
from ..feature_constants import *
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
HB_CONFIG = {
|
|
10
|
+
HB: {
|
|
11
|
+
HOB_HOOD: "hobHood",
|
|
12
|
+
HOOD_FAN_SPEED: "hobToHoodFanSpeed",
|
|
13
|
+
HOOD_STATE: "hobToHoodState",
|
|
14
|
+
KEY_SOUND_TONE: "keySoundTone",
|
|
15
|
+
CHILD_LOCK: "childLock",
|
|
16
|
+
APPLIANCE_STATE: "applianceState",
|
|
17
|
+
ALERTS: "alerts",
|
|
18
|
+
REMOTE_CONTROL: "remoteControl",
|
|
19
|
+
UI_LOCK_MODE: "uiLockMode",
|
|
20
|
+
APPLIANCE_MODE: "applianceMode",
|
|
21
|
+
HOB_HOOD_TARGET_DURATION: "targetDuration",
|
|
22
|
+
HOB_HOOD_WINDOW_NOTIFICATION: "windowNotification",
|
|
23
|
+
ZONE_RESIDUAL_HEAT_STATE: "residualHeatState",
|
|
24
|
+
ZONE_TARGET_DURATION: "targetDuration",
|
|
25
|
+
ZONE_REMINDER_TIME: "reminderTime",
|
|
26
|
+
ZONE_HOB_POT_DETECTED: "hobPotDetected",
|
|
27
|
+
HOB_ZONE: "hobZone",
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class HbConfig(ApplianceConfig):
|
|
33
|
+
"""Config for HB devices."""
|
|
34
|
+
|
|
35
|
+
def _get_nested_state(self, state_key: str, nested_state_key: str, reported_appliance_state: dict[str, Any]) -> Any:
|
|
36
|
+
"""Return the state given a nested specific key."""
|
|
37
|
+
if not state_key or not nested_state_key:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
outer_value = reported_appliance_state.get(state_key)
|
|
41
|
+
if not isinstance(outer_value, dict):
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
return outer_value.get(nested_state_key)
|
|
45
|
+
|
|
46
|
+
def is_hood_capability_supported(self, feature: str) -> bool:
|
|
47
|
+
"""Return True if the appliance supports this hobToHood capability."""
|
|
48
|
+
key = self.get_property(feature)
|
|
49
|
+
hood_capabilities = self.capabilities.get(self.get_property(HOB_HOOD), {})
|
|
50
|
+
return key is not None and hood_capabilities is not None and key in hood_capabilities
|
|
51
|
+
|
|
52
|
+
def is_hob_zone_capability_supported(self, zone:str, feature: str) -> bool:
|
|
53
|
+
"""Return True if the appliance supports this hob zone capability."""
|
|
54
|
+
key = self.get_property(feature)
|
|
55
|
+
hob_zone_capabilities = self.capabilities.get(zone)
|
|
56
|
+
return key is not None and hob_zone_capabilities is not None and key in hob_zone_capabilities
|
|
57
|
+
|
|
58
|
+
def get_supported_hood_fan_speed(self) -> list[str]:
|
|
59
|
+
"""Get supported hood fan speed."""
|
|
60
|
+
values = self.capabilities.get(self.get_property(HOB_HOOD), {}).get(self.get_property(HOOD_FAN_SPEED), {}).get(
|
|
61
|
+
VALUES, {})
|
|
62
|
+
return [
|
|
63
|
+
speed
|
|
64
|
+
for speed, meta in values.items()
|
|
65
|
+
if not meta.get("disabled", False)
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
def get_supported_hood_state(self) -> list[str]:
|
|
69
|
+
"""Get supported hood state."""
|
|
70
|
+
values = self.capabilities.get(self.get_property(HOB_HOOD), {}).get(self.get_property(HOOD_STATE), {}).get(
|
|
71
|
+
VALUES, {})
|
|
72
|
+
return [
|
|
73
|
+
state
|
|
74
|
+
for state, meta in values.items()
|
|
75
|
+
if not meta.get("disabled", False)
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
def get_supported_key_sound_tone(self) -> list[str]:
|
|
79
|
+
"""Get key sound tone."""
|
|
80
|
+
values = self.capabilities.get(self.get_property(KEY_SOUND_TONE), {}).get(VALUES, {})
|
|
81
|
+
return list(values.keys())
|
|
82
|
+
|
|
83
|
+
def get_available_hob_zone(self, reported_appliance_state: dict[str, Any]) -> list[str]:
|
|
84
|
+
"""Get available hob zone from the state."""
|
|
85
|
+
return [
|
|
86
|
+
key
|
|
87
|
+
for key, value in reported_appliance_state.items()
|
|
88
|
+
if key.startswith(self.get_property(HOB_ZONE)) and isinstance(value, dict)
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
def get_current_hood_fan_speed(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
92
|
+
"""Get the current hood fan speed from the reported state."""
|
|
93
|
+
return self._get_nested_state(self.get_property(HOB_HOOD), self.get_property(HOOD_FAN_SPEED),
|
|
94
|
+
reported_appliance_state)
|
|
95
|
+
|
|
96
|
+
def get_current_hood_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
97
|
+
"""Get the current hood state from the reported state."""
|
|
98
|
+
return self._get_nested_state(self.get_property(HOB_HOOD), self.get_property(HOOD_STATE),
|
|
99
|
+
reported_appliance_state)
|
|
100
|
+
|
|
101
|
+
def get_current_key_sound_tone(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
102
|
+
"""Get the current key sound tone from the reported state."""
|
|
103
|
+
return self._get_state(KEY_SOUND_TONE, reported_appliance_state)
|
|
104
|
+
|
|
105
|
+
def get_current_child_lock(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
106
|
+
"""Get the current child lock from the reported state."""
|
|
107
|
+
return self._get_state(CHILD_LOCK, reported_appliance_state)
|
|
108
|
+
|
|
109
|
+
def get_current_appliance_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
110
|
+
"""Get the current appliance state from the reported state."""
|
|
111
|
+
return self._get_state(APPLIANCE_STATE, reported_appliance_state)
|
|
112
|
+
|
|
113
|
+
def get_current_alerts(self, reported_appliance_state: dict[str, Any]) -> list[str]:
|
|
114
|
+
"""Get the current alerts from the reported state."""
|
|
115
|
+
return self._get_state(ALERTS, reported_appliance_state)
|
|
116
|
+
|
|
117
|
+
def get_current_remote_control(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
118
|
+
"""Get the current remote control from the reported state."""
|
|
119
|
+
return self._get_state(REMOTE_CONTROL, reported_appliance_state)
|
|
120
|
+
|
|
121
|
+
def get_current_ui_lock_mode(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
122
|
+
"""Get the current UI lock mode from the reported state."""
|
|
123
|
+
return self._get_state(UI_LOCK_MODE, reported_appliance_state)
|
|
124
|
+
|
|
125
|
+
def get_current_appliance_mode(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
126
|
+
"""Get the current appliance mode from the reported state."""
|
|
127
|
+
return self._get_state(APPLIANCE_MODE, reported_appliance_state)
|
|
128
|
+
|
|
129
|
+
def get_current_hob_hood_window_notification(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
130
|
+
"""Get the current Hob Hood window notification from the reported state."""
|
|
131
|
+
return self._get_nested_state(self.get_property(HOB_HOOD), self.get_property(HOB_HOOD_WINDOW_NOTIFICATION),
|
|
132
|
+
reported_appliance_state)
|
|
133
|
+
|
|
134
|
+
def get_current_hob_hood_target_duration(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
135
|
+
"""Get the current hob hood target duration from the reported state."""
|
|
136
|
+
return self._get_nested_state(self.get_property(HOB_HOOD), self.get_property(HOB_HOOD_TARGET_DURATION),
|
|
137
|
+
reported_appliance_state)
|
|
138
|
+
|
|
139
|
+
def get_current_zone_residual_heat_state(self, hob_zone: str, reported_appliance_state: dict[str, Any]) -> str:
|
|
140
|
+
"""Get the current zone residual heat state from the reported state."""
|
|
141
|
+
return self._get_nested_state(hob_zone, self.get_property(ZONE_RESIDUAL_HEAT_STATE), reported_appliance_state)
|
|
142
|
+
|
|
143
|
+
def get_current_zone_target_duration(self, hob_zone: str, reported_appliance_state: dict[str, Any]) -> int:
|
|
144
|
+
"""Get the current zone target duration from the reported state."""
|
|
145
|
+
return self._get_nested_state(hob_zone, self.get_property(ZONE_TARGET_DURATION), reported_appliance_state)
|
|
146
|
+
|
|
147
|
+
def get_current_zone_reminder_time(self, hob_zone: str, reported_appliance_state: dict[str, Any]) -> int:
|
|
148
|
+
"""Get the current zone reminder time from the reported state."""
|
|
149
|
+
return self._get_nested_state(hob_zone, self.get_property(ZONE_REMINDER_TIME), reported_appliance_state)
|
|
150
|
+
|
|
151
|
+
def get_current_zone_hob_pot_detected(self, hob_zone: str, reported_appliance_state: dict[str, Any]) -> str:
|
|
152
|
+
"""Get the current zone hob pot detected from the reported state."""
|
|
153
|
+
return self._get_nested_state(hob_zone, self.get_property(ZONE_HOB_POT_DETECTED), reported_appliance_state)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class HbConfigManager:
|
|
157
|
+
"""Manager for HB device configuration by model."""
|
|
158
|
+
|
|
159
|
+
def __init__(self) -> None:
|
|
160
|
+
"""Initialize with configuration data in HB_CONFIG."""
|
|
161
|
+
self._config = HB_CONFIG
|
|
162
|
+
|
|
163
|
+
def get_config(self, model_type: str, capabilities: dict[str, Any]) -> HbConfig:
|
|
164
|
+
"""Return the appliance_config for a given model type."""
|
|
165
|
+
|
|
166
|
+
return HbConfig(mapping=self._config.get(model_type, {}), capabilities=capabilities)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""HOOD configuration."""
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from .config import ApplianceConfig
|
|
5
|
+
from ..constants import VALUES, MIN, MAX, STEP, HD
|
|
6
|
+
from ..feature_constants import *
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
HD_CONFIG = {
|
|
10
|
+
HD: {
|
|
11
|
+
HOOD_FAN_LEVEL: "hoodFanLevel",
|
|
12
|
+
LIGHT_INTENSITY: "lightIntensity",
|
|
13
|
+
LIGHT_COLOR_TEMPERATURE: "lightColorTemperature",
|
|
14
|
+
HOOD_CHARC_FILTER_TIME: "hoodCharcFilterTimer",
|
|
15
|
+
HOOD_FILTER_CHARC_ENABLE: "hoodFilterCharcEnable",
|
|
16
|
+
HUMAN_CENTRIC_LIGHT_EVENT_STATE: "humanCentricLightEventState",
|
|
17
|
+
APPLIANCE_MODE: "applianceMode",
|
|
18
|
+
APPLIANCE_STATE: "applianceState",
|
|
19
|
+
DRAWER_STATUS: "drawerStatus",
|
|
20
|
+
REMOTE_CONTROL: "remoteControl",
|
|
21
|
+
ALERTS: "alerts",
|
|
22
|
+
HOOD_GREASE_FILTER_TIMER: "hoodGreaseFilterTimer",
|
|
23
|
+
SOUND_VOLUME: "soundVolume",
|
|
24
|
+
TARGET_DURATION: "targetDuration",
|
|
25
|
+
TVOC_FILTER_TIME: "tvocFilterTime",
|
|
26
|
+
HOOD_AUTO_SWITCH_OFF_EVENT: "hoodAutoSwitchOffEvent"
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class HdConfig(ApplianceConfig):
|
|
32
|
+
"""Config for HD devices."""
|
|
33
|
+
|
|
34
|
+
def get_supported_hood_fan_level(self) -> list[str]:
|
|
35
|
+
"""Get appliance hood fan level."""
|
|
36
|
+
key = self.get_property(HOOD_FAN_LEVEL)
|
|
37
|
+
values = self.capabilities.get(key, {}).get(VALUES, {})
|
|
38
|
+
return [
|
|
39
|
+
program
|
|
40
|
+
for program, meta in values.items()
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
def get_light_intensity_range(self) -> dict[str, int]:
|
|
44
|
+
"""Get light intensity range."""
|
|
45
|
+
capability = self.capabilities.get(self.get_property(LIGHT_INTENSITY), {})
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
MIN: capability.get(MIN),
|
|
49
|
+
MAX: capability.get(MAX),
|
|
50
|
+
STEP: capability.get(STEP),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
def get_light_color_temperature_range(self) -> dict[str, int]:
|
|
54
|
+
"""Get light color temperature range."""
|
|
55
|
+
capability = self.capabilities.get(self.get_property(LIGHT_COLOR_TEMPERATURE), {})
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
MIN: capability.get(MIN),
|
|
59
|
+
MAX: capability.get(MAX),
|
|
60
|
+
STEP: capability.get(STEP),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
def get_current_hood_fan_level(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
64
|
+
"""Get the current hood fan level from the reported state."""
|
|
65
|
+
return reported_appliance_state.get(self.get_property(HOOD_FAN_LEVEL))
|
|
66
|
+
|
|
67
|
+
def get_current_light_intensity(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
68
|
+
"""Get the current light intensity from the reported state."""
|
|
69
|
+
return reported_appliance_state.get(self.get_property(LIGHT_INTENSITY))
|
|
70
|
+
|
|
71
|
+
def get_current_light_color_temperature(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
72
|
+
"""Get the current light color temperature from the reported state."""
|
|
73
|
+
return reported_appliance_state.get(self.get_property(LIGHT_COLOR_TEMPERATURE))
|
|
74
|
+
|
|
75
|
+
def get_current_hood_charc_filter_timer(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
76
|
+
"""Get the current hood charc filter timer from the reported state."""
|
|
77
|
+
return reported_appliance_state.get(self.get_property(HOOD_CHARC_FILTER_TIME))
|
|
78
|
+
|
|
79
|
+
def get_current_hood_filter_charc_enable(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
80
|
+
"""Get the current hood filter charc enable from the reported state."""
|
|
81
|
+
return reported_appliance_state.get(self.get_property(HOOD_FILTER_CHARC_ENABLE))
|
|
82
|
+
|
|
83
|
+
def get_current_human_centric_light_event_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
84
|
+
"""Get the current human centric light event state from the reported state."""
|
|
85
|
+
return reported_appliance_state.get(self.get_property(HUMAN_CENTRIC_LIGHT_EVENT_STATE))
|
|
86
|
+
|
|
87
|
+
def get_current_appliance_mode(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
88
|
+
"""Get the current appliance mode from the reported state."""
|
|
89
|
+
return reported_appliance_state.get(self.get_property(APPLIANCE_MODE))
|
|
90
|
+
|
|
91
|
+
def get_current_drawer_status(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
92
|
+
"""Get the current drawer status from the reported state."""
|
|
93
|
+
return reported_appliance_state.get(self.get_property(DRAWER_STATUS))
|
|
94
|
+
|
|
95
|
+
def get_current_hood_grease_filter_time(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
96
|
+
"""Get the current hood grease filter time from the reported state."""
|
|
97
|
+
return reported_appliance_state.get(self.get_property(HOOD_GREASE_FILTER_TIMER))
|
|
98
|
+
|
|
99
|
+
def get_current_sound_volume(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
100
|
+
"""Get the current sound volume from the reported state."""
|
|
101
|
+
return reported_appliance_state.get(self.get_property(SOUND_VOLUME))
|
|
102
|
+
|
|
103
|
+
def get_current_tvoc_filter_time(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
104
|
+
"""Get the current tvoc filter time from the reported state."""
|
|
105
|
+
return reported_appliance_state.get(self.get_property(TVOC_FILTER_TIME))
|
|
106
|
+
|
|
107
|
+
def get_current_hood_auto_switch_off_event(self, reported_appliance_state: dict[str, Any]) -> bool:
|
|
108
|
+
"""Get the current hood auto switch off event from the reported state."""
|
|
109
|
+
return reported_appliance_state.get(self.get_property(HOOD_AUTO_SWITCH_OFF_EVENT))
|
|
110
|
+
|
|
111
|
+
def get_current_appliance_state(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
112
|
+
"""Get the current appliance state from the reported state."""
|
|
113
|
+
return self._get_state(APPLIANCE_STATE, reported_appliance_state)
|
|
114
|
+
|
|
115
|
+
def get_current_target_duration(self, reported_appliance_state: dict[str, Any]) -> int:
|
|
116
|
+
"""Get the current target duration from the reported state."""
|
|
117
|
+
return self._get_state(TARGET_DURATION, reported_appliance_state)
|
|
118
|
+
|
|
119
|
+
def get_current_alerts(self, reported_appliance_state: dict[str, Any]) -> list[Any]:
|
|
120
|
+
"""Get the current alerts from the reported state."""
|
|
121
|
+
return self._get_state(ALERTS, reported_appliance_state)
|
|
122
|
+
|
|
123
|
+
def get_current_remote_control(self, reported_appliance_state: dict[str, Any]) -> str:
|
|
124
|
+
"""Get the current remote control from the reported state."""
|
|
125
|
+
return self._get_state(REMOTE_CONTROL, reported_appliance_state)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class HdConfigManager:
|
|
129
|
+
"""Manager for HD device configuration by model."""
|
|
130
|
+
|
|
131
|
+
def __init__(self) -> None:
|
|
132
|
+
"""Initialize with configuration data in HD_CONFIG."""
|
|
133
|
+
self._config = HD_CONFIG
|
|
134
|
+
|
|
135
|
+
def get_config(self, model_type: str, capabilities: dict[str, Any]) -> HdConfig:
|
|
136
|
+
"""Return the appliance_config for a given model type."""
|
|
137
|
+
return HdConfig(mapping=self._config.get(model_type, {}), capabilities=capabilities)
|