Skip to content

Commit 036eef2

Browse files
authored
Bump ZHA to 0.0.51 (home-assistant#139383)
* Bump ZHA to 0.0.51 * Fix unit tests not accounting for primary entities
1 parent f3fb7cd commit 036eef2

File tree

7 files changed

+26
-23
lines changed

7 files changed

+26
-23
lines changed

homeassistant/components/zha/entity.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def __init__(self, entity_data: EntityData, *args, **kwargs) -> None:
5959
def name(self) -> str | UndefinedType | None:
6060
"""Return the name of the entity."""
6161
meta = self.entity_data.entity.info_object
62+
if meta.primary:
63+
self._attr_name = None
64+
return super().name
65+
6266
original_name = super().name
6367

6468
if original_name not in (UNDEFINED, None) or meta.fallback_name is None:

homeassistant/components/zha/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"zha",
2222
"universal_silabs_flasher"
2323
],
24-
"requirements": ["zha==0.0.50"],
24+
"requirements": ["zha==0.0.51"],
2525
"usb": [
2626
{
2727
"vid": "10C4",

requirements_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements_test_all.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/components/zha/snapshots/test_diagnostics.ambr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,7 @@
179179
}),
180180
'0x0010': dict({
181181
'attribute': "ZCLAttributeDef(id=0x0010, name='cie_addr', type=<class 'zigpy.types.named.EUI64'>, zcl_type=<DataTypeId.EUI64: 240>, access=<ZCLAttributeAccess.Read|Write: 3>, mandatory=True, is_manufacturer_specific=False)",
182-
'value': list([
183-
50,
184-
79,
185-
50,
186-
2,
187-
0,
188-
141,
189-
21,
190-
0,
191-
]),
182+
'value': None,
192183
}),
193184
'0x0011': dict({
194185
'attribute': "ZCLAttributeDef(id=0x0011, name='zone_id', type=<class 'zigpy.types.basic.uint8_t'>, zcl_type=<DataTypeId.uint8: 32>, access=<ZCLAttributeAccess.Read: 1>, mandatory=True, is_manufacturer_specific=False)",

tests/components/zha/test_sensor.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from .common import send_attributes_report
3131
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
3232

33+
ENTITY_ID_NO_PREFIX = "sensor.fakemanufacturer_fakemodel"
3334
ENTITY_ID_PREFIX = "sensor.fakemanufacturer_fakemodel_{}"
3435

3536

@@ -335,7 +336,7 @@ async def async_test_pi_heating_demand(
335336
"humidity",
336337
async_test_humidity,
337338
1,
338-
None,
339+
{},
339340
None,
340341
STATE_UNKNOWN,
341342
),
@@ -344,7 +345,7 @@ async def async_test_pi_heating_demand(
344345
"temperature",
345346
async_test_temperature,
346347
1,
347-
None,
348+
{},
348349
None,
349350
STATE_UNKNOWN,
350351
),
@@ -353,7 +354,7 @@ async def async_test_pi_heating_demand(
353354
"pressure",
354355
async_test_pressure,
355356
1,
356-
None,
357+
{},
357358
None,
358359
STATE_UNKNOWN,
359360
),
@@ -362,7 +363,7 @@ async def async_test_pi_heating_demand(
362363
"illuminance",
363364
async_test_illuminance,
364365
1,
365-
None,
366+
{},
366367
None,
367368
STATE_UNKNOWN,
368369
),
@@ -492,7 +493,7 @@ async def async_test_pi_heating_demand(
492493
"device_temperature",
493494
async_test_device_temperature,
494495
1,
495-
None,
496+
{},
496497
None,
497498
STATE_UNKNOWN,
498499
),
@@ -501,7 +502,7 @@ async def async_test_pi_heating_demand(
501502
"setpoint_change_source",
502503
async_test_setpoint_change_source,
503504
10,
504-
None,
505+
{},
505506
None,
506507
STATE_UNKNOWN,
507508
),
@@ -510,7 +511,7 @@ async def async_test_pi_heating_demand(
510511
"pi_heating_demand",
511512
async_test_pi_heating_demand,
512513
10,
513-
None,
514+
{},
514515
None,
515516
STATE_UNKNOWN,
516517
),
@@ -558,7 +559,6 @@ async def test_sensor(
558559
gateway.get_or_create_device(zigpy_device)
559560
await gateway.async_device_initialized(zigpy_device)
560561
await hass.async_block_till_done(wait_background_tasks=True)
561-
entity_id = ENTITY_ID_PREFIX.format(entity_suffix)
562562

563563
zigpy_device = zigpy_device_mock(
564564
{
@@ -570,6 +570,11 @@ async def test_sensor(
570570
}
571571
)
572572

573+
if hass.states.get(ENTITY_ID_NO_PREFIX):
574+
entity_id = ENTITY_ID_NO_PREFIX
575+
else:
576+
entity_id = ENTITY_ID_PREFIX.format(entity_suffix)
577+
573578
assert hass.states.get(entity_id).state == initial_sensor_state
574579

575580
# test sensor associated logic

tests/components/zha/test_websocket_api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,11 @@ async def test_list_groupable_devices(
420420
assert entity_reference[ATTR_NAME] is not None
421421
assert entity_reference["entity_id"] is not None
422422

423-
for entity_reference in endpoint["entities"]:
424-
assert entity_reference["original_name"] is not None
423+
if len(endpoint["entities"]) == 1:
424+
assert endpoint["entities"][0]["original_name"] is None
425+
else:
426+
for entity_reference in endpoint["entities"]:
427+
assert entity_reference["original_name"] is not None
425428

426429
# Make sure there are no groupable devices when the device is unavailable
427430
# Make device unavailable

0 commit comments

Comments
 (0)