Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
eca817e
Initial typed xml reading attempt (incomplete)
CoMPaTech Dec 28, 2025
408682b
Further progress
CoMPaTech Dec 29, 2025
6c6b3f2
Further progress - appliance typos
CoMPaTech Dec 29, 2025
709e84c
Some progress
CoMPaTech Dec 29, 2025
660acd8
More progress
CoMPaTech Dec 29, 2025
826c387
Further cleaning
CoMPaTech Dec 29, 2025
baf3419
Gateway progress
CoMPaTech Dec 31, 2025
9cd1b54
Fix after rebase
bouwew Jan 24, 2026
91b6877
Contents -> content
bouwew Jan 24, 2026
e2ad185
Fix module_data
bouwew Jan 24, 2026
9c011df
Fix another contents
bouwew Jan 24, 2026
6d09ec6
Add xmltodict to requirements
bouwew Apr 5, 2026
04698e7
Change index from 5 to 4
bouwew Apr 5, 2026
7e393f5
Update _appl_heater_central_info()
bouwew Apr 6, 2026
1d36e07
Update check_heater_central()
bouwew Apr 7, 2026
7c84129
And use
bouwew Apr 7, 2026
39ab2b3
Fixes
bouwew Apr 7, 2026
d7fa9f7
More _appl_heater_central_info() updating
bouwew Apr 13, 2026
85bfdda
Fix contents
bouwew Apr 13, 2026
613cbb3
Update _appl_thermostat_info()
bouwew Apr 13, 2026
aeee690
Update _get_appliances_with_offset_functionality()
bouwew Apr 13, 2026
8e3c64c
get_groups()
bouwew Apr 13, 2026
a4a8822
Disable prints, add logger
bouwew Apr 17, 2026
6728175
Disable initial Adam testcase
bouwew Apr 17, 2026
bbe0e9d
Add _create_gw_entities() call
bouwew Apr 17, 2026
a998ae0
Extend Appliance class
bouwew Apr 18, 2026
51f9db4
Correct to appl.id
bouwew Apr 18, 2026
17e6798
Various improvements
bouwew Apr 18, 2026
e9d0d42
fixup: typing_1_b Python code fixed using ruff
Apr 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix module_data
  • Loading branch information
bouwew committed Apr 5, 2026
commit e2ad18510accb387a1ebc5d5013e4ef266c3048f
22 changes: 11 additions & 11 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ def _get_p1_smartmeter_info(self) -> None:
appl.entity_id = self._home_loc_id
if not self.smile.anna_p1:
appl.entity_id = self._gateway_id
appl.firmware = module_data["firmware_version"]
appl.hardware = module_data["hardware_version"]
appl.firmware = module_data.firmware_version
appl.hardware = module_data.hardware_version
appl.location = self._home_loc_id
appl.mac = None
appl.model = module_data["vendor_model"]
appl.model = module_data.vendor_model
appl.model_id = None # don't use model_id for SmartMeter
appl.name = "P1"
appl.pwclass = "smartmeter"
appl.vendor_name = module_data["vendor_name"]
appl.vendor_name = module_data.vendor_name
appl.zigbee_mac = None
Comment on lines 150 to 170

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

This P1 path still uses the pre-model API.

Line 154 still treats module_data as a dict, while Lines 157-170 populate an undefined appl. The first P1/Anna P1 setup will hit TypeError or NameError before the smartmeter entity is created.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugwise/helper.py` around lines 150 - 170, The P1 path still treats
module_data like a dict and sets attributes on an undefined appl, causing
TypeError/NameError; update the block that calls self._get_module_data (with
MODULE_LOCATOR and tag="electricity") to (1) check module_data.content
(attribute) for existence and return early if falsy, and (2) instantiate or
obtain the appliance object before assigning properties (mirror how other device
paths create the appliance instance) and use attribute access on module_data
(e.g., module_data.firmware_version, module_data.vendor_model,
module_data.vendor_name) instead of dict indexing; ensure appl.entity_id chooses
between self._home_loc_id and self._gateway_id using self.smile.anna_p1 as
shown.


# Replace the entity_id of the gateway by the smartmeter location_id
Expand Down Expand Up @@ -232,17 +232,17 @@ def _appliance_info_finder(self, appliance: Appliance) -> Appliance | None:
locator = MODULE_LOCATOR
module_data = self._get_module_data(appliance, locator)
# A plug without module-data is orphaned/ no present
if not module_data["content"]:
if not module_data.content:
return None

print(f"HOI24 {module_data}")
appliance.available = module_data["reachable"]
appliance.firmware_version = module_data["firmware_version"]
appliance.hardware_version = module_data["hardware_version"]
appliance.model_id = module_data["vendor_model"]
appliance.vendor_name = module_data["vendor_name"]
appliance.available = module_data.reachable
appliance.firmware_version = module_data.firmware_version
appliance.hardware_version = module_data.hardware_version
appliance.model_id = module_data.vendor_model
appliance.vendor_name = module_data.vendor_name
appliance.model = check_model(appl.model_id, appl.vendor_name)
appliance.zigbee_mac_address = module_data["zigbee_mac_address"]
appliance.zigbee_mac_address = module_data.zigbee_mac_address
return appliance
Comment thread
coderabbitai[bot] marked this conversation as resolved.
case _: # pragma: no cover
return None
Expand Down