mirror of
https://github.com/home-assistant/core
synced 2024-09-28 03:04:04 +02:00
Default disable voltage sensors in Plugwise (#85451)
This commit is contained in:
parent
02f1dce137
commit
60604f7905
@ -268,6 +268,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="voltage_phase_two",
|
key="voltage_phase_two",
|
||||||
@ -275,6 +276,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="voltage_phase_three",
|
key="voltage_phase_three",
|
||||||
@ -282,6 +284,7 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
|
|||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="gas_consumed_interval",
|
key="gas_consumed_interval",
|
||||||
|
@ -4,6 +4,7 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_component import async_update_entity
|
from homeassistant.helpers.entity_component import async_update_entity
|
||||||
|
from homeassistant.helpers.entity_registry import async_get
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
@ -110,18 +111,21 @@ async def test_p1_3ph_dsmr_sensor_entities(
|
|||||||
assert state
|
assert state
|
||||||
assert float(state.state) == 2080.0
|
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")
|
state = hass.states.get("sensor.p1_voltage_phase_one")
|
||||||
assert state
|
assert state
|
||||||
assert float(state.state) == 233.2
|
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(
|
async def test_stretch_sensor_entities(
|
||||||
hass: HomeAssistant, mock_stretch: MagicMock, init_integration: MockConfigEntry
|
hass: HomeAssistant, mock_stretch: MagicMock, init_integration: MockConfigEntry
|
||||||
|
Loading…
Reference in New Issue
Block a user