Default disable voltage sensors in Plugwise (#85451)

This commit is contained in:
Tom 2023-01-09 12:09:32 +01:00 committed by GitHub
parent 02f1dce137
commit 60604f7905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -268,6 +268,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="voltage_phase_two",
@ -275,6 +276,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="voltage_phase_three",
@ -282,6 +284,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="gas_consumed_interval",

View File

@ -4,6 +4,7 @@ from unittest.mock import MagicMock
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_component import async_update_entity
from homeassistant.helpers.entity_registry import async_get
from tests.common import MockConfigEntry
@ -110,18 +111,21 @@ async def test_p1_3ph_dsmr_sensor_entities(
assert state
assert float(state.state) == 2080.0
entity_id = "sensor.p1_voltage_phase_one"
state = hass.states.get(entity_id)
assert not state
entity_registry = async_get(hass)
entity_registry.async_update_entity(entity_id=entity_id, disabled_by=None)
await hass.async_block_till_done()
await hass.config_entries.async_reload(init_integration.entry_id)
await hass.async_block_till_done()
state = hass.states.get("sensor.p1_voltage_phase_one")
assert state
assert float(state.state) == 233.2
state = hass.states.get("sensor.p1_voltage_phase_two")
assert state
assert float(state.state) == 234.4
state = hass.states.get("sensor.p1_voltage_phase_three")
assert state
assert float(state.state) == 234.7
async def test_stretch_sensor_entities(
hass: HomeAssistant, mock_stretch: MagicMock, init_integration: MockConfigEntry