Fix handling of attribute reports in ZHA sensors and binary sensors (#32776)
* Update sensor tests. * Update light tests. * Update binary_sensor tests. * Update cover tests. * Update device tracker tests. * Update fan tests. * Update lock tests. * Update switch tests. * add sensor attr to sensors * add sensor attr to binary sensors * cleanup extra var Co-authored-by: Alexei Chetroi <alexei.chetroi@outlook.com>
This commit is contained in:
1 parent
628f77f8f2
commit
aa972b0005
11 files changed
+77
-104
No files matched your search
@@ -4,7 +4,6 @@ import time
|
||||
|
||||
import pytest
|
||||
import zigpy.zcl.clusters.general as general
|
||||
import zigpy.zcl.foundation as zcl_f
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN, SOURCE_TYPE_ROUTER
|
||||
from homeassistant.components.zha.core.registries import (
|
||||
@@ -17,8 +16,7 @@ from .common import (
|
||||
async_enable_traffic,
|
||||
async_test_rejoin,
|
||||
find_entity_id,
|
||||
make_attribute,
|
||||
make_zcl_header,
|
||||
send_attributes_report,
|
||||
)
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
@@ -66,12 +64,9 @@ async def test_device_tracker(hass, zha_device_joined_restored, zigpy_device_dt)
|
||||
assert hass.states.get(entity_id).state == STATE_NOT_HOME
|
||||
|
||||
# turn state flip
|
||||
attr = make_attribute(0x0020, 23)
|
||||
hdr = make_zcl_header(zcl_f.Command.Report_Attributes)
|
||||
cluster.handle_message(hdr, [[attr]])
|
||||
|
||||
attr = make_attribute(0x0021, 200)
|
||||
cluster.handle_message(hdr, [[attr]])
|
||||
await send_attributes_report(
|
||||
hass, cluster, {0x0000: 0, 0x0020: 23, 0x0021: 200, 0x0001: 2}
|
||||
)
|
||||
|
||||
zigpy_device_dt.last_seen = time.time() + 10
|
||||
next_update = dt_util.utcnow() + timedelta(seconds=30)
|
||||
|
||||
Reference in new issue
Block a user