Disable Wyoming assist_in_progress binary sensor (#125806)

This commit is contained in:
Erik Montnemery 2024-09-12 20:33:35 +02:00 committed by GitHub
parent 57e1709782
commit 56031b2e1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 3 deletions

View file

@ -37,6 +37,7 @@ class WyomingSatelliteAssistInProgress(WyomingSatelliteEntity, BinarySensorEntit
"""Entity to represent Assist is in progress for satellite."""
entity_description = BinarySensorEntityDescription(
entity_registry_enabled_default=False,
key="assist_in_progress",
translation_key="assist_in_progress",
)

View file

@ -1,13 +1,17 @@
"""Test Wyoming binary sensor devices."""
import pytest
from homeassistant.components.wyoming.devices import SatelliteDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import reload_satellite
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_assist_in_progress(
hass: HomeAssistant,
satellite_config_entry: ConfigEntry,
@ -36,3 +40,19 @@ async def test_assist_in_progress(
assert state is not None
assert state.state == STATE_OFF
assert not satellite_device.is_active
async def test_assist_in_progress_disabled_by_default(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
satellite_device: SatelliteDevice,
) -> None:
"""Test assist in progress binary sensor is added disabled."""
assist_in_progress_id = satellite_device.get_assist_in_progress_entity_id(hass)
assert assist_in_progress_id
assert not hass.states.get(assist_in_progress_id)
entity_entry = entity_registry.async_get(assist_in_progress_id)
assert entity_entry
assert entity_entry.disabled
assert entity_entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION

View file

@ -32,8 +32,8 @@ async def test_device_registry_info(
assist_in_progress_id = satellite_device.get_assist_in_progress_entity_id(hass)
assert assist_in_progress_id
assist_in_progress_state = hass.states.get(assist_in_progress_id)
assert assist_in_progress_state is not None
assert assist_in_progress_state.state == STATE_OFF
# assist_in_progress binary sensor is disabled
assert assist_in_progress_state is None
muted_id = satellite_device.get_muted_entity_id(hass)
assert muted_id
@ -58,7 +58,8 @@ async def test_remove_device_registry_entry(
# Check associated entities
assist_in_progress_id = satellite_device.get_assist_in_progress_entity_id(hass)
assert assist_in_progress_id
assert hass.states.get(assist_in_progress_id) is not None
# assist_in_progress binary sensor is disabled
assert hass.states.get(assist_in_progress_id) is None
muted_id = satellite_device.get_muted_entity_id(hass)
assert muted_id