Try using an app like MQTT fx and subscribe to what you are publishing. It looks like your message has lots of single and double quotes I find confusing.
Mine message looks like this in MQTT fx:
{ “temp”: 64.4, “battery”: “OK” }
How are you instructing rtl_433 to transmit its data?
The information in your first post is very difficult to read. It appears you are using a script to generate the data received by rtl_433. The script seems to be reading from a log file and then attempts to combine it with information you have provided to produce its output. My feeling is the output may not be valid JSON. Honestly, it’s hard to tell because the example is not formatted for easy reading.
I would begin by following cyn’s suggestion. Use an MQTT client (MQTT.fx or MQTT Explorer) to subscribe to homeassistant/sensor/temperature/Acurite_tower_sensor/13839 and examine its payload. MQTT Explorer has a built-in JSON validator so it will report if the payload is valid JSON or not.
In addition, it may not even be necessary to use a script file (or such a complicated script file) to publish the output from rtl_433. It recently added a new option to publish its data directly to an MQTT broker.
[-F kv | json | csv | mqtt | syslog | null | help] Produce decoded output in given format.
Append output to file with : (e.g. -F csv:log.csv), defaults to stdout.
Option -F:
[-F kv|json|csv|mqtt|syslog|null] Produce decoded output in given format.
Without this option the default is KV output. Use “-F null” to remove the default.
Append output to file with : (e.g. -F csv:log.csv), defaults to stdout. Specify MQTT server with e.g. -F mqtt://localhost:1883 Add MQTT options with e.g. -F “mqtt://host:1883,opt=arg” MQTT options are: user=foo, pass=bar, retain[=0|1], usechannel=replaceid|afterid|beforeid|no, [=topic] Supported MQTT formats: (default is all) events: posts JSON event data states: posts JSON state data devices: posts device and sensor info in nested topics E.g. -F “mqtt://localhost:1883,user=USERNAME,pass=PASSWORD,retain=0,devices=/rtl_433”
Specify host/port for syslog with e.g. -F syslog:127.0.0.1:1514
here is what i have, but i have this error and nothing in MQTT browser
mqtt://192.168.88.10:1883,user=test,pass=test,retain=0,devices=homeassistant/sensor/temperature: No such file or directory
rtl_433 -F json -M utc | mosquitto_pub -t homeassistant/sensor/temperature -l -h 192.168.88.10 -u test -P test
root@inferno:/# mqtt://192.168.88.10:1883,user=test,pass=test,retain=0,devices=homeassistant/sensor/temperature
bash: mqtt://192.168.88.10:1883,user=test,pass=test,retain=0,devices=homeassistant/sensor/temperature: No such file or directory
root@inferno:/# rtl_433 -F mqtt://192.168.88.10:1883,user=test,pass=test,retain=0,devices=homeassistant/sensor/temperature
rtl_433 version 18.12-203-ge47b62d branch master at 201904291632 inputs file rtl_tcp RTL-SDR
Trying conf file at “rtl_433.conf”…
Trying conf file at “/root/.config/rtl_433/rtl_433.conf”…
Trying conf file at “/usr/local/etc/rtl_433/rtl_433.conf”…
Trying conf file at “/etc/rtl_433/rtl_433.conf”…
Publishing MQTT UDP datagrams to 192.168.88.10 port 1883
Consider using "-M newmodel" to transition to new model keys. This will become the default someday.
A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.
Registered 98 out of 125 device decoding protocols [ 1-4 8 11-12 15-17 19-21 23 25-26 29-36 38-60 62-63 67-71 73-100 102-103 108-116 119 121 124-125 ]
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000 S/s.
Tuner gain set to Auto.
Tuned to 433.920MHz.
Allocating 15 zero-copy buffers
MQTT Connected…
MQTT Connection established.
Thanks a lot for your help guys, i really appreciate !
I learned something new about how to use rtl_433/mqtt more efficiently. The way I have it coded is so much more complicated (supervisor & python scripts) so I am happy to help and also interested in getting it right.
Did you delete the rtl_433 -F json -M utc | mosquitto_pub -t homeassistant/sensor/temperature -l -h 192.168.88.10 -u test -P test line with the line I typed earlier? You still need the rtl_433 then what I typed above.
I removed the first line, i’ll try that, for your information, I use MQTT Server & Web client, i think there is something wrong with my MQTT install, i have tried 3 MQTT servers and still have the same problem,
root@inferno:/# rtl_433 -F mqtt://192.168.88.10:1883,user=test,pass=test,retain=0,devices=homeassistant/sensor/temperature
rtl_433 version 18.12-203-ge47b62d branch master at 201904291632 inputs file rtl_tcp RTL-SDR
Trying conf file at “rtl_433.conf”…
Trying conf file at “/root/.config/rtl_433/rtl_433.conf”…
Trying conf file at “/usr/local/etc/rtl_433/rtl_433.conf”…
Trying conf file at “/etc/rtl_433/rtl_433.conf”…
Publishing MQTT UDP datagrams to 192.168.88.10 port 1883
Consider using "-M newmodel" to transition to new model keys. This will become the default someday.
A table of changes and discussion is at https://github.com/merbanan/rtl_433/pull/986.
Registered 98 out of 125 device decoding protocols [ 1-4 8 11-12 15-17 19-21 23 25-26 29-36 38-60 62-63 67-71 73-100 102-103 108-116 119 121 124-125 ]
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000 S/s.
Tuner gain set to Auto.
Tuned to 433.920MHz.
Allocating 15 zero-copy buffers
MQTT Connected…
MQTT Connection established.
The log information looks good, no reported errors, and it claims to have connected to the MQTT broker.
Nothing will be published to MQTT until rtl_433 receives data from your Acurite device. I don’t know its reporting interval. Wait at least a minute or two.
If you have still received nothing in Home Assistant, connect to the MQTT broker with MQTT Explorer and wait another minute or two for the topic to appear with its message. If nothing appears then something is wrong with the configuration of rtl_433.
Still nothing
In the MQTT server i have : 1557250749: New connection from 192.168.88.8 on port 1883.
1557250749: New client connected from 192.168.88.8 as lens_kdPeb1IxwTz5CUMCiKyPPvOe9iH (c1, k120, u’test’).
But when i check in the MQTT browser and subscribe i have nothing