Skip to content

Commit cb80564

Browse files
committed
Store module_id for future use
1 parent 000cb4a commit cb80564

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

plugwise/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def _appl_heater_central_info(
116116
appl.model = (
117117
"Generic heater/cooler" if self._cooling_present else "Generic heater"
118118
)
119+
appl.module_id = module_data["module_id"]
119120

120121
return appl
121122

@@ -140,6 +141,7 @@ def _appl_thermostat_info(
140141
appl.available = module_data["reachable"]
141142
appl.hardware = module_data["hardware_version"]
142143
appl.firmware = module_data["firmware_version"]
144+
appl.module_id = module_data["module_id"]
143145
appl.zigbee_mac = module_data["zigbee_mac_address"]
144146

145147
return appl
@@ -156,6 +158,7 @@ def _create_gw_entities(self, appl: Munch) -> None:
156158
"mac_address": appl.mac,
157159
"model": appl.model,
158160
"model_id": appl.model_id,
161+
"module_id": appl.module_id,
159162
"name": appl.name,
160163
"vendor": appl.vendor_name,
161164
"zigbee_mac_address": appl.zigbee_mac,
@@ -255,6 +258,7 @@ def _get_module_data(
255258
"contents": False,
256259
"firmware_version": None,
257260
"hardware_version": None,
261+
"module_id": None,
258262
"reachable": None,
259263
"vendor_name": None,
260264
"vendor_model": None,
@@ -278,6 +282,7 @@ def _get_module_data(
278282
module_data["vendor_model"] = module.find("vendor_model").text
279283
module_data["hardware_version"] = module.find("hardware_version").text
280284
module_data["firmware_version"] = module.find("firmware_version").text
285+
module_data["module_id"] = module.attrib["id"]
281286
get_zigbee_data(module, module_data, legacy)
282287

283288
break

plugwise/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"members",
287287
"model",
288288
"model_id",
289+
"module_id",
289290
"name",
290291
"vendor",
291292
"zigbee_mac_address",
@@ -417,6 +418,7 @@ class ModuleData(TypedDict):
417418
contents: bool
418419
firmware_version: str | None
419420
hardware_version: str | None
421+
module_id: str | None
420422
reachable: bool | None
421423
vendor_model: str | None
422424
vendor_name: str | None
@@ -539,6 +541,7 @@ class GwEntityData(TypedDict, total=False):
539541
members: list[str]
540542
model: str
541543
model_id: str | None
544+
module_id: str | None
542545
name: str
543546
vendor: str
544547
zigbee_mac_address: str

plugwise/helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def _all_appliances(self) -> bool:
112112
appl.name = appliance.find("name").text
113113
appl.model = None
114114
appl.model_id = None
115+
appl.module_id = None
115116
appl.firmware = None
116117
appl.hardware = None
117118
appl.mac = None
@@ -200,6 +201,7 @@ def _add_p1_smartmeter_info(self) -> None:
200201
appl.mac = None
201202
appl.model = module_data["vendor_model"]
202203
appl.model_id = None # don't use model_id for SmartMeter
204+
appl.module_id = module_data["module_id"]
203205
appl.name = "P1"
204206
appl.pwclass = "smartmeter"
205207
appl.vendor_name = module_data["vendor_name"]
@@ -260,6 +262,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree.Element) -> Munch
260262
appl.firmware = module_data["firmware_version"]
261263
appl.hardware = module_data["hardware_version"]
262264
appl.model_id = module_data["vendor_model"]
265+
appl.module_id = module_data["module_id"]
263266
appl.vendor_name = module_data["vendor_name"]
264267
appl.model = check_model(appl.model_id, appl.vendor_name)
265268
appl.zigbee_mac = module_data["zigbee_mac_address"]

0 commit comments

Comments
 (0)