Add battery sensor for Netatmo climate devices (#60911)

This commit is contained in:
Tobias Sauerwein
2021-12-03 18:33:24 +01:00
committed by GitHub
parent a80447f096
commit cf7a614309
5 changed files with 125 additions and 1 deletions

View File

@@ -233,3 +233,17 @@ async def test_weather_sensor_enabling(
assert len(hass.states.async_all()) > states_before
assert hass.states.get(f"sensor.{name}").state == expected
async def test_climate_battery_sensor(hass, config_entry, netatmo_auth):
"""Test climate device battery sensor."""
with patch("time.time", return_value=TEST_TIME), selected_platforms(
["sensor", "climate"]
):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
prefix = "sensor.livingroom_"
assert hass.states.get(f"{prefix}battery_percent").state == "75"