Set entity_category for node status sensor (#58434)

pull/58445/head^2
Raman Gupta 2021-10-25 17:54:13 -04:00 committed by GitHub
parent fbdd445999
commit b71773fd1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 19 deletions

View File

@ -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

View File

@ -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"