David <
da...@bengtsson.net> writes:
> /usr/bin/rtl_433 -R 51 -R 03 -F mqtt://localhost 1883 user USER pass PASSWD
>
> The heart in my home automation system is a Hubitat hub. A mqtt client
> app on the hub are subscribed to my topics and presents the payload on
> a dashboard in the Hubitat system. The temperature sensor works
> perfect, but I have an issue with the mailbox switch. It doesn't work
> if I don't have a second mqtt client running on my network. It works
> great if I run MQTT Explorer on my Mac and connect to my broker.
>
> The Proove switch stays silent most of the time and it changes state
> from OFF to ON three /four times in a second when the lid of the
> mailbox is open, and then reports OFF again before it goes silent.
I prefer to use rtl_433_mqtt_relay instead of the builtin support. I'm
not claiming that the builtin support is broken. But I find that I can
easily change the python code to do what I want.
> rtl_433/raspberrypi433/devices/Proove-Security/1/29463210/state
Presumably 29463210 is some kind of id and this is stable.
> My rule is set so I should get a notification when the state changes.
> Any ideas how I can fix this without running MQTT Explorer on my Mac.
Something is messed up, but given what you have posted it is hard to
know. It just does not make sense that one client would receive
different information because another client is subscribed.
I would:
run mosquitto_sub and save the output to a log file. I tend to do
this, not to make things work, but so that I can go and look back at
the raw mqtt. Look over the data after a few days and make sure
everything is as you expect.
Turn on debugging in hubitat surrounding reading this mqtt. (Really,
I would choose an open source home automation system :-) and then turn
on debugging in Home Assistant!)
Understand the mqtt retain concept and think about whether you want to
set that, and how the mqtt config in your automation system interacts
with the retain flag. Broadly, I tend to not set retain for devices
that report once a minute (e.g. temp sensors) and configure the HA
sensors with "expire" so that they go unavailable after e.g. 10
minutes. But if I had a mailbox sensor (on my list, haven't gotten to
it), I would set the retain flag because it only reports on state
change, and a closed report from 1pm yesterday is still valid;
presumably you want the sensor object to show closed rather than
unavailable. (This doesn't explain your problem at all.)