Fix unreachable Netatmo sensor returning false values (#105954)

* Fix unreachable sensor returning false values

* Clean up unnecessary code
This commit is contained in:
Tobias Sauerwein
2023-12-18 13:57:34 +01:00
committed by GitHub
parent 94d22c936e
commit 57a6effd70
7 changed files with 36 additions and 28 deletions

View File

@@ -10,8 +10,8 @@ from homeassistant.helpers import entity_registry as er
from .common import TEST_TIME, selected_platforms
async def test_weather_sensor(hass: HomeAssistant, config_entry, netatmo_auth) -> None:
"""Test weather sensor setup."""
async def test_indoor_sensor(hass: HomeAssistant, config_entry, netatmo_auth) -> None:
"""Test indoor sensor setup."""
with patch("time.time", return_value=TEST_TIME), selected_platforms(["sensor"]):
assert await hass.config_entries.async_setup(config_entry.entry_id)
@@ -25,6 +25,18 @@ async def test_weather_sensor(hass: HomeAssistant, config_entry, netatmo_auth) -
assert hass.states.get(f"{prefix}pressure").state == "1014.5"
async def test_weather_sensor(hass: HomeAssistant, config_entry, netatmo_auth) -> None:
"""Test weather sensor unreachable."""
with patch("time.time", return_value=TEST_TIME), selected_platforms(["sensor"]):
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
prefix = "sensor.villa_outdoor_"
assert hass.states.get(f"{prefix}temperature").state == "unavailable"
async def test_public_weather_sensor(
hass: HomeAssistant, config_entry, netatmo_auth
) -> None: