Skip to content

Commit

Permalink
Add backwards compatible shim in zha_event (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey authored Aug 22, 2024
1 parent 409b580 commit c516144
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_cluster_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,12 @@ async def test_zha_send_event_from_quirk(
assert on_off_ch.emit_zha_event.mock_calls == [
call(
"attribute_updated",
{"attribute_id": 0, "attribute_name": "on_off", "attribute_value": True},
{
"attribute_id": 0,
"attribute_name": "on_off",
"attribute_value": True,
"value": True,
},
)
]

Expand All @@ -1381,6 +1386,7 @@ async def test_zha_send_event_from_quirk(
"attribute_id": 0x25,
"attribute_name": "Unknown",
"attribute_value": "Bar",
"value": "Bar",
},
)
]
Expand Down
2 changes: 2 additions & 0 deletions zha/zigbee/cluster_handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
REPORT_CONFIG_ATTR_PER_REQ,
SIGNAL_ATTR_UPDATED,
UNIQUE_ID,
VALUE,
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -711,6 +712,7 @@ def attribute_updated(self, attrid: int, value: Any, timestamp: Any) -> None:
ATTRIBUTE_ID: attrid,
ATTRIBUTE_NAME: attr_name,
ATTRIBUTE_VALUE: value,
VALUE: value,
},
)

Expand Down
1 change: 1 addition & 0 deletions zha/zigbee/cluster_handlers/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@
SIGNAL_SET_LEVEL: Final[str] = "set_level"
SIGNAL_STATE_ATTR: Final[str] = "update_state_attribute"
UNKNOWN: Final[str] = "unknown"
VALUE: Final[str] = "value"

0 comments on commit c516144

Please sign in to comment.