I have a couple of MQTT sensors that that the MQTT value may only change once a week and im using templating to give me a difference in days.
The issue is HA is not recalculating. I guess its because there’s no new MQTT message being published?
Is there a sensible way of forcing HA to recalculate days? The only workaround can think of is to grab the MQTT data and publish it again but feel like I may be missing something simpler.
Wouldn’t it perform the calculation only when it receives a message published to backup/sensor/janet? If the message arrives once a week, the calculation will only happen once a week.
Or are you saying it doesn’t perform the calculation even when it receives a new message?
Yup! Effectively, the sensor’s value won’t change until the receipt of the next payload (a week later; or upon rebooting but hopefully that’s infrequent and not a requirement of daily operations).
Update in case anyone else trips over this post.
I have worked out the best way (for me anyway) was a Node Red flow to read the sensor attributes and use them to publish a new MQTT message. This is scheduled to run every 6 hours