Disable ESPHome assist_in_progress binary sensor (#125802)

This commit is contained in:
Erik Montnemery 2024-09-12 09:07:01 +02:00 committed by GitHub
parent b1a777a95a
commit e89b258970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -74,6 +74,7 @@ class EsphomeAssistInProgressBinarySensor(EsphomeAssistEntity, BinarySensorEntit
"""A binary sensor implementation for ESPHome for use with assist_pipeline."""
entity_description = BinarySensorEntityDescription(
entity_registry_enabled_default=False,
key="assist_in_progress",
translation_key="assist_in_progress",
)

View file

@ -15,12 +15,14 @@ import pytest
from homeassistant.components.esphome import DomainData
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNKNOWN
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from .conftest import MockESPHomeDevice
from tests.common import MockConfigEntry
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_assist_in_progress(
hass: HomeAssistant,
mock_voice_assistant_v1_entry,
@ -44,6 +46,20 @@ async def test_assist_in_progress(
assert state.state == "off"
async def test_assist_in_progress_disabled_by_default(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,
mock_voice_assistant_v1_entry,
) -> None:
"""Test assist in progress binary sensor is added disabled."""
assert not hass.states.get("binary_sensor.test_assist_in_progress")
entity_entry = entity_registry.async_get("binary_sensor.test_assist_in_progress")
assert entity_entry
assert entity_entry.disabled
assert entity_entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
@pytest.mark.parametrize(
"binary_state", [(True, STATE_ON), (False, STATE_OFF), (None, STATE_UNKNOWN)]
)