Set entity_category for node status sensor (#58434)
parent
fbdd445999
commit
b71773fd1d
|
@ -456,7 +456,7 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
|||
"""Representation of a node status sensor."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_entity_registry_enabled_default = False
|
||||
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
|
||||
|
||||
def __init__(
|
||||
self, config_entry: ConfigEntry, client: ZwaveClient, node: ZwaveNode
|
||||
|
|
|
@ -166,16 +166,9 @@ async def test_node_status_sensor(hass, client, lock_id_lock_as_id150, integrati
|
|||
node = lock_id_lock_as_id150
|
||||
ent_reg = er.async_get(hass)
|
||||
entity_entry = ent_reg.async_get(NODE_STATUS_ENTITY)
|
||||
assert entity_entry.disabled
|
||||
assert entity_entry.disabled_by == er.DISABLED_INTEGRATION
|
||||
updated_entry = ent_reg.async_update_entity(
|
||||
entity_entry.entity_id, **{"disabled_by": None}
|
||||
)
|
||||
|
||||
await hass.config_entries.async_reload(integration.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert not updated_entry.disabled
|
||||
assert not entity_entry.disabled
|
||||
assert entity_entry.entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
||||
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
||||
|
||||
# Test transitions work
|
||||
|
@ -227,16 +220,8 @@ async def test_node_status_sensor_not_ready(
|
|||
assert not node.ready
|
||||
ent_reg = er.async_get(hass)
|
||||
entity_entry = ent_reg.async_get(NODE_STATUS_ENTITY)
|
||||
assert entity_entry.disabled
|
||||
assert entity_entry.disabled_by == er.DISABLED_INTEGRATION
|
||||
updated_entry = ent_reg.async_update_entity(
|
||||
entity_entry.entity_id, **{"disabled_by": None}
|
||||
)
|
||||
|
||||
await hass.config_entries.async_reload(integration.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert not updated_entry.disabled
|
||||
assert not entity_entry.disabled
|
||||
assert hass.states.get(NODE_STATUS_ENTITY)
|
||||
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
||||
|
||||
|
|
Loading…
Reference in New Issue