Disable voip call_in_progress binary sensor (#125812)

pull/125852/head
Erik Montnemery 2024-09-12 20:34:11 +02:00 committed by GitHub
parent 56031b2e1a
commit 662a30ffaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View File

@ -42,6 +42,7 @@ class VoIPCallInProgress(VoIPEntity, BinarySensorEntity):
"""Entity to represent voip call is in progress."""
entity_description = BinarySensorEntityDescription(
entity_registry_enabled_default=False,
key="call_in_progress",
translation_key="call_in_progress",
)

View File

@ -1,10 +1,14 @@
"""Test VoIP binary sensor devices."""
import pytest
from homeassistant.components.voip.devices import VoIPDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_call_in_progress(
hass: HomeAssistant,
config_entry: ConfigEntry,
@ -24,3 +28,20 @@ async def test_call_in_progress(
state = hass.states.get("binary_sensor.192_168_1_210_call_in_progress")
assert state.state == "off"
@pytest.mark.usefixtures("voip_device")
async def test_assist_in_progress_disabled_by_default(
hass: HomeAssistant,
config_entry: ConfigEntry,
entity_registry: er.EntityRegistry,
) -> None:
"""Test assist in progress binary sensor is added disabled."""
assert not hass.states.get("binary_sensor.192_168_1_210_call_in_progress")
entity_entry = entity_registry.async_get(
"binary_sensor.192_168_1_210_call_in_progress"
)
assert entity_entry
assert entity_entry.disabled
assert entity_entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION