Bump ZHA to 0.0.51 (#139383)

* Bump ZHA to 0.0.51

* Fix unit tests not accounting for primary entities
This commit is contained in:
puddly 2025-02-26 15:22:08 -05:00 committed by GitHub
parent f3fb7cd8e8
commit 036eef2b6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 26 additions and 23 deletions

View File

@ -59,6 +59,10 @@ class ZHAEntity(LogMixin, RestoreEntity, Entity):
def name(self) -> str | UndefinedType | None: def name(self) -> str | UndefinedType | None:
"""Return the name of the entity.""" """Return the name of the entity."""
meta = self.entity_data.entity.info_object meta = self.entity_data.entity.info_object
if meta.primary:
self._attr_name = None
return super().name
original_name = super().name original_name = super().name
if original_name not in (UNDEFINED, None) or meta.fallback_name is None: if original_name not in (UNDEFINED, None) or meta.fallback_name is None:

View File

@ -21,7 +21,7 @@
"zha", "zha",
"universal_silabs_flasher" "universal_silabs_flasher"
], ],
"requirements": ["zha==0.0.50"], "requirements": ["zha==0.0.51"],
"usb": [ "usb": [
{ {
"vid": "10C4", "vid": "10C4",

2
requirements_all.txt generated
View File

@ -3149,7 +3149,7 @@ zeroconf==0.145.1
zeversolar==0.3.2 zeversolar==0.3.2
# homeassistant.components.zha # homeassistant.components.zha
zha==0.0.50 zha==0.0.51
# homeassistant.components.zhong_hong # homeassistant.components.zhong_hong
zhong-hong-hvac==1.0.13 zhong-hong-hvac==1.0.13

View File

@ -2538,7 +2538,7 @@ zeroconf==0.145.1
zeversolar==0.3.2 zeversolar==0.3.2
# homeassistant.components.zha # homeassistant.components.zha
zha==0.0.50 zha==0.0.51
# homeassistant.components.zwave_js # homeassistant.components.zwave_js
zwave-js-server-python==0.60.1 zwave-js-server-python==0.60.1

View File

@ -179,16 +179,7 @@
}), }),
'0x0010': dict({ '0x0010': dict({
'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)", '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)",
'value': list([ 'value': None,
50,
79,
50,
2,
0,
141,
21,
0,
]),
}), }),
'0x0011': dict({ '0x0011': dict({
'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)", '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)",

View File

@ -30,6 +30,7 @@ from homeassistant.core import HomeAssistant
from .common import send_attributes_report from .common import send_attributes_report
from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE from .conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
ENTITY_ID_NO_PREFIX = "sensor.fakemanufacturer_fakemodel"
ENTITY_ID_PREFIX = "sensor.fakemanufacturer_fakemodel_{}" ENTITY_ID_PREFIX = "sensor.fakemanufacturer_fakemodel_{}"
@ -335,7 +336,7 @@ async def async_test_pi_heating_demand(
"humidity", "humidity",
async_test_humidity, async_test_humidity,
1, 1,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -344,7 +345,7 @@ async def async_test_pi_heating_demand(
"temperature", "temperature",
async_test_temperature, async_test_temperature,
1, 1,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -353,7 +354,7 @@ async def async_test_pi_heating_demand(
"pressure", "pressure",
async_test_pressure, async_test_pressure,
1, 1,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -362,7 +363,7 @@ async def async_test_pi_heating_demand(
"illuminance", "illuminance",
async_test_illuminance, async_test_illuminance,
1, 1,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -492,7 +493,7 @@ async def async_test_pi_heating_demand(
"device_temperature", "device_temperature",
async_test_device_temperature, async_test_device_temperature,
1, 1,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -501,7 +502,7 @@ async def async_test_pi_heating_demand(
"setpoint_change_source", "setpoint_change_source",
async_test_setpoint_change_source, async_test_setpoint_change_source,
10, 10,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -510,7 +511,7 @@ async def async_test_pi_heating_demand(
"pi_heating_demand", "pi_heating_demand",
async_test_pi_heating_demand, async_test_pi_heating_demand,
10, 10,
None, {},
None, None,
STATE_UNKNOWN, STATE_UNKNOWN,
), ),
@ -558,7 +559,6 @@ async def test_sensor(
gateway.get_or_create_device(zigpy_device) gateway.get_or_create_device(zigpy_device)
await gateway.async_device_initialized(zigpy_device) await gateway.async_device_initialized(zigpy_device)
await hass.async_block_till_done(wait_background_tasks=True) await hass.async_block_till_done(wait_background_tasks=True)
entity_id = ENTITY_ID_PREFIX.format(entity_suffix)
zigpy_device = zigpy_device_mock( zigpy_device = zigpy_device_mock(
{ {
@ -570,6 +570,11 @@ async def test_sensor(
} }
) )
if hass.states.get(ENTITY_ID_NO_PREFIX):
entity_id = ENTITY_ID_NO_PREFIX
else:
entity_id = ENTITY_ID_PREFIX.format(entity_suffix)
assert hass.states.get(entity_id).state == initial_sensor_state assert hass.states.get(entity_id).state == initial_sensor_state
# test sensor associated logic # test sensor associated logic

View File

@ -420,8 +420,11 @@ async def test_list_groupable_devices(
assert entity_reference[ATTR_NAME] is not None assert entity_reference[ATTR_NAME] is not None
assert entity_reference["entity_id"] is not None assert entity_reference["entity_id"] is not None
for entity_reference in endpoint["entities"]: if len(endpoint["entities"]) == 1:
assert entity_reference["original_name"] is not None assert endpoint["entities"][0]["original_name"] is None
else:
for entity_reference in endpoint["entities"]:
assert entity_reference["original_name"] is not None
# Make sure there are no groupable devices when the device is unavailable # Make sure there are no groupable devices when the device is unavailable
# Make device unavailable # Make device unavailable