Skip to content

Commit 5c5e653

Browse files
committed
Try 8
1 parent 5dc45e4 commit 5c5e653

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

plugwise/smile.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def __init__(
9898
request: Callable[..., Awaitable[Any]],
9999
_cooling_present: bool,
100100
_elga: bool,
101-
_gateway_id: str,
101+
_gateway_id: dict[str, str],
102102
_is_thermostat: bool,
103103
_last_active: dict[str, str | None],
104104
_loc_data: dict[str, ThermoLoc],
@@ -151,7 +151,7 @@ def _all_entity_data(self) -> None:
151151

152152
self.gw_data.update(
153153
{
154-
"gateway_id": self._gateway_id,
154+
"gateway_id": self._gateway_id["gateway_id"],
155155
"item_count": self._count,
156156
"notifications": self._notifications,
157157
"reboot": True,
@@ -180,7 +180,7 @@ def _update_gw_entities(self) -> None:
180180
mac_list: list[str] = []
181181
for entity_id, entity in self.gw_entities.items():
182182
data = self._get_entity_data(entity_id)
183-
if entity_id == self._gateway_id:
183+
if entity_id == self._gateway_id["gateway_id"]:
184184
mac_list = self._detect_low_batteries()
185185
self._add_or_update_notifications(entity_id, entity, data)
186186

@@ -234,7 +234,7 @@ def _add_or_update_notifications(
234234
) -> None:
235235
"""Helper-function adding or updating the Plugwise notifications."""
236236
if (
237-
entity_id == self._gateway_id
237+
entity_id == self._gateway_id["gateway_id"]
238238
and (self._is_thermostat or self.smile_type == "power")
239239
) or (
240240
"binary_sensors" in entity
@@ -350,7 +350,7 @@ def _get_p1_smartmeter_info(self) -> None:
350350
LOGGER.error("No module data found for SmartMeter") # pragma: no cover
351351
return # pragma: no cover
352352
appl.available = None
353-
appl.entity_id = self._gateway_id
353+
appl.entity_id = self._gateway_id["gateway_id"]
354354
appl.firmware = module_data["firmware_version"]
355355
appl.hardware = module_data["hardware_version"]
356356
appl.location = self._home_loc_id
@@ -363,8 +363,8 @@ def _get_p1_smartmeter_info(self) -> None:
363363
appl.zigbee_mac = None
364364

365365
# Replace the entity_id of the gateway by the smartmeter location_id
366-
self.gw_entities[self._home_loc_id] = self.gw_entities.pop(self._gateway_id)
367-
self._gateway_id = self._home_loc_id
366+
self.gw_entities[self._home_loc_id] = self.gw_entities.pop(self._gateway_id["gateway_id"])
367+
self._gateway_id = {"gateway_id": self._home_loc_id}
368368

369369
self._create_gw_entities(appl)
370370

@@ -437,7 +437,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
437437

438438
def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
439439
"""Helper-function for _appliance_info_finder()."""
440-
self._gateway_id = appliance.attrib["id"]
440+
self._gateway_id = {"gateway_id": appliance.attrib["id"]}
441441
appl.firmware = str(self.smile_fw_version)
442442
appl.hardware = self.smile_hw_version
443443
appl.mac = self.smile_mac_address
@@ -715,7 +715,7 @@ def _get_actuator_mode(
715715
716716
Collect the requested gateway mode.
717717
"""
718-
if not (self.smile(ADAM) and entity_id == self._gateway_id):
718+
if not (self.smile(ADAM) and entity_id == self._gateway_id["gateway_id"]):
719719
return None
720720

721721
if (search := search_actuator_functionalities(appliance, key)) is not None:
@@ -756,7 +756,7 @@ def _get_gateway_mode(
756756

757757
def _get_gateway_outdoor_temp(self, entity_id: str, data: GwEntityData) -> None:
758758
"""Adam & Anna: the Smile outdoor_temperature is present in the Home location."""
759-
if self._is_thermostat and entity_id == self._gateway_id:
759+
if self._is_thermostat and entity_id == self._gateway_id["gateway_id"]:
760760
locator = "./logs/point_log[type='outdoor_temperature']/period/measurement"
761761
if (found := self._home_location.find(locator)) is not None:
762762
value = format_measure(found.text, NONE)
@@ -1295,7 +1295,7 @@ def _climate_data(
12951295

12961296
def check_reg_mode(self, mode: str) -> bool:
12971297
"""Helper-function for device_data_climate()."""
1298-
gateway = self.gw_entities[self._gateway_id]
1298+
gateway = self.gw_entities[self._gateway_id["gateway_id"]]
12991299
return (
13001300
"regulation_modes" in gateway and gateway["select_regulation_mode"] == mode
13011301
)
@@ -1388,7 +1388,7 @@ async def async_update(self) -> PlugwiseData:
13881388
"cooling_enabled"
13891389
]
13901390
else: # cover failed data-retrieval for P1
1391-
_ = self.gw_entities[self._gateway_id]["location"]
1391+
_ = self.gw_entities[self._gateway_id["gateway_id"]]["location"]
13921392
except KeyError as err:
13931393
raise DataMissingError("No Plugwise actual data received") from err
13941394

@@ -1521,7 +1521,7 @@ async def set_gateway_mode(self, mode: str) -> None:
15211521
vacation_time = time_2 + "T23:00:00.000Z"
15221522
valid = f"<valid_from>{vacation_time}</valid_from><valid_to>{end_time}</valid_to>"
15231523

1524-
uri = f"{APPLIANCES};id={self._gateway_id}/gateway_mode_control"
1524+
uri = f"{APPLIANCES};id={self._gateway_id['gateway_id']}/gateway_mode_control"
15251525
data = f"<gateway_mode_control_functionality><mode>{mode}</mode>{valid}</gateway_mode_control_functionality>"
15261526

15271527
await self.call_request(uri, method="put", data=data)

0 commit comments

Comments
 (0)