1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Only reflect unavailable state in DSMR when disconnected (#84862)

* Only reflect unavailable state in DSMR when disonnected

* Addressreview comment
This commit is contained in:
Franck Nijhof
2022-12-30 19:08:11 +01:00
committed by GitHub
parent f8fa676ac8
commit 02f64ada2d
2 changed files with 31 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
ENERGY_KILO_WATT_HOUR,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
VOLUME_CUBIC_METERS,
UnitOfPower,
)
@@ -783,6 +784,10 @@ async def test_reconnect(hass, dsmr_connection_fixture):
assert connection_factory.call_count == 1
state = hass.states.get("sensor.electricity_meter_power_consumption")
assert state
assert state.state == STATE_UNKNOWN
# indicate disconnect, release wait lock and allow reconnect to happen
closed.set()
# wait for lock set to resolve