mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Disable "last seen" Z-Wave entity by default (#148987)
This commit is contained in:
parent
57c024449c
commit
39d323186f
@ -558,7 +558,7 @@ ENTITY_DESCRIPTION_NODE_STATISTICS_LIST = [
|
||||
key="last_seen",
|
||||
translation_key="last_seen",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
entity_registry_enabled_default=True,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
]
|
||||
|
||||
|
@ -514,8 +514,8 @@ async def test_on_node_added_not_ready(
|
||||
assert len(device.identifiers) == 1
|
||||
|
||||
entities = er.async_entries_for_device(entity_registry, device.id)
|
||||
# the only entities are the node status sensor, last_seen sensor, and ping button
|
||||
assert len(entities) == 3
|
||||
# the only entities are the node status sensor, and ping button
|
||||
assert len(entities) == 2
|
||||
|
||||
|
||||
async def test_existing_node_ready(
|
||||
@ -631,8 +631,8 @@ async def test_existing_node_not_ready(
|
||||
assert len(device.identifiers) == 1
|
||||
|
||||
entities = er.async_entries_for_device(entity_registry, device.id)
|
||||
# the only entities are the node status sensor, last_seen sensor, and ping button
|
||||
assert len(entities) == 3
|
||||
# the only entities are the node status sensor, and ping button
|
||||
assert len(entities) == 2
|
||||
|
||||
|
||||
async def test_existing_node_not_replaced_when_not_ready(
|
||||
|
@ -869,7 +869,7 @@ async def test_statistics_sensors_migration(
|
||||
)
|
||||
|
||||
|
||||
async def test_statistics_sensors_no_last_seen(
|
||||
async def test_statistics_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
zp3111,
|
||||
@ -877,7 +877,7 @@ async def test_statistics_sensors_no_last_seen(
|
||||
integration,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test all statistics sensors but last seen which is enabled by default."""
|
||||
"""Test statistics sensors."""
|
||||
|
||||
for prefix, suffixes in (
|
||||
(CONTROLLER_STATISTICS_ENTITY_PREFIX, CONTROLLER_STATISTICS_SUFFIXES),
|
||||
@ -1029,7 +1029,16 @@ async def test_last_seen_statistics_sensors(
|
||||
entity_id = f"{NODE_STATISTICS_ENTITY_PREFIX}last_seen"
|
||||
entry = entity_registry.async_get(entity_id)
|
||||
assert entry
|
||||
assert not entry.disabled
|
||||
assert entry.disabled
|
||||
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||
assert hass.states.get(entity_id) is None # disabled by default
|
||||
|
||||
entity_registry.async_update_entity(entity_id, disabled_by=None)
|
||||
async_fire_time_changed(
|
||||
hass,
|
||||
dt_util.utcnow() + timedelta(seconds=RELOAD_AFTER_UPDATE_DELAY + 1),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
state = hass.states.get(entity_id)
|
||||
assert state
|
||||
|
Loading…
x
Reference in New Issue
Block a user