I have rtl_433 listening to temperature & humidity updates from an Acurite 609TXC and Inkbird IBS-P01R sensors and sending them to the Mosquitto broker running as an HA add-on:
The Inkbird is working perfectly – it sends a single update every couple of minutes and it’s showing up in the HA sqlite3 DB and in InfluxDB. I’m using this in my configuration.yaml:
But once a minute I get a “burst” of 6 updates with timestamps that are essentially the same (off by milliseconds). That’s quickly adding a ton of data to both sqlite3 and InfluxDB (especially because I have multiple of these reporting multiple values each). I have been searching for a way to filter those down to one a minute (or even less), but I’m having trouble finding a solution. I tried a condition on the platform: mqtt a number of different ways, but I get an error from the config validator that conditions aren’t support there. I tried adding “if” logic to my value_template but all that does is put undefined into the DB and InfluxDB.
Is there a a way to filter incoming MQTT data like I’m trying to do?
In particular, the Time Throttle filter. You’ll still need to receive the multiple messages in the “raw” sensor, but your filter sensor will only record the ones you want.
You can then set the system up to not record the “raw” sensor [docs, see exclude].
Publishing {"temperature": 23.1} and {"temperature": 23.2} created two additional records. However, publishing {"temperature": 23.23} and {"temperature": 23.24} did not (because their rounded values are 23.2 which is the sensor’s existing value).
I’m curious to know why you’re seeing the addition of a “ton of data”.
@Troon & @123 Thank you both so much. Let me play with what both of you are saying and I’ll report back. Thanks again… I really appreciate the tips! (I am still learning Home Assistant… I have been reading the manual and through various posts, but there are still many parts that haven’t quite become clear to me yet).
I guess if I comment out force_update: true then I end up with too many gaps in my data if the values don’t change very often. The ideal would be to get on update every minute. I’m curious why the de-duplication logic isn’t working in my case. I’ll keep digging, but if anyone has ideas let me know. Thanks!
I loaded it at UTC 17:25 and published a payload to it moments later. Then I waited about a half-hour.
The only records in the database’s states table for this sensor are its initial unknown value and the first payload I published. That’s it, that’s all.
Further confirmation that it was updated exclusively when I published it (and no more) is here:
There’s no “gap”. The sensor reports the last different value it received. If the same value is repeatedly received, it simply reports its existing value (and the date and time of its “last_updated” property remains unchanged).
Post the output of whatever tool you are using that shows these multiple identical values being stored in your database.
PS: A few more points just in case they are relevant:
I wasn’t sure if you only wanted the JSON payload from each MQTT message or the MQTT headers, so that’s why I just gave you the whole packet after the TCP header.
And this was one of two MQTT messages it sends each time (the second TCP packet had 2 MQTT messages in it).
Maybe a dumb question but why is rtl_433 publishing the same payload repeatedly? Those sample payloads appear to be absolutely identical so what makes rtl_433 obliged to repeat the payload? Publishing a payload once is all that is needed.
As for why Home Assistant doesn’t simply ignore the duplicates is a mystery to me. As you’ve seen from the tests I’ve performed, they confirm that duplicates are rejected; I can’t replicate your results (and I’m using 2021.3.4).
I assume it’s because the Acurite is sending 6 messages each time since with the Inkbird (and other devices) I only get one each time the device sends something. I’ll see if I can fire up some other SDR software to prove the theory (or have rtl_433 dump some raw data).
Yeah, makes sense. I’m confused too. I definitely appreciate the help! Thank you so much.