MQTT Unknown States

Hi All,

I’m using a custom python web scraper to pass data via MQTT to home assistant. The web scraper works well however after home assistant restarts, the sensor states show “Unknown”. The python script runs every hour as the data is not changing more frequently than this. This means there are times when a full hour has to go by before the sensor state is updated from the “Unknown” state.

Is it possible to set the sensor state to the prior state if the state changes to “Unknown”?

Thanks!

Unkown States:
image

Expected States:
image

Send the messages as retained messages. So HA will pick them up when HA restarts.

1 Like

This was it, thank you!