Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion tests/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ async def test_cluster_handler_quirks_unnecessary_claiming(
# Suppress normal endpoint probing, as this will claim the Opple cluster handler
# already due to it being in the "CLUSTER_HANDLER_ONLY_CLUSTERS" registry.
# We want to test the handler also gets claimed via quirks v2 attributes init.
with patch("zha.application.discovery.EndpointProbe.discover_entities"):
with patch("zha.application.discovery.endpoint_discover_entities"):
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)
assert isinstance(zha_device.device, CustomDeviceV2)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_cluster_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def test_epch_claim_cluster_handlers(cluster_handler) -> None:

@mock.patch("zha.zigbee.endpoint.Endpoint.add_client_cluster_handlers")
@mock.patch(
"zha.application.discovery.ENDPOINT_PROBE.discover_entities",
"zha.application.discovery.endpoint_discover_entities",
mock.MagicMock(),
)
async def test_ep_cluster_handlers_all_cluster_handlers(
Expand Down Expand Up @@ -714,7 +714,7 @@ async def test_ep_cluster_handlers_all_cluster_handlers(

@mock.patch("zha.zigbee.endpoint.Endpoint.add_client_cluster_handlers")
@mock.patch(
"zha.application.discovery.ENDPOINT_PROBE.discover_entities",
"zha.application.discovery.endpoint_discover_entities",
mock.MagicMock(),
)
async def test_cluster_handler_power_config(
Expand Down Expand Up @@ -918,7 +918,7 @@ async def test_zll_device_groups(zha_gateway: Gateway) -> None:


@mock.patch(
"zha.application.discovery.ENDPOINT_PROBE.discover_entities",
"zha.application.discovery.endpoint_discover_entities",
mock.MagicMock(),
)
async def test_cluster_no_ep_attribute(
Expand Down
70 changes: 6 additions & 64 deletions tests/test_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@
zigpy_device_from_device_data,
)
from zha.application import Platform
from zha.application.discovery import ENDPOINT_PROBE, EndpointProbe
from zha.application.gateway import Gateway
from zha.application.helpers import DeviceOverridesConfiguration
from zha.application.platforms import PlatformEntity, binary_sensor, sensor
from zha.application.platforms.number import BaseNumber, NumberMode
from zha.application.registries import SINGLE_INPUT_CLUSTER_DEVICE_CLASS
from zha.zigbee.cluster_handlers import ClusterHandler
from zha.zigbee.endpoint import Endpoint

Expand All @@ -69,14 +67,14 @@
return endpoint.identify


@mock.patch("zha.application.discovery.EndpointProbe.discover_by_device_type")
@mock.patch("zha.application.discovery.EndpointProbe.discover_by_cluster_id")
@mock.patch("zha.application.discovery.endpoint_discover_by_device_type")
@mock.patch("zha.application.discovery.endpoint_discover_by_cluster_id")
def test_discover_entities(m1, m2) -> None:
"""Test discover endpoint class method."""
endpoint = mock.MagicMock()
endpoint.device.is_coordinator = False

for _entity in ENDPOINT_PROBE.discover_entities(endpoint, device_overrides={}):
for _entity in endpoint_discover_entities(endpoint, device_overrides={}):
pass

assert m1.call_count == 1
Expand Down Expand Up @@ -106,13 +104,11 @@
entity_cls = mock.MagicMock()

get_entity_mock = mock.MagicMock(return_value=(entity_cls, mock.sentinel.claimed))
with mock.patch(

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_by_device_type[65535-None-False] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_by_device_type[DeviceType.SMART_PLUG-switch-True] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_by_device_type[DeviceType.ON_OFF_BALLAST-switch-True] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_by_device_type[DeviceType.ON_OFF_LIGHT-light-True] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_by_device_type[65535-None-False] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_by_device_type[DeviceType.SMART_PLUG-switch-True] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_by_device_type[DeviceType.ON_OFF_BALLAST-switch-True] AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 107 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_by_device_type[DeviceType.ON_OFF_LIGHT-light-True] AttributeError: module 'zha.application' has no attribute 'registries'
"zha.application.registries.PLATFORM_ENTITIES.get_entity",
get_entity_mock,
):
entities = list(
ENDPOINT_PROBE.discover_by_device_type(endpoint, device_overrides={})
)
entities = list(endpoint_discover_by_device_type(endpoint, device_overrides={}))

if hit:
assert len(entities) == 1
Expand Down Expand Up @@ -143,13 +139,13 @@

get_entity_mock = mock.MagicMock(return_value=(entity_cls, mock.sentinel.claimed))
with (
mock.patch(

Check failure on line 142 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_by_device_type_override AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 142 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_by_device_type_override AttributeError: module 'zha.application' has no attribute 'registries'
"zha.application.registries.PLATFORM_ENTITIES.get_entity",
get_entity_mock,
),
):
entities = list(
ENDPOINT_PROBE.discover_by_device_type(
endpoint_discover_by_device_type(
endpoint,
device_overrides={
"00:11:22:33:44:55:66:77-1": DeviceOverridesConfiguration(
Expand Down Expand Up @@ -184,11 +180,11 @@
entity_cls = mock.MagicMock()
get_entity_mock = mock.MagicMock(return_value=(entity_cls, mock.sentinel.claimed))
cluster_handler_mock = mock.MagicMock(spec_set=ClusterHandler)
with mock.patch(

Check failure on line 183 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_discover_probe_single_cluster AttributeError: module 'zha.application' has no attribute 'registries'

Check failure on line 183 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_discover_probe_single_cluster AttributeError: module 'zha.application' has no attribute 'registries'
"zha.application.registries.PLATFORM_ENTITIES.get_entity",
get_entity_mock,
):
for _entity in ENDPOINT_PROBE.probe_single_cluster(
for _entity in probe_single_cluster(
Platform.SWITCH, cluster_handler_mock, endpoint
):
pass
Expand All @@ -214,60 +210,6 @@
return cluster_handler


def test_single_input_cluster_device_class_by_cluster_class() -> None:
"""Test SINGLE_INPUT_CLUSTER_DEVICE_CLASS matching by cluster id or class."""

class QuirkedIAS(zigpy.quirks.CustomCluster, zigpy.zcl.clusters.security.IasZone):
"""Quirked IAS Zone cluster."""

class _Analog(zigpy.quirks.CustomCluster, zigpy.zcl.clusters.general.AnalogInput):
pass

door_ch = _ch_mock(zigpy.zcl.clusters.closures.DoorLock)
cover_ch = _ch_mock(zigpy.zcl.clusters.closures.WindowCovering)
multistate_ch = _ch_mock(zigpy.zcl.clusters.general.MultistateInput)
ias_ch = _ch_mock(QuirkedIAS)
analog_ch = _ch_mock(_Analog)

endpoint = mock.MagicMock(spec_set=Endpoint)
endpoint.unclaimed_cluster_handlers.return_value = [
door_ch,
cover_ch,
multistate_ch,
ias_ch,
analog_ch,
]

with (
mock.patch.dict(
SINGLE_INPUT_CLUSTER_DEVICE_CLASS,
{
zigpy.zcl.clusters.closures.DoorLock.cluster_id: Platform.LOCK,
zigpy.zcl.clusters.closures.WindowCovering.cluster_id: Platform.COVER,
zigpy.zcl.clusters.general.AnalogInput.cluster_id: Platform.SENSOR,
zigpy.zcl.clusters.general.MultistateInput.cluster_id: Platform.SENSOR,
zigpy.zcl.clusters.security.IasZone.cluster_id: Platform.BINARY_SENSOR,
},
clear=True,
),
mock.patch(
"zha.application.discovery.EndpointProbe.probe_single_cluster",
new=mock.MagicMock(),
) as probe_mock,
):
for _entity in EndpointProbe().discover_by_cluster_id(endpoint):
pass

assert probe_mock.call_count == len(endpoint.unclaimed_cluster_handlers())
assert [m for m in probe_mock.mock_calls if m != call().__iter__()] == [
call(Platform.LOCK, door_ch, endpoint),
call(Platform.COVER, cover_ch, endpoint),
call(Platform.SENSOR, multistate_ch, endpoint),
call(Platform.BINARY_SENSOR, ias_ch, endpoint),
call(Platform.SENSOR, analog_ch, endpoint),
]


@pytest.mark.parametrize("override", [None, "switch"])
async def test_device_override(
zha_gateway: Gateway,
Expand Down Expand Up @@ -302,7 +244,7 @@
await zha_gateway.async_block_till_done()
zha_device = zha_gateway.get_device(zigpy_device.ieee)

get_entity(zha_device, platform=Platform.SWITCH if override else Platform.LIGHT)

Check failure on line 247 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_device_override[switch] KeyError: "No <class 'zha.application.platforms.BaseEntity'> entity found for platform <Platform.SWITCH: 'switch'> on device <Device model='model' manuf='manufacturer' nwk=0xB79C ieee=00:11:22:33:44:55:66:77 is_initialized=False> - quirk_applied: False - quirk_or_device_class: zigpy.device.Device - exposes_features: set(): {(<Platform.LIGHT: 'light'>, '00:11:22:33:44:55:66:77-1'): <zha.application.platforms.light.Light object at 0x7f4ccb3f6ad0>, (<Platform.BUTTON: 'button'>, '00:11:22:33:44:55:66:77-1-3'): <zha.application.platforms.button.IdentifyButton object at 0x7f4cd02d50f0>, (<Platform.SENSOR: 'sensor'>, '00:11:22:33:44:55:66:77-1-0-rssi'): <zha.application.platforms.sensor.RSSISensor object at 0x7f4ccb931c70>, (<Platform.SENSOR: 'sensor'>, '00:11:22:33:44:55:66:77-1-0-lqi'): <zha.application.platforms.sensor.LQISensor object at 0x7f4ccb932300>, (<Platform.UPDATE: 'update'>, '00:11:22:33:44:55:66:77-1-25-firmware_update'): <zha.application.platforms.update.FirmwareUpdateEntity object at 0x7f4ccaf38e50>}"

Check failure on line 247 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_device_override[switch] KeyError: "No <class 'zha.application.platforms.BaseEntity'> entity found for platform <Platform.SWITCH: 'switch'> on device <Device model='model' manuf='manufacturer' nwk=0xB79C ieee=00:11:22:33:44:55:66:77 is_initialized=False> - quirk_applied: False - quirk_or_device_class: zigpy.device.Device - exposes_features: set(): {(<Platform.LIGHT: 'light'>, '00:11:22:33:44:55:66:77-1'): <zha.application.platforms.light.Light object at 0x7f9f532b9340>, (<Platform.BUTTON: 'button'>, '00:11:22:33:44:55:66:77-1-3'): <zha.application.platforms.button.IdentifyButton object at 0x7f9f532b8770>, (<Platform.SENSOR: 'sensor'>, '00:11:22:33:44:55:66:77-1-0-rssi'): <zha.application.platforms.sensor.RSSISensor object at 0x7f9f532b8680>, (<Platform.SENSOR: 'sensor'>, '00:11:22:33:44:55:66:77-1-0-lqi'): <zha.application.platforms.sensor.LQISensor object at 0x7f9f532b86e0>, (<Platform.UPDATE: 'update'>, '00:11:22:33:44:55:66:77-1-25-firmware_update'): <zha.application.platforms.update.FirmwareUpdateEntity object at 0x7f9f532b85f0>}"


async def test_quirks_v2_entity_discovery(
Expand Down Expand Up @@ -825,7 +767,7 @@
f"Duplicate unique_id {unique_id} found in entities: {entities}"
)
else:
warnings.warn(

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f440952dd90>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.switch.Switch object at 0x7f4406e54670>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-6-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408fa2030>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-6-6': <zha.application.platforms.switch.Switch object at 0x7f4406e54bb0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408f03360>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.switch.Switch object at 0x7f4406e57150>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-5-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408fa2e00>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-5-6': <zha.application.platforms.switch.Switch object at 0x7f4406e54e50>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408f01350>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.switch.Switch object at 0x7f4406e544b0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f440952dd90>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.switch.Switch object at 0x7f4406e54670>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f440a19b890>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.switch.Switch object at 0x7f4406e56eb0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408f03360>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.switch.Switch object at 0x7f4406e57150>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f4408f01350>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.switch.Switch object at 0x7f4406e544b0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f440a19b890>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.switch.Switch object at 0x7f4406e56eb0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-6-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21c8e60>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-6-6': <zha.application.platforms.switch.Switch object at 0x7f23e21cb680>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21c95b0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c94f0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-5-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21c92b0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-5-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c91f0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21ca750>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c8980>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21c95b0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-4-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c94f0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21ca750>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-3-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c8980>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21cacc0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.switch.Switch object at 0x7f23e21ca9f0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21cacc0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-2-6': <zha.application.platforms.switch.Switch object at 0x7f23e21ca9f0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21ca0f0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c89b0>}

Check warning on line 770 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

Unique IDs are unique only with platform prefix: {'binary_sensor.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.binary_sensor.Opening object at 0x7f23e21ca0f0>, 'switch.ab:cd:ef:12:1a:bc:2b:a0-1-6': <zha.application.platforms.switch.Switch object at 0x7f23e21c89b0>}
f"Unique IDs are unique only with platform prefix: {dict(zip(prefixed_unique_ids, entities))}"
)

Expand All @@ -848,7 +790,7 @@
loaded_device_data = json.loads(
json.dumps(zha_device.get_diagnostics_json(), cls=ZhaJsonEncoder)
)
assert loaded_device_data == device_data

Check failure on line 793 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.13.3

test_devices_from_files[frient-a-s-kepzb-110.json] AssertionError: assert {'active_coor...': 260}}, ...} == {'active_coor...': 260}}, ...} Omitting 24 identical items, use -vv to show Differing items: {'zha_lib_entities': {'binary_sensor': [{'info_object': {'attribute_name': 'zone_status', 'available': True, 'class_na...ailable': True, 'class_name': 'FirmwareUpdateEntity', 'in_progress': False, 'installed_version': '0x00020005', ...}}]}} != {'zha_lib_entities': {'alarm_control_panel': [{'info_object': {'available': True, 'class_name': 'AlarmControlPanel', '..., ...}, 'state': {'available': True, 'battery_quantity': 4, 'battery_size': 'AA', 'battery_voltage': 5.3, ...}}], ...}} Full diff: { 'active_coordinator': False, 'available': True, 'device_type': 'EndDevice', 'endpoints': { '1': { 'device_type': { 'id': 1, 'name': 'unknown', }, 'in_clusters': [ { 'attributes': [], 'cluster_id': '0x0005', 'endpoint_attribute': 'scenes', }, { 'attributes': [], 'cluster_id': '0x0006', 'endpoint_attribute': 'on_off', }, ], 'out_clusters': [], 'profile_id': 49353, }, '44': { 'device_type': { 'id': 1025, 'name': 'IAS_ANCILLARY_CONTROL', }, 'in_clusters': [ { 'attributes': [ { 'id': '0x0004', 'name': 'manufacturer', 'value': 'frient A/S', 'zcl_type': 'string', }, { 'id': '0x0005', 'name': 'model', 'value': 'KEPZB-110', 'zcl_type': 'string', }, ], 'cluster_id': '0x0000', 'endpoint_attribute': 'basic', }, { 'attributes': [ { 'id': '0x003e', 'name': 'battery_alarm_state', 'value': 0, 'zcl_type': 'map32', }, { 'id': '0x0021', 'name': 'battery_percentage_remaining', 'value': 130, 'zcl_type': 'uint8', }, { 'id': '0x0033', 'name': 'battery_quantity', 'value': 4, 'zcl_type': 'uint8', }, { 'id': '0x0031', 'name': 'battery_size', 'value': 3, 'zcl_type': 'enum8', }, { 'id': '0x0020', 'name': 'battery_voltage', 'value': 53, 'zcl_type': 'uint8', }, ], 'cluster_id': '0x0001', 'endpoint_attribute': 'power', }, { 'attributes': [], 'cl

Check failure on line 793 in tests/test_discover.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12.10

test_devices_from_files[frient-a-s-kepzb-110.json] AssertionError: assert {'active_coor...': 260}}, ...} == {'active_coor...': 260}}, ...} Omitting 24 identical items, use -vv to show Differing items: {'zha_lib_entities': {'binary_sensor': [{'info_object': {'attribute_name': 'zone_status', 'available': True, 'class_na...ailable': True, 'class_name': 'FirmwareUpdateEntity', 'in_progress': False, 'installed_version': '0x00020005', ...}}]}} != {'zha_lib_entities': {'alarm_control_panel': [{'info_object': {'available': True, 'class_name': 'AlarmControlPanel', '..., ...}, 'state': {'available': True, 'battery_quantity': 4, 'battery_size': 'AA', 'battery_voltage': 5.3, ...}}], ...}} Full diff: { 'active_coordinator': False, 'available': True, 'device_type': 'EndDevice', 'endpoints': { '1': { 'device_type': { 'id': 1, 'name': 'unknown', }, 'in_clusters': [ { 'attributes': [], 'cluster_id': '0x0005', 'endpoint_attribute': 'scenes', }, { 'attributes': [], 'cluster_id': '0x0006', 'endpoint_attribute': 'on_off', }, ], 'out_clusters': [], 'profile_id': 49353, }, '44': { 'device_type': { 'id': 1025, 'name': 'IAS_ANCILLARY_CONTROL', }, 'in_clusters': [ { 'attributes': [ { 'id': '0x0004', 'name': 'manufacturer', 'value': 'frient A/S', 'zcl_type': 'string', }, { 'id': '0x0005', 'name': 'model', 'value': 'KEPZB-110', 'zcl_type': 'string', }, ], 'cluster_id': '0x0000', 'endpoint_attribute': 'basic', }, { 'attributes': [ { 'id': '0x003e', 'name': 'battery_alarm_state', 'value': 0, 'zcl_type': 'map32', }, { 'id': '0x0021', 'name': 'battery_percentage_remaining', 'value': 130, 'zcl_type': 'uint8', }, { 'id': '0x0033', 'name': 'battery_quantity', 'value': 4, 'zcl_type': 'uint8', }, { 'id': '0x0031', 'name': 'battery_size', 'value': 3, 'zcl_type': 'enum8', }, { 'id': '0x0020', 'name': 'battery_voltage', 'value': 53, 'zcl_type': 'uint8', }, ], 'cluster_id': '0x0001', 'endpoint_attribute': 'power', }, { 'attributes': [], 'cl

# Assert identify called on join for devices that support it
cluster_identify = _get_identify_cluster(zha_device.device)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ async def test_cluster_handler_quirks_attribute_reporting(zha_gateway: Gateway)
# Suppress normal endpoint probing, as this will claim the Opple cluster handler
# already due to it being in the "CLUSTER_HANDLER_ONLY_CLUSTERS" registry.
# We want to test the handler also gets claimed via quirks v2 reporting config.
with patch("zha.application.discovery.EndpointProbe.discover_entities"):
with patch("zha.application.discovery.endpoint_discover_entities"):
zha_device, cluster = await zigpy_device_aqara_sensor_v2_mock(zha_gateway)
assert isinstance(zha_device.device, CustomDeviceV2)

Expand Down Expand Up @@ -1687,7 +1687,7 @@ async def test_cluster_handler_quirks_attribute_reading(zha_gateway: Gateway) ->
# Suppress normal endpoint probing, as this will claim the Opple cluster handler
# already due to it being in the "CLUSTER_HANDLER_ONLY_CLUSTERS" registry.
# We want to test the handler also gets claimed via quirks v2 attributes init.
with patch("zha.application.discovery.EndpointProbe.discover_entities"):
with patch("zha.application.discovery.endpoint_discover_entities"):
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)
assert isinstance(zha_device.device, CustomDeviceV2)

Expand Down
Loading
Loading