Repository: Dasher; RTL433 to MQTT Bridge; Ink printer ink reporting

hello @hijinx and thanks for the addon.

I am trying to add my doorbell so I can implement to HA.

I use this command “/usr/local/bin/rtl_433 -a -t -F json | while read line” so that rtl gets into analyse mode and also save the results in cu8 files.

I am getting a lot of pulses but cant find the cu8 files. I connect with winscp and ssh to hassio but look in every folder and cant find any.
also the “set -x ## uncomment for MQTT logging…” line in your script does it work?
thanks
theodoros

signal_len = 156115, pulses = 675
Iteration 1. t: 107 min: 76 (391) max: 139 (284) delta 2900
Iteration 2. t: 100 min: 65 (316) max: 136 (359) delta 130
Iteration 3. t: 100 min: 65 (316) max: 136 (359) delta 0
Pulse coding: Short pulse length 65 - Long pulse length 136
Short distance: 56, long distance: 127, packet distance: 244
p_limit: 100
bitbuffer:: Number of rows: 15
[00] {45} 7c 81 68 f2 f9 c0 : 01111100 10000001 01101000 11110010 11111001 11000
[01] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[02] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[03] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[04] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[05] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[06] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[07] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[08] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[09] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[10] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[11] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[12] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[13] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
[14] {45} fc 81 68 f2 f9 c0 : 11111100 10000001 01101000 11110010 11111001 11000
signal_bsize = 393216 - sg_index = 2097152
start_pos = 1532644 - buffer_size = 3145728
*** Saving signal to file g150_433.92M_250k.cu8
*** Writing data from 1532644, len 393216

I got this to work:
{
“mqtt_host”: “hassio.local”,
“mqtt_user”: “XXXX”,
“mqtt_password”: “XXXX”,
“mqtt_topic”: “homeassistant/sensor/currentcost”,
“protocol”: 40,
“frequency”: 433920000,
“gain”: 0,
“frequency_offset”: 350
}

Starting RTL_433 with parameters:
MQTT Host = hassio.local
MQTT User = XXXX
MQTT Password = XXXX
MQTT Topic = homeassistant/sensor/currentcost
RTL_433 Protocol = 40
RTL_433 Frequency = 433920000
RTL_433 Gain = 0
RTL_433 Frequency Offset = 350
Registering protocol [1] “Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning”
Registered 1 out of 101 device decoding protocols
Found 1 device(s)
trying device 0: Realtek, RTL2838UHIDIR, SN: 00000001
Found Fitipower FC0013 tuner
Using device 0: Generic RTL2832U OEM
Exact sample rate is: 250000.000414 Hz
Sample rate set to 250000.
Bit detection level set to 0 (Auto).
Tuner gain set to Auto.
Reading samples in async mode…
Tuned to 433920000 Hz.
Allocating 15 zero-copy buffers

I’m trying to get access to the MQTT agent but i have no success i have this error when i start Hassio, my setup is: Hassio in a docker on a ubuntu server.

Config entry for mqtt not ready yet. Retrying in 5 seconds.
Configuration.yaml

mqtt
mqtt:
broker: 192.168.88.10

Config of the addon:

{
“mqtt_host”: “192.168.88.10”,
“mqtt_user”: “”,
“mqtt_password”: “”,
“mqtt_topic”: “/homeassistant/sensor/Temperature”,
“protocol”: 10,
“frequency”: 433920000,
“gain”: 60,
“frequency_offset”: 350
}

Log of the addon:

Starting RTL_433 with parameters:
MQTT Host = 192.168.88.10
MQTT User =
MQTT Password =
MQTT Topic = /homeassistant/sensor/Temperature
RTL_433 Protocol = 10
RTL_433 Frequency = 433920000
RTL_433 Gain = 60
RTL_433 Frequency Offset = 350
rtl_433 version 18.12-204-gb1b62f2 branch master at 201905030920 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”…

Consider using “-M newmodel” to transition to new model keys. This will become the default someday.
A table of changes and discussion is at Add new model keys option by zuckschwerdt ¡ Pull Request #986 ¡ merbanan/rtl_433 ¡ GitHub.

Registered 1 out of 125 device decoding protocols [ 10 ]
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 60.000000 dB.
Frequency correction set to 350 ppm.
Tuned to 433.920MHz.
Allocating 15 zero-copy buffers

If i do a netstat -an |grep 1883 i have nothing.

EDIT: I installed the MQTT broker, and added the sensors but they are empty:

  • platform: mqtt
    name: Temperature
    state_topic: “homeassistant/sensor/Temperature”
    unit_of_measurement: “°C”
    value_template: ‘{{ value_json.temperature_C }}’
  • platform: mqtt
    name: Humidite
    state_topic: “homeassistant/sensor/temperature”
    unit_of_measurement: “%”
    value_template: ‘{{ value_json.humidity }}’

Thanks for your help

In the rtl2mqtt.sh file try uncommenting the line:

#set -x ## uncomment for MQTT logging...

It will show in the addon log all the commands executed by the script…

Ahh thanks ! it help me to diagnose the problem !

I added a new addon to report printer ink levels that was inspired by this custom component.

This addon is very much a hack job (esp the shell script that calls ink and mosquitto client for MQTT) but it works great for my Canon Pixma 5300, and supports HA MQTT autodiscovery - albeit in a very hard coded way :wink:

You can find it in my hassio addons repo:

To get other printers working you will probably need to edit the ink2mqtt.sh script.

Here is my lovelace card to show ink levels using the superb custom cards bar-card and vertical-stack-in-card:

image

type: 'custom:vertical-stack-in-card'
title: Canon MG5300 Printer Ink
cards:
  - type: 'custom:bar-card'
    columns: 5
    direction: up
    entities:
      - color: MediumTurquoise
        entity: sensor.canon_mg5300_cyan_ink_level
      - color: MediumOrchid
        entity: sensor.canon_mg5300_magenta_ink_level
      - color: Gold
        entity: sensor.canon_mg5300_yellow_ink_level
      - color: Black
        entity: sensor.canon_mg5300_black_ink_level
      - color: Black
        entity: sensor.canon_mg5300_photoblack_ink_level
    height: 200px
    max: 100
    min: 0
    padding: 2px
    target: 20
    title_position: bottom
    icon_position: inside
    unit_of_measurement: '%'
    width: 100%

Hope it helps someone…

I installed the add-on and see it’s working, created sensors and tested out the template json parsing with dev tools > templates, but I can’t get the state to change.

Any pointers?

Starting RTL_433 with parameters:
MQTT Host = 192.168.2.10
MQTT User = mqtt-user
MQTT Password = mqttpwd
MQTT Topic = homeassistant/sensor/honeywell
RTL_433 Protocol = 70
RTL_433 Frequency = 344975000
RTL_433 Gain = 0
RTL_433 Frequency Offset = 50
+ + read line
/usr/local/bin/rtl_433 -F json -R 70 -f 344975000 -g 0 -p 50
rtl_433 version 18.12-210-g7ab2894 branch master at 201905261917 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"...
	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 1 out of 126 device decoding protocols [ 70 ]
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.
Frequency correction set to 50 ppm.
Tuned to 344.975MHz.
Allocating 15 zero-copy buffers
+ echo '{"time"' : '"2019-06-12' '23:56:06",' '"model"' : '"Honeywell' Door/Window 'Sensor",' '"id"' : 827623, '"channel"' : 8, '"event"' : 128, '"state"' : '"open",' '"heartbeat"' : '"no"}'+ 
jq --raw-output .model
+ tr -s ' ' _
+ DEVICE=Honeywell_Door/Window_Sensor
+ + jq --raw-output .id
echo '{"time"' : '"2019-06-12' '23:56:06",' '"model"' :+ tr -s ' ' _
 '"Honeywell' Door/Window 'Sensor",' '"id"' : 827623, '"channel"' : 8, '"event"' : 128, '"state"' : '"open",' '"heartbeat"' : '"no"}'
+ DEVICEID=827623
+ MQTT_PATH=homeassistant/sensor/honeywell
+ '[' 28 ]
+ MQTT_PATH=homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor
+ '[' 6 ]
+ MQTT_PATH=homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/827623
+ '[' -w /tmp/rtl_433.log ]
+ echo '{"time"' : '"2019-06-12' '23:56:06",' '"model"' : '"Honeywell' Door/Window 'Sensor",' '"id"' : 827623, '"channel"' : 8, '"event"' :+  128, '"state"' : '"open",' '"heartbeat"' : '"no"}'
/usr/bin/mosquitto_pub -h 192.168.2.10 -u mqtt-user -P mqttpwd -i RTL_433 -r -l -t homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/827623
+ read line

home-assistant.log

2019-06-13 00:22:03 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/827623: b'{"time" : "2019-06-13 00:21:21", "model" : "Honeywell Door/Window Sensor", "id" : 827623, "channel" : 8, "event" : 128, "state" : "open", "heartbeat" : "no"}'
binary_sensor:

  - platform: mqtt
    state_topic: homeassistant/sensor/honeywell
    #state_topic: "homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/827623"
    name: "Honeywell Sunroom Door East"
    qos: 0
    device_class: door
    value_template: '{% if (value_json.event is equalto 160) %} on {% elif (value_json.event is equalto 128) %} off {% else %} {{states.binary_sensor.honeywell_sunroom_door_east.state}} {% endif %}'

If I use the topic with the device id in it (like the commented line in the sensor), I see this…

2019-06-13 01:17:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/998796: b'{"time" : "2019-06-13 01:16:25", "model" : "Honeywell Door/Window Sensor", "id" : 998796, "channel" : 8, "event" : 0, "state" : "closed", "heartbeat" : "no"}'
2019-06-13 01:17:17 WARNING (MainThread) [homeassistant.components.mqtt.binary_sensor] No matching payload found for entity: Honeywell Front Door with state_topic: homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/998796

````

Made some progress… It has to do with my binary_sensor. If I create it as a sensor, it detects the state change, but can’t be set to device_class: door. So it doesn’t automatically have the nice icon and color change…

sensor:
- platform: mqtt
  state_topic: "homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/998796"
  name: "Honeywell Front Door"
  value_template: '{% if (value_json.id is equalto 998796) and (value_json.event is equalto 128) %} on {% elif (value_json.id is equalto 998796) and (value_json.event is equalto 0) %} off {% else %} {{states.sensor.honeywell_front_door.state}} {% endif %}'

I got it working as a binary door sensor and a much less complicated value_template. This is for one of the Honeywell sensors that always reports .state as open and only changes the .event number.

binary_sensor:
  - platform: mqtt
    state_topic: "homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/827623"
    name: "Honeywell Sunroom Door"
    device_class: door
    payload_on: 160
    payload_off: 128
    value_template: '{{value_json.event}}'

Those sensors that report .state correctly can look like this.

  - platform: mqtt
    state_topic: "homeassistant/sensor/honeywell/Honeywell_Door/Window_Sensor/998796"
    name: "Honeywell Front Door"
    device_class: door
    payload_on: open
    payload_off: closed
    value_template: '{{value_json.state}}' 
1 Like

Does anyone have a recommendation for 433MHz door/window sensors to use with this addon. Preferably ones that send open and closed codes.

these do what ya want

Thanks Glenn. Which protocol do they use?

they send a simple code via 433Mhz for open and a different code for close

Sorry but that tells me nothing. To set up the addon I need to know what protocol the sensor uses to decode the ‘simple messages’:

{
  "mqtt_host": "10.1.1.100",
  "mqtt_user": "mqtt_user",
  "mqtt_password": "my_password",
  "mqtt_topic": "RF433",
  "protocol": 100,  #### <------ PROTOCOL REQUIRED
  "frequency": 433920000,
  "gain": 60,
  "frequency_offset": 0
}

Without this the addon does not know how to decode the ‘simple messages’. e.g. is it AFK or OOK, how long are the pulses that encode the message etc…

EDIT: Found it,

# Golden Security GS-WDS07 door and window sensor
#  short is 476 us + 1344 us
#  long is 1364 us + 448 us
#  packet gap 13972 us
#decoder n=gswds07,m=OOK_PWM,s=476,l=1364,r=15000,g=1600,bits>=24,bits<=25,invert

Unfortunately this is not one of the protocols supported by the addon. So unless I can work out how to add it using the rtl2mqtt.sh file I cant use that sensor.

Thanks for this. I had it working on my Canon MG3600, but after a reboot of all my dockers it doesn’t work anymore. I get the following in my logs:
/ink2mqtt.sh: line 1: 404:: not found

Tried to reinstall the add-on, but still the same issue. Any idea what goes on here?

can you share how did you solve this? I’m stuck at the same problem

thanks

Hi everyone,

I have finally got round to setting up the RTL33 to MQTT bridge addon in home assistant to pull info from a Misol Weather station (Protocol 32) I have tested the Usb dongle on a windows laptop and can see the data from the weather station so know is protocol 32 on 433920 frequency. I have then installed the addon and it starts fine in home assistant. THe issue I have is I cannot see the topic that is subscribes to on my mqtt broker. I have included a copy of the log file. My mqtt broker works fine and have several tasmota devices communicating over this so know this is working. Does anyone have any advice on what I can try to get this working. Any help would be great as I have spent over 6 hours trying to figure it out myself with no success.

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting RTL_433 with parameters:
MQTT Host = 192.168.8.140
MQTT User = mqtt
MQTT Password = 1986
MQTT Topic = mqtt/sensor/currentcost
RTL_433 Protocol = 32
RTL_433 Frequency = 433920000
RTL_433 Gain = 60
RTL_433 Frequency Offset = 350
rtl_433 version 20.02-55-gc1d1f9f branch master at 202005162227 inputs file rtl_tcp RTL-SDR
Use -h for usage help and see https://triq.org/ for documentation.
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”…
Registered 1 out of 152 device decoding protocols [ 32 ]
Found Fitipower FC0012 tuner
Exact sample rate is: 250000.000414 Hz

Hi all - New to the world of SDR but have setup the RTL433 to MQTT Bridge and have successfully captured some devices. Now for the next step…
I am looking to use the project RTL_433 specific data located here to allow me to capture my doorbell (Honeywell ActivLink) so would like to use the Honeywell Doorbell code:

‘rtl_433 -f 868300000 -q -R 0 -X n=Honeywell_ActivLink,m=FSK_PWM,s=160,l=320,r=400,y=480,invert,bits=48’

How do I integrate the code into the rtl2mqtt.sh file without disturbing the json?

Just an idea, for the several people who got the bridge add-on working, but did not seem to successfully pick up any signals or generate MQTT message. For me, using the -P flag on the rtl_433 somehow stopped signals from being picked up. This is on the latest version of rtl_433 (as of the date of this post), on Hassio. Without the flag, no problem. You can easily remove it by editing rtl2mqtt.sh.

Thank you James for the RTL433 bridge add-on. I ended up rewriting rtl2mqtt.sh to have rtl_433 itself directly publish data into MQTT instead of piping it thru mosquitto_pub.

Auto discovery: I made an add-on based on rtl_433_mqtt_hass.py that publishes discovery topics to MQTT, so now all my Acurite sensors automatically show up in HA as devices/entities under MQTT integration. It can be found in the following repo: https://github.com/pbkhrv/rtl_433-hass-addons.

4 Likes