MQTT question

23 views
Skip to first unread message

David

unread,
Jun 14, 2024, 7:10:34 AMJun 14
to rtl...@googlegroups.com
Hello gurus!

I have a more general question. I have rtl_433 up and running like this:
/usr/bin/rtl_433 -R 51 -R 03 -F mqtt://localhost 1883 user USER pass PASSWD

One sensor is for temperature and the other one is a Proove
door/window switch in my physical mailbox to indicate when I got new
mail.

I run mosquitto on the same raspberry pi that I use for rtl_433

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.

The topic looks like this:
rtl_433/raspberrypi433/devices/Proove-Security/1/29463210/state

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.

/David

Greg Troxel

unread,
Jun 14, 2024, 8:17:44 AMJun 14
to David, rtl...@googlegroups.com
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.)





David

unread,
Jun 14, 2024, 11:39:55 AMJun 14
to rtl...@googlegroups.com
Found the problem and sorry for the noice. It is the MQTT app in
Hubitat. My rule work one
time, but nothing happens the second time the reed switch is
activated. (Still don't understand why it work for the temperature
sensor but it is definitely a Hubitat problem)

I basically had MQTT Explorer running on my mac to check the activity
and turned it off when it worked, but because of the 100 meters
distance to the sensor I never tested the reed switch several times in
a row...

It has nothing to do with rtl_433, mosquitto or MQTT Explorer.
Case closed and thank you for your help. :)

/David
Reply all
Reply to author
Forward
0 new messages