Skip to content

Commit

Permalink
Default disable voltage sensors in Plugwise (home-assistant#85451)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoMPaTech authored Jan 9, 2023
1 parent 02f1dce commit 60604f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/plugwise/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,23 @@
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="voltage_phase_two",
name="Voltage phase two",
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="voltage_phase_three",
name="Voltage phase three",
device_class=SensorDeviceClass.VOLTAGE,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
SensorEntityDescription(
key="gas_consumed_interval",
Expand Down
20 changes: 12 additions & 8 deletions tests/components/plugwise/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

Expand Down Expand Up @@ -110,17 +111,20 @@ async def test_p1_3ph_dsmr_sensor_entities(
assert state
assert float(state.state) == 2080.0

state = hass.states.get("sensor.p1_voltage_phase_one")
assert state
assert float(state.state) == 233.2
entity_id = "sensor.p1_voltage_phase_one"
state = hass.states.get(entity_id)
assert not state

state = hass.states.get("sensor.p1_voltage_phase_two")
assert state
assert float(state.state) == 234.4
entity_registry = async_get(hass)
entity_registry.async_update_entity(entity_id=entity_id, disabled_by=None)
await hass.async_block_till_done()

state = hass.states.get("sensor.p1_voltage_phase_three")
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) == 234.7
assert float(state.state) == 233.2


async def test_stretch_sensor_entities(
Expand Down

0 comments on commit 60604f7

Please sign in to comment.