electrolux-group-developer-sdk 0.1.2__tar.gz → 0.2.0__tar.gz

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.
Files changed (61) hide show
  1. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/PKG-INFO +1 -1
  2. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/config.py +1 -1
  3. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/cr_config.py +1 -1
  4. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/dw_config.py +2 -2
  5. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/hb_config.py +1 -1
  6. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/ov_config.py +3 -3
  7. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/rvc_config.py +1 -1
  8. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/so_config.py +1 -1
  9. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/td_config.py +2 -2
  10. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/wd_config.py +2 -2
  11. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/wm_config.py +2 -2
  12. electrolux_group_developer_sdk-0.2.0/electrolux_group_developer_sdk/auth/auth_data.py +5 -0
  13. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/auth/token_manager.py +7 -6
  14. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliance_client.py +12 -12
  15. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/ac_appliance.py +20 -7
  16. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/ap_appliance.py +3 -3
  17. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/cr_appliance.py +20 -7
  18. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/dam_ac_appliance.py +4 -4
  19. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/dh_appliance.py +4 -4
  20. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/dw_appliance.py +1 -1
  21. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/hb_appliance.py +4 -4
  22. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/hd_appliance.py +1 -1
  23. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/ov_appliance.py +24 -13
  24. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/rvc_appliance.py +8 -8
  25. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/so_appliance.py +47 -34
  26. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/td_appliance.py +1 -1
  27. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/wd_appliance.py +6 -6
  28. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/wm_appliance.py +6 -6
  29. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/client_exception.py +4 -1
  30. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/appliance_details.py +2 -2
  31. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/appliance_state.py +2 -2
  32. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/failed_connection_exception.py +4 -1
  33. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/constants.py +1 -1
  34. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/pyproject.toml +1 -1
  35. electrolux_group_developer_sdk-0.1.2/electrolux_group_developer_sdk/auth/auth_data.py +0 -5
  36. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/LICENSE +0 -0
  37. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/README.md +0 -0
  38. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/__init__.py +0 -0
  39. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/__init__.py +0 -0
  40. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/ac_config.py +0 -0
  41. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/ap_config.py +0 -0
  42. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/dam_ac_config.py +0 -0
  43. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/dh_config.py +0 -0
  44. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/appliance_config/hd_config.py +0 -0
  45. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/auth/__init__.py +0 -0
  46. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/auth/invalid_credentials_exception.py +0 -0
  47. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/auth/invalid_token_exception.py +0 -0
  48. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/cli_test.py +0 -0
  49. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/__init__.py +0 -0
  50. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliance_data_factory.py +0 -0
  51. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/__init__.py +0 -0
  52. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/appliances/appliance_data.py +0 -0
  53. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/client_util.py +0 -0
  54. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/__init__.py +0 -0
  55. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/appliance.py +0 -0
  56. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/interactive_map.py +0 -0
  57. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/livestream_config.py +0 -0
  58. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/dto/memory_map.py +0 -0
  59. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/client/rate_limiter.py +0 -0
  60. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/config.py +0 -0
  61. {electrolux_group_developer_sdk-0.1.2 → electrolux_group_developer_sdk-0.2.0}/electrolux_group_developer_sdk/feature_constants.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: electrolux-group-developer-sdk
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: A Python async client library for interacting with the Electrolux Developer Portal API.
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -13,7 +13,7 @@ class ApplianceConfig(BaseModel):
13
13
  """Return the state given a specific key."""
14
14
  return reported_appliance_state.get(key) if (key := self.get_property(state_key)) else None
15
15
 
16
- def is_capability_supported(self, feature):
16
+ def is_capability_supported(self, feature: str | list[str]):
17
17
  """Return True if the appliance supports this capability or any capability in a list."""
18
18
  if isinstance(feature, str):
19
19
  key = self.get_property(feature)
@@ -45,7 +45,7 @@ class CrConfig(ApplianceConfig):
45
45
 
46
46
  return outer_value.get(nested_state_key)
47
47
 
48
- def is_cavity_capability_supported(self, cavity: str, feature) -> bool:
48
+ def is_cavity_capability_supported(self, cavity: str, feature: str | list[str]) -> bool:
49
49
  """Return True if the appliance supports this cavity capability or any capability in a list."""
50
50
  cavity_capabilities = self.capabilities.get(cavity)
51
51
  if cavity_capabilities is None:
@@ -1,6 +1,6 @@
1
1
  """Dishwasher configuration."""
2
2
  import datetime
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
  from zoneinfo import ZoneInfo
5
5
 
6
6
  from .config import ApplianceConfig
@@ -77,7 +77,7 @@ class DwConfig(ApplianceConfig):
77
77
  """Get the current alerts from the reported state."""
78
78
  return self._get_state(ALERTS, reported_appliance_state)
79
79
 
80
- def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[datetime, datetime]:
80
+ def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime]]:
81
81
  """Get the current start at time and end at time from the reported state."""
82
82
  appliance_state = self.get_current_appliance_state(reported_appliance_state)
83
83
 
@@ -49,7 +49,7 @@ class HbConfig(ApplianceConfig):
49
49
  hood_capabilities = self.capabilities.get(self.get_property(HOB_HOOD), {})
50
50
  return key is not None and hood_capabilities is not None and key in hood_capabilities
51
51
 
52
- def is_hob_zone_capability_supported(self, zone:str, feature: str) -> bool:
52
+ def is_hob_zone_capability_supported(self, zone: str, feature: str) -> bool:
53
53
  """Return True if the appliance supports this hob zone capability."""
54
54
  key = self.get_property(feature)
55
55
  hob_zone_capabilities = self.capabilities.get(zone)
@@ -1,6 +1,6 @@
1
1
  """Oven configuration."""
2
2
  import datetime
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
  from zoneinfo import ZoneInfo
5
5
 
6
6
  from .config import ApplianceConfig
@@ -57,7 +57,7 @@ class OvConfig(ApplianceConfig):
57
57
  if not meta.get("disabled", False)
58
58
  ]
59
59
 
60
- def get_temperature_range(self, program_name: str, reported_appliance_state: dict) -> dict[str, float]:
60
+ def get_temperature_range(self, program_name: str, reported_appliance_state: dict[str, Any]) -> dict[str, float]:
61
61
  """Extract temperature range for the given program based on temperature unit."""
62
62
 
63
63
  program_trigger = self.capabilities.get(self.get_property(PROGRAM), {}).get(VALUES, {}).get(program_name, {})
@@ -202,7 +202,7 @@ class OvConfig(ApplianceConfig):
202
202
  """Get the current display food probe temperature c from the reported state."""
203
203
  return self._get_state(DISPLAY_FOOD_PROBE_TEMPERATURE_C, reported_appliance_state)
204
204
 
205
- def get_current_start_at(self, reported_appliance_state: dict[str, Any]) -> datetime:
205
+ def get_current_start_at(self, reported_appliance_state: dict[str, Any]) -> Optional[datetime.datetime]:
206
206
  """Get the current start at time from the reported state."""
207
207
  appliance_state = self.get_current_appliance_state(reported_appliance_state)
208
208
 
@@ -152,7 +152,7 @@ class RvcConfig(ApplianceConfig):
152
152
  def _is_paused_map(self) -> dict[str, Any]:
153
153
  return self.mapping.get(IS_PAUSED_MAP, {})
154
154
 
155
- def get_supported_modes(self) -> list[Any]:
155
+ def get_supported_modes(self) -> list[int] | list[str]:
156
156
  """Return the list of supported readable modes."""
157
157
  mode_capability = self.capabilities.get(self.get_property(MODE))
158
158
  if not mode_capability:
@@ -62,7 +62,7 @@ class SoConfig(ApplianceConfig):
62
62
 
63
63
  return outer_value.get(nested_state_key)
64
64
 
65
- def is_cavity_capability_supported(self, cavity: str, feature) -> bool:
65
+ def is_cavity_capability_supported(self, cavity: str, feature: str | list[str]) -> bool:
66
66
  """Return True if the appliance supports this cavity capability or any capability in a list."""
67
67
  cavity_capabilities = self.capabilities.get(cavity)
68
68
  if cavity_capabilities is None:
@@ -1,6 +1,6 @@
1
1
  """Tumble Dryer configuration."""
2
2
  import datetime
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
  from zoneinfo import ZoneInfo
5
5
 
6
6
  from .config import ApplianceConfig
@@ -81,7 +81,7 @@ class TdConfig(ApplianceConfig):
81
81
  """Get the current appliance state from the reported state."""
82
82
  return self._get_state(APPLIANCE_STATE, reported_appliance_state)
83
83
 
84
- def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[datetime, datetime]:
84
+ def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime]]:
85
85
  """Get the current start at time and end at time from the reported state."""
86
86
  appliance_state = self.get_current_appliance_state(reported_appliance_state)
87
87
 
@@ -1,6 +1,6 @@
1
1
  """Washer Dryer configuration."""
2
2
  import datetime
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
  from zoneinfo import ZoneInfo
5
5
 
6
6
  from .config import ApplianceConfig
@@ -200,7 +200,7 @@ class WdConfig(ApplianceConfig):
200
200
  self.get_property(TANK_B_RESERVE)
201
201
  )
202
202
 
203
- def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[datetime, datetime]:
203
+ def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime]]:
204
204
  """Get the current start at time and end at time from the reported state."""
205
205
  appliance_state = self.get_current_appliance_state(reported_appliance_state)
206
206
 
@@ -1,6 +1,6 @@
1
1
  """Washer Machine configuration."""
2
2
  import datetime
3
- from typing import Any
3
+ from typing import Any, Optional
4
4
  from zoneinfo import ZoneInfo
5
5
 
6
6
  from .config import ApplianceConfig
@@ -196,7 +196,7 @@ class WmConfig(ApplianceConfig):
196
196
  self.get_property(TANK_B_RESERVE)
197
197
  )
198
198
 
199
- def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[datetime, datetime]:
199
+ def get_current_start_at_stop_at(self, reported_appliance_state: dict[str, Any]) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime]]:
200
200
  """Get the current start at time and end at time from the reported state."""
201
201
  appliance_state = self.get_current_appliance_state(reported_appliance_state)
202
202
 
@@ -0,0 +1,5 @@
1
+ class AuthData:
2
+ def __init__(self, access_token: str, refresh_token: str, api_key: str):
3
+ self.access_token = access_token
4
+ self.refresh_token = refresh_token
5
+ self.api_key = api_key
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import time
3
+ from typing import Callable, Optional
3
4
 
4
5
  import jwt
5
6
 
@@ -13,7 +14,7 @@ from ..constants import REFRESH_TOKEN, POST
13
14
  _LOGGER = logging.getLogger(__name__)
14
15
 
15
16
 
16
- def get_user_id_from_token(token) -> str:
17
+ def get_user_id_from_token(token: str) -> str:
17
18
  """Extract user id from token"""
18
19
  payload = jwt.decode(
19
20
  token,
@@ -26,7 +27,7 @@ def get_user_id_from_token(token) -> str:
26
27
 
27
28
 
28
29
  class TokenManager:
29
- def __init__(self, access_token: str, refresh_token: str, api_key: str, on_token_update=None):
30
+ def __init__(self, access_token: str, refresh_token: str, api_key: str, on_token_update: Optional[Callable[[str, str, str], None]] = None):
30
31
  """Initialize the token manager."""
31
32
  if access_token is None:
32
33
  _LOGGER.error("Access Token is missing")
@@ -35,7 +36,7 @@ class TokenManager:
35
36
  self._auth_data = AuthData(access_token, refresh_token, api_key)
36
37
  self.update(access_token, refresh_token, api_key)
37
38
 
38
- def update(self, access_token: str, refresh_token: str, api_key: str):
39
+ def update(self, access_token: str, refresh_token: str, api_key: str) -> None:
39
40
  """Update the authentication data."""
40
41
  if self._on_token_update:
41
42
  self._on_token_update(access_token, refresh_token, api_key)
@@ -75,7 +76,7 @@ class TokenManager:
75
76
  _LOGGER.error("Access Token is invalid - %s", e)
76
77
  return False
77
78
 
78
- async def refresh_token(self):
79
+ async def refresh_token(self) -> bool:
79
80
  auth_data = self._auth_data
80
81
 
81
82
  if not auth_data or auth_data.refresh_token is None:
@@ -98,7 +99,7 @@ class TokenManager:
98
99
  _LOGGER.error("Error during token refresh: %s", e)
99
100
  return False
100
101
 
101
- async def revoke_token(self):
102
+ async def revoke_token(self) -> bool:
102
103
  auth_data = self._auth_data
103
104
  if not auth_data or auth_data.refresh_token is None:
104
105
  raise Exception("Missing refresh token")
@@ -115,7 +116,7 @@ class TokenManager:
115
116
  _LOGGER.error("Error during token revoke: %s", e)
116
117
  return False
117
118
 
118
- async def get_auth_data(self):
119
+ async def get_auth_data(self) -> AuthData:
119
120
  auth_data = self._auth_data
120
121
  if not auth_data or auth_data.access_token is None or auth_data.api_key is None:
121
122
  raise Exception("Missing access token or API key")
@@ -40,7 +40,7 @@ def _is_dam_appliance(appliance_id):
40
40
  return False
41
41
 
42
42
 
43
- def _build_user_agent(external_user_agent: str = None) -> str:
43
+ def _build_user_agent(external_user_agent: Optional[str] = None) -> str:
44
44
  sdk_version = SDK_VERSION
45
45
 
46
46
  sdk_user_agent = f"{SDK_USER_AGENT}/{sdk_version}"
@@ -62,7 +62,7 @@ class ApplianceClient:
62
62
  _token_manager (TokenManager)
63
63
  """
64
64
 
65
- def __init__(self, token_manager: TokenManager, external_user_agent: str = None):
65
+ def __init__(self, token_manager: TokenManager, external_user_agent: Optional[str] = None):
66
66
  """
67
67
  Initialize the ApplianceClient.
68
68
 
@@ -77,7 +77,7 @@ class ApplianceClient:
77
77
  self._sse_listeners: dict[str, list[Callable[[dict], None]]] = {}
78
78
  self._external_user_agent = external_user_agent
79
79
 
80
- async def test_connection(self):
80
+ async def test_connection(self) -> None:
81
81
  try:
82
82
  await self._send_authorized_request(GET, GET_APPLIANCES_URL)
83
83
  except ApplianceClientException as e:
@@ -122,7 +122,7 @@ class ApplianceClient:
122
122
 
123
123
  return appliance_list
124
124
 
125
- async def get_appliances(self):
125
+ async def get_appliances(self) -> list[Appliance]:
126
126
  """
127
127
  Retrieve a list of appliances associated with the authenticated user.
128
128
 
@@ -145,7 +145,7 @@ class ApplianceClient:
145
145
  _LOGGER.error("Failed to get appliances: %s", e)
146
146
  raise ApplianceClientException(f"Failed to get appliances: {e}")
147
147
 
148
- async def get_appliance_details(self, appliance_id):
148
+ async def get_appliance_details(self, appliance_id: str) -> ApplianceDetails:
149
149
  """
150
150
  Retrieve detailed information about a specific appliance.
151
151
 
@@ -176,7 +176,7 @@ class ApplianceClient:
176
176
  _LOGGER.error("Error during get appliance info: %s", e)
177
177
  raise ApplianceClientException(f"Failed to get appliance info: {e}")
178
178
 
179
- async def get_appliance_state(self, appliance_id):
179
+ async def get_appliance_state(self, appliance_id: str) -> ApplianceState:
180
180
  """
181
181
  Retrieve the current state of a specific appliance.
182
182
 
@@ -214,7 +214,7 @@ class ApplianceClient:
214
214
  _LOGGER.error("Error during get appliance state: %s", e)
215
215
  raise ApplianceClientException(f"Failed to get appliance state: {e}")
216
216
 
217
- async def send_command(self, appliance_id: str, commands: dict[str, Any]):
217
+ async def send_command(self, appliance_id: str, commands: dict[str, Any]) -> Any:
218
218
  """
219
219
  Send a command to the appliance.
220
220
 
@@ -248,7 +248,7 @@ class ApplianceClient:
248
248
  _LOGGER.error("Error sending command: %s", e)
249
249
  raise ApplianceClientException(f"Failed to send command: {e}")
250
250
 
251
- async def get_interactive_maps(self, appliance_id):
251
+ async def get_interactive_maps(self, appliance_id: str) -> list[dict[str, Any]]:
252
252
  """
253
253
  Retrieve interactive maps for a given appliance ID.
254
254
 
@@ -282,7 +282,7 @@ class ApplianceClient:
282
282
  _LOGGER.error("Error during get interactive map: %s", e)
283
283
  raise ApplianceClientException(f"Failed to get interactive maps: {e}")
284
284
 
285
- async def get_memory_maps(self, appliance_id):
285
+ async def get_memory_maps(self, appliance_id: str) -> list[dict[str, Any]]:
286
286
  """
287
287
  Retrieve memory maps for a given appliance ID.
288
288
 
@@ -316,7 +316,7 @@ class ApplianceClient:
316
316
  _LOGGER.error("Error during get memory maps: %s", e)
317
317
  raise ApplianceClientException(f"Failed to get memory maps: {e}")
318
318
 
319
- async def get_livestream_config(self):
319
+ async def get_livestream_config(self) -> LivestreamConfig:
320
320
  url = GET_LIVESTREAM_CONFIG_URL
321
321
  try:
322
322
  response = await self._send_authorized_request(GET, url)
@@ -415,13 +415,13 @@ class ApplianceClient:
415
415
  _LOGGER.info("Close websession")
416
416
  await websession.close()
417
417
 
418
- def add_listener(self, appliance_id: str, callback: Callable[[dict], None]):
418
+ def add_listener(self, appliance_id: str, callback: Callable[[dict], None]) -> None:
419
419
  """Register a callback for a specific appliance."""
420
420
  _LOGGER.info("Add listener for: %s", appliance_id)
421
421
 
422
422
  self._sse_listeners.setdefault(appliance_id, []).append(callback)
423
423
 
424
- def remove_listener(self, appliance_id: str, callback: Callable[[dict], None]):
424
+ def remove_listener(self, appliance_id: str, callback: Callable[[dict], None]) -> None:
425
425
  """Unregister a callback."""
426
426
  _LOGGER.info("Remove listener for: %s", appliance_id)
427
427
 
@@ -5,7 +5,7 @@ from pydantic import PrivateAttr
5
5
  from .appliance_data import ApplianceData
6
6
  from ...appliance_config.ac_config import AcConfig, AcConfigManager, FAN_SPEED_SETTING, MODE, TARGET_TEMPERATURE_C, \
7
7
  TARGET_TEMPERATURE_F, EXECUTE_COMMAND
8
- from ...constants import REPORTED
8
+ from ...constants import CELSIUS, FAHRENHEIT, REPORTED
9
9
 
10
10
 
11
11
  class ACAppliance(ApplianceData):
@@ -21,7 +21,7 @@ class ACAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = AcConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def get_supported_modes(self) -> list[str]:
@@ -50,7 +50,20 @@ class ACAppliance(ApplianceData):
50
50
 
51
51
  def get_current_temperature_unit(self) -> str:
52
52
  """Return the current temperature unit."""
53
- return self._config.get_current_temperature_unit(self.state.properties.get(REPORTED))
53
+
54
+ temperature_unit = self._config.get_current_temperature_unit(self.state.properties.get(REPORTED))
55
+
56
+ if temperature_unit is not None:
57
+ return temperature_unit
58
+
59
+ celsiusSupported = self._config.is_capability_supported(TARGET_TEMPERATURE_C)
60
+ fahrenheitSupported = self._config.is_capability_supported(TARGET_TEMPERATURE_F)
61
+
62
+ if (not celsiusSupported) and fahrenheitSupported:
63
+ return FAHRENHEIT
64
+
65
+ return CELSIUS
66
+
54
67
 
55
68
  def get_current_target_temperature_c(self) -> float:
56
69
  """Return the current target temperature in Celsius."""
@@ -76,25 +89,25 @@ class ACAppliance(ApplianceData):
76
89
  """Return the current fan speed setting."""
77
90
  return self._config.get_current_fan_speed(self.state.properties.get(REPORTED))
78
91
 
79
- def get_fan_speed_command(self, fan_speed) -> dict[str, Any]:
92
+ def get_fan_speed_command(self, fan_speed: str) -> dict[str, Any]:
80
93
  """Return the command payload to set the fan speed."""
81
94
  return {
82
95
  self._config.get_property(FAN_SPEED_SETTING): fan_speed
83
96
  }
84
97
 
85
- def get_mode_command(self, mode) -> dict[str, Any]:
98
+ def get_mode_command(self, mode: str) -> dict[str, Any]:
86
99
  """Return the command payload to set the mode."""
87
100
  return {
88
101
  self._config.get_property(MODE): mode
89
102
  }
90
103
 
91
- def get_temperature_c_command(self, temperature) -> dict[str, Any]:
104
+ def get_temperature_c_command(self, temperature: float) -> dict[str, Any]:
92
105
  """Return the command payload to set the temperature in Celsius."""
93
106
  return {
94
107
  self._config.get_property(TARGET_TEMPERATURE_C): temperature
95
108
  }
96
109
 
97
- def get_temperature_f_command(self, temperature) -> dict[str, Any]:
110
+ def get_temperature_f_command(self, temperature: float) -> dict[str, Any]:
98
111
  """Return the command payload to set the temperature in Fahrenheit."""
99
112
  return {
100
113
  self._config.get_property(TARGET_TEMPERATURE_F): temperature
@@ -21,7 +21,7 @@ class APAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = ApConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def get_air_quality_map(self) -> dict[str, str]:
@@ -60,13 +60,13 @@ class APAppliance(ApplianceData):
60
60
  """Return the current air quality value for the specified property."""
61
61
  return self._config.get_air_quality(self.state.properties.get(REPORTED), air_quality_property)
62
62
 
63
- def get_fan_speed_command(self, fan_speed) -> dict[str, int]:
63
+ def get_fan_speed_command(self, fan_speed: int) -> dict[str, Any]:
64
64
  """Return the command payload to set the fan speed."""
65
65
  return {
66
66
  self._config.get_property(FAN_SPEED): fan_speed
67
67
  }
68
68
 
69
- def get_mode_command(self, mode) -> dict[str, str]:
69
+ def get_mode_command(self, mode: str) -> dict[str, Any]:
70
70
  """Return the command payload to set the mode."""
71
71
  return {
72
72
  self._config.get_property(WORKMODE): mode
@@ -2,10 +2,10 @@ from typing import Any
2
2
 
3
3
  from pydantic import PrivateAttr
4
4
 
5
- from ...appliance_config.cr_config import CrConfig, CrConfigManager, TARGET_TEMPERATURE_F, TARGET_TEMPERATURE_C, \
5
+ from ...appliance_config.cr_config import FREEZER, FRIDGE, CrConfig, CrConfigManager, TARGET_TEMPERATURE_F, TARGET_TEMPERATURE_C, \
6
6
  VACATION_HOLIDAY_MODE
7
7
  from ...client.appliances.appliance_data import ApplianceData
8
- from ...constants import REPORTED, MIN, MAX, STEP
8
+ from ...constants import CELSIUS, FAHRENHEIT, REPORTED, MIN, MAX, STEP
9
9
 
10
10
 
11
11
  class CRAppliance(ApplianceData):
@@ -21,7 +21,7 @@ class CRAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = CrConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def is_cavity_feature_supported(self, cavity: str, feature: str) -> bool:
@@ -49,7 +49,20 @@ class CRAppliance(ApplianceData):
49
49
 
50
50
  def get_current_temperature_unit(self) -> str:
51
51
  """Get the current temperature unit from the reported state."""
52
- return self._config.get_current_temperature_unit(self.state.properties.get(REPORTED))
52
+ temperature_unit = self._config.get_current_temperature_unit(self.state.properties.get(REPORTED))
53
+
54
+ if temperature_unit is not None:
55
+ return temperature_unit
56
+
57
+ celsiusSupported = (self._config.is_cavity_capability_supported(FRIDGE, TARGET_TEMPERATURE_C)
58
+ or self._config.is_cavity_capability_supported(FREEZER, TARGET_TEMPERATURE_C))
59
+ fahrenheitSupported = (self._config.is_cavity_capability_supported(FRIDGE, TARGET_TEMPERATURE_F)
60
+ or self._config.is_cavity_capability_supported(FREEZER, TARGET_TEMPERATURE_F))
61
+
62
+ if (not celsiusSupported) and fahrenheitSupported:
63
+ return FAHRENHEIT
64
+
65
+ return CELSIUS
53
66
 
54
67
  def get_current_alerts(self) -> str:
55
68
  """Get the current alerts from the reported state."""
@@ -91,15 +104,15 @@ class CRAppliance(ApplianceData):
91
104
  """Get the current cavity door state from the reported state."""
92
105
  return self._config.get_current_door_state(cavity, self.state.properties.get(REPORTED))
93
106
 
94
- def get_set_cavity_temperature_f_command(self, cavity, temperature) -> dict[str, Any]:
107
+ def get_set_cavity_temperature_f_command(self, cavity: str, temperature: float) -> dict[str, Any]:
95
108
  return {
96
109
  cavity: {self._config.get_property(TARGET_TEMPERATURE_F): temperature}
97
110
  }
98
111
 
99
- def get_set_cavity_temperature_c_command(self, cavity, temperature) -> dict[str, Any]:
112
+ def get_set_cavity_temperature_c_command(self, cavity: str, temperature: float) -> dict[str, Any]:
100
113
  return {
101
114
  cavity: {self._config.get_property(TARGET_TEMPERATURE_C): temperature}
102
115
  }
103
116
 
104
- def get_set_vacation_holiday_mode_command(self, value) -> dict[str, Any]:
117
+ def get_set_vacation_holiday_mode_command(self, value: str) -> dict[str, Any]:
105
118
  return {self._config.get_property(VACATION_HOLIDAY_MODE): value}
@@ -22,7 +22,7 @@ class DAMACAppliance(ApplianceData):
22
22
  capabilities = self.details.capabilities if self.details else {}
23
23
  self._config = DamAcConfigManager().get_config(self.appliance.applianceType, capabilities)
24
24
 
25
- def is_feature_supported(self, feature) -> bool:
25
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
26
26
  return self._config.is_capability_supported(feature)
27
27
 
28
28
  def is_air_conditioner_feature_supported(self, feature: str) -> bool:
@@ -72,7 +72,7 @@ class DAMACAppliance(ApplianceData):
72
72
  """Return the current fan speed setting."""
73
73
  return self._config.get_current_fan_speed(self.state.properties.get(REPORTED))
74
74
 
75
- def get_fan_speed_command(self, fan_speed) -> dict[str, Any]:
75
+ def get_fan_speed_command(self, fan_speed: str) -> dict[str, Any]:
76
76
  """Return the command payload to set the fan speed."""
77
77
  return {
78
78
  self._config.get_property(AIR_CONDITIONER): {
@@ -80,7 +80,7 @@ class DAMACAppliance(ApplianceData):
80
80
  }
81
81
  }
82
82
 
83
- def get_mode_command(self, mode) -> dict[str, Any]:
83
+ def get_mode_command(self, mode: str) -> dict[str, Any]:
84
84
  """Return the command payload to set the mode."""
85
85
  return {
86
86
  self._config.get_property(AIR_CONDITIONER): {
@@ -88,7 +88,7 @@ class DAMACAppliance(ApplianceData):
88
88
  }
89
89
  }
90
90
 
91
- def get_temperature_command(self, temperature) -> dict[str, Any]:
91
+ def get_temperature_command(self, temperature: float) -> dict[str, Any]:
92
92
  """Return the command payload to set the temperature in Celsius."""
93
93
  return {
94
94
  self._config.get_property(AIR_CONDITIONER): {
@@ -21,7 +21,7 @@ class DHAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = DhConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def is_appliance_on(self) -> bool:
@@ -68,20 +68,20 @@ class DHAppliance(ApplianceData):
68
68
  """Return the current ambient humidity."""
69
69
  return self._config.get_current_sensor_humidity(self.state.properties.get(REPORTED))
70
70
 
71
- def get_fan_speed_command(self, fan_speed) -> dict[str, Any]:
71
+ def get_fan_speed_command(self, fan_speed: str) -> dict[str, Any]:
72
72
  """Return the command payload to set a new fan speed."""
73
73
  return {
74
74
  self._config.get_property(FAN_SPEED): fan_speed
75
75
  }
76
76
 
77
- def get_mode_command(self, mode) -> dict[str, Any]:
77
+ def get_mode_command(self, mode: str) -> dict[str, Any]:
78
78
  """Return the command payload to set a new mode, or turn off if the mode is 'off'."""
79
79
  if mode == self._config.get_property(MODE_OFF):
80
80
  return self.get_turn_off_command()
81
81
  else:
82
82
  return {self._config.get_property(MODE): mode}
83
83
 
84
- def get_humidity_command(self, humidity) -> dict[str, Any]:
84
+ def get_humidity_command(self, humidity: int) -> dict[str, Any]:
85
85
  """Return the command payload to set a target humidity."""
86
86
  return {
87
87
  self._config.get_property(TARGET_HUMIDITY): humidity
@@ -22,7 +22,7 @@ class DWAppliance(ApplianceData):
22
22
  capabilities = self.details.capabilities if self.details else {}
23
23
  self._config = DwConfigManager().get_config(self.appliance.applianceType, capabilities)
24
24
 
25
- def is_feature_supported(self, feature) -> bool:
25
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
26
26
  return self._config.is_capability_supported(feature)
27
27
 
28
28
  def get_supported_programs(self) -> list[str]:
@@ -21,7 +21,7 @@ class HBAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = HbConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def is_hood_feature_supported(self, feature: str) -> bool:
@@ -106,7 +106,7 @@ class HBAppliance(ApplianceData):
106
106
  """Return the current zone hob pot detected."""
107
107
  return self._config.get_current_zone_hob_pot_detected(hob_zone, self.state.properties.get(REPORTED))
108
108
 
109
- def get_hood_fan_speed_command(self, fan_speed) -> dict[str, Any]:
109
+ def get_hood_fan_speed_command(self, fan_speed: str) -> dict[str, Any]:
110
110
  """Return the command payload to set a new hood fan speed."""
111
111
  return {
112
112
  self._config.get_property(HOB_HOOD): {
@@ -114,7 +114,7 @@ class HBAppliance(ApplianceData):
114
114
  }
115
115
  }
116
116
 
117
- def get_hood_state_command(self, state) -> dict[str, Any]:
117
+ def get_hood_state_command(self, state: str) -> dict[str, Any]:
118
118
  """Return the command payload to set a new hood state."""
119
119
  return {
120
120
  self._config.get_property(HOB_HOOD): {
@@ -122,7 +122,7 @@ class HBAppliance(ApplianceData):
122
122
  }
123
123
  }
124
124
 
125
- def get_key_sound_tone_command(self, tone) -> dict[str, Any]:
125
+ def get_key_sound_tone_command(self, tone: str) -> dict[str, Any]:
126
126
  """Return the command payload to set the key sound tone."""
127
127
  return {
128
128
  self._config.get_property(KEY_SOUND_TONE): tone
@@ -21,7 +21,7 @@ class HDAppliance(ApplianceData):
21
21
  capabilities = self.details.capabilities if self.details else {}
22
22
  self._config = HdConfigManager().get_config(self.appliance.applianceType, capabilities)
23
23
 
24
- def is_feature_supported(self, feature) -> bool:
24
+ def is_feature_supported(self, feature: str | list[str]) -> bool:
25
25
  return self._config.is_capability_supported(feature)
26
26
 
27
27
  def get_supported_hood_fan_level(self) -> list[str]: