Integration Sensor Initial State (#55875)
* initial state is UNAVAILABLE * update tests
This commit is contained in:
parent
789f21c427
commit
1ca9deb520
2 changed files with 11 additions and 7 deletions
|
@ -81,7 +81,6 @@ async def test_restore_state(hass: HomeAssistant) -> None:
|
|||
"platform": "integration",
|
||||
"name": "integration",
|
||||
"source": "sensor.power",
|
||||
"unit": ENERGY_KILO_WATT_HOUR,
|
||||
"round": 2,
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +115,6 @@ async def test_restore_state_failed(hass: HomeAssistant) -> None:
|
|||
"platform": "integration",
|
||||
"name": "integration",
|
||||
"source": "sensor.power",
|
||||
"unit": ENERGY_KILO_WATT_HOUR,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,9 +123,10 @@ async def test_restore_state_failed(hass: HomeAssistant) -> None:
|
|||
|
||||
state = hass.states.get("sensor.integration")
|
||||
assert state
|
||||
assert state.state == "0"
|
||||
assert state.attributes.get("unit_of_measurement") == ENERGY_KILO_WATT_HOUR
|
||||
assert state.state == "unavailable"
|
||||
assert state.attributes.get("unit_of_measurement") is None
|
||||
assert state.attributes.get("state_class") == STATE_CLASS_TOTAL
|
||||
|
||||
assert "device_class" not in state.attributes
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue