Ignore empty status update for mqtt number (#94800)

This commit is contained in:
Jan Bouwhuis 2023-06-20 23:04:01 +02:00 committed by GitHub
parent 3e71b1daa4
commit 4def901ecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -189,6 +189,14 @@ async def test_value_template(
state = hass.states.get("number.test_number")
assert state.state == "10"
# Assert an empty value from a template is ignored
async_fire_mqtt_message(hass, topic, '{"other_val":12}')
await hass.async_block_till_done()
state = hass.states.get("number.test_number")
assert state.state == "10"
async_fire_mqtt_message(hass, topic, '{"val":20.5}')
await hass.async_block_till_done()