Fix enumeration of zwave-js device triggers (#71225)

* Fix enumeration of zwave-js device triggers

* Address review comments
This commit is contained in:
Erik Montnemery 2022-05-03 01:46:39 +02:00 committed by GitHub
parent fbc048f07b
commit 4962605613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 10 deletions

View file

@ -266,7 +266,11 @@ async def async_get_triggers(
entity_id = async_get_node_status_sensor_entity_id(
hass, device_id, ent_reg, dev_reg
)
if (entity := ent_reg.async_get(entity_id)) is not None and not entity.disabled:
if (
entity_id
and (entity := ent_reg.async_get(entity_id)) is not None
and not entity.disabled
):
triggers.append(
{**base_trigger, CONF_TYPE: NODE_STATUS, CONF_ENTITY_ID: entity_id}
)