Skip to content

Commit 555efd6

Browse files
mrrstuxjclsn
authored andcommitted
Filter-out faulty system_mode reports inside multiple reports.
1 parent 278af6f commit 555efd6

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

zhaquirks/bosch/rbsh_trv0_zb_eu.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,30 @@ def handle_cluster_general_request(
389389
hdr, args, dst_addressing=dst_addressing
390390
)
391391

392-
attr = args[0][0]
393-
394392
"""Pass-through reports of all attributes, except for system_mode."""
395-
if attr.attrid != SYSTEM_MODE_ATTR.id:
393+
has_system_mode_report = False
394+
for attr in args.attribute_reports:
395+
if attr.attrid == SYSTEM_MODE_ATTR.id:
396+
has_system_mode_report = True
397+
break
398+
399+
if not has_system_mode_report:
396400
return super().handle_cluster_general_request(
397401
hdr, args, dst_addressing=dst_addressing
398402
)
403+
else:
404+
update_attributes = [
405+
attr
406+
for attr in args.attribute_reports
407+
if attr.attrid != SYSTEM_MODE_ATTR.id
408+
]
409+
if len(update_attributes) > 0:
410+
msg = foundation.GENERAL_COMMANDS[
411+
foundation.GeneralCommand.Report_Attributes
412+
].schema(attribute_reports=update_attributes)
413+
return super().handle_cluster_general_request(
414+
hdr, msg, dst_addressing=dst_addressing
415+
)
399416

400417

401418
class BoschUserInterfaceCluster(CustomCluster, UserInterface):

0 commit comments

Comments
 (0)