This doesn’t seem to have any effect on the sensor in my Home Assistant view - it still shows “7 minutes ago”. Now, the temperature might be the same as it was seven minutes ago. But I would have expected it to say no more than “20 seconds ago”.
I have a couple of temperature and humidity sensors integrated via MQTT, and experience a similar behaviour. I appears that HA does not record a change if the new value is the same as the previous value, hence HA won’t update that timestamp.
Ah, that’s interesting. I guess I need to do some tests of different scan_interval values and seeing how Home Assistant reacts to rapidly changing temperature.
In the sensor configuration, try adding “force_update: true”. This should force a republish even if the data has not changed. I have found this useful so that I can see a regular “heartbeat” of messages and spot a problem if they go missing.
OK, to clarify, I dont use scan_interval but rather use force_update. I then make sure that my mqtt device firmware is configured to republish on a regular basis i.e. 20 seconds. This gives me a regular “heartbeat” of mqtt messages updating HA regardless of whether the state value has changed or not. So this is a different approach.
For reference, in the docs:
force_update - If True, a state change will be triggered anytime the state property is updated, not just when the value changes
So the device state is updated every time a new mqtt message is generated regardless of whether the value has changed or not. But this is only useful if your device keeps publishing mqtt messages on a regular basis.
What mqqt client are you using for this device? I am using Sonoff-Tasmota on a lot of my devices and you can set the device to republish tele messages every, say, 20 seconds. This is on the Configuration Logging menu item but other software should also let you set this up in different ways.
If you are using mosquitto as the mqtt broker in HA then you can check the message stream to see if the device is republishing regularly using something like:
The option I required in the Sonoff-Tasmota firmware (v5.4.0) was Configuration > Configure Logging > Telemetric period (300), which I changed from the default value of 300 to 20 seconds.
My sensors now update in Home Assistant as expected.
Can someone assist me with this please.
I am running HassOS on a Raspi4, so I have installed the standard mosquitto mqtt broker.
I too would like to auto refresh the data even if it doesnt change, but mosquitto is self configuring - which I like, but I want one of the sensors to auto update (force_update) more often.
I have the correct settings in my tasmota device and its updating every thirty seconds.
What would I have to enter into a yaml file to get this to happen?
Any help appreciated.
Rob
Forget it. Having a moment!
For those unsure about it as I was, just go ahead and add a manual mqtt entry into your configuration file for the sensor that may have already got an automatic integration. You can then grab whatever output you need using value_templates. My setup below. (I added the mqtt server details even though im not sure its necessary).
Hi, I was also wondering how to increase the frequency of data refresh and data sharing via Zigbee2MQTT on home assistant.
In particular, for the temperature sensor: Aqara TVOC air quality monitor