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

Reject nan, inf from generic_thermostat sensor (#48771)

This commit is contained in:
Erik Montnemery
2021-04-07 18:00:42 +02:00
committed by GitHub
parent f2ef9e7505
commit 61b38baf2e
2 changed files with 16 additions and 3 deletions

View File

@@ -331,9 +331,18 @@ async def test_sensor_bad_value(hass, setup_comp_2):
_setup_sensor(hass, None)
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert temp == state.attributes.get("current_temperature")
assert state.attributes.get("current_temperature") == temp
_setup_sensor(hass, "inf")
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert state.attributes.get("current_temperature") == temp
_setup_sensor(hass, "nan")
await hass.async_block_till_done()
state = hass.states.get(ENTITY)
assert state.attributes.get("current_temperature") == temp
async def test_sensor_unknown(hass):