Skip to content

Commit 2daf9c0

Browse files
committed
Ad null-modules when required
1 parent 01afbde commit 2daf9c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

plugwise/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def connect(self) -> Version:
124124
result_dict = dict(xmltodict.parse(result_str, attr_prefix=""))
125125
for key in ["ame_regulation", "template"]:
126126
result_dict["domain_objects"].pop(key, None)
127-
modules: dict[str, dict[str, str]] = {}
127+
modules:dict[str, dict[str, str]] = {}
128128
for module in result_dict["domain_objects"]["module"]:
129129
link_id: str | None = None
130130
if module["services"] is not None:
@@ -148,12 +148,21 @@ async def connect(self) -> Version:
148148
}
149149

150150
for appliance in result_dict["domain_objects"]["appliance"]:
151+
module_set = False
151152
for module in modules:
152153
for log in appliance["logs"]["point_log"]:
153154
for _, item in log.items():
154155
if isinstance(item, dict) and "id" in item:
155156
if item["id"] == module:
156157
appliance["module"] = modules[module]
158+
module_set = True
159+
if not module_set:
160+
appliance["module"] = {
161+
"firmware_version": None,
162+
"hardware_version": None,
163+
"vendor_model": None,
164+
"vendor_name": None,
165+
}
157166

158167
result_dict["domain_objects"].pop("module")
159168
LOGGER.debug("HOI result_dict: %s", json.dumps(result_dict, indent=4))

0 commit comments

Comments
 (0)