mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Set entity_category for node status sensor (#58434)
This commit is contained in:
parent
fbdd445999
commit
b71773fd1d
@ -456,7 +456,7 @@ class ZWaveNodeStatusSensor(SensorEntity):
|
|||||||
"""Representation of a node status sensor."""
|
"""Representation of a node status sensor."""
|
||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
_attr_entity_registry_enabled_default = False
|
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, config_entry: ConfigEntry, client: ZwaveClient, node: ZwaveNode
|
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
|
node = lock_id_lock_as_id150
|
||||||
ent_reg = er.async_get(hass)
|
ent_reg = er.async_get(hass)
|
||||||
entity_entry = ent_reg.async_get(NODE_STATUS_ENTITY)
|
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)
|
assert not entity_entry.disabled
|
||||||
await hass.async_block_till_done()
|
assert entity_entry.entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
|
||||||
assert not updated_entry.disabled
|
|
||||||
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
||||||
|
|
||||||
# Test transitions work
|
# Test transitions work
|
||||||
@ -227,16 +220,8 @@ async def test_node_status_sensor_not_ready(
|
|||||||
assert not node.ready
|
assert not node.ready
|
||||||
ent_reg = er.async_get(hass)
|
ent_reg = er.async_get(hass)
|
||||||
entity_entry = ent_reg.async_get(NODE_STATUS_ENTITY)
|
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)
|
assert not entity_entry.disabled
|
||||||
await hass.async_block_till_done()
|
|
||||||
|
|
||||||
assert not updated_entry.disabled
|
|
||||||
assert hass.states.get(NODE_STATUS_ENTITY)
|
assert hass.states.get(NODE_STATUS_ENTITY)
|
||||||
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
assert hass.states.get(NODE_STATUS_ENTITY).state == "alive"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user