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

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

My google fu is not finding much info in relation to the esp32 boards below. Is anyone using these with Rtl_433?

esp32 LoRa sx1278

SX1278 LoRa 433Mhz ESP32 0.96 inch Blue OLED Display Bluetooth WIFI Lora Kit 32 Module Internet Development Board Antenna for arduino

Im really glad you were able to take my addon forward. Thanks!
Unfortunately my only 433MHz device (current cost energy consumption meter) has died, so I no longer have the ability to support the addon.

hello, I am trying to add wireless honeywell sensors into HA and have been going in circles for days. to start from the beginning, what addon did you use and did you just add it to yaml or to the raspeberry pi via ssh? (I have the same dongle connected to a pi I run HA on) any help would be appreciated!

Has anyone had success running this add-on on a KVM guest of HassOS? I have setup the USB pass through for this VM and I see it on the HassOS console (see below). However, no matter how I run rtl_433 I get a usb_open error:

Edit: Solved: I installed allmyhinges addon posted above and it works.

rtl_433 addon log:

+ /usr/local/bin/rtl_433 -F json -R 100 -f 319500000 -g 38 -p 0
rtl_433 version 20.11-72-g914552b9 branch master at 202102121205 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 178 device decoding protocols [ 100 ]
usb_open error -1
[cmd] /bin/ash exited 2
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

ha hardware info output:

- attributes:
    BUSNUM: "001"
    DEVNAME: /dev/bus/usb/001/003
    DEVNUM: "003"
    DEVPATH: /devices/pci0000:00/0000:00:05.7/usb1/1-4
    DEVTYPE: usb_device
    DRIVER: usb
    ID_BUS: usb
    ID_MODEL: RTL2838UHIDIR
    ID_MODEL_ENC: RTL2838UHIDIR
    ID_MODEL_ID: "2838"
    ID_REVISION: "0100"
    ID_SERIAL: Realtek_RTL2838UHIDIR_00000001
    ID_SERIAL_SHORT: "00000001"
    ID_USB_INTERFACES: ':ffffff:'
    ID_VENDOR: Realtek
    ID_VENDOR_ENC: Realtek
    ID_VENDOR_ID: 0bda
    MAJOR: "189"
    MINOR: "2"
    PRODUCT: bda/2838/100
    SUBSYSTEM: usb
    TYPE: 0/0/0
    USEC_INITIALIZED: "245312654689"
  by_id: null
  dev_path: /dev/bus/usb/001/003
  name: 1-4
  subsystem: usb
  sysfs: /sys/devices/pci0000:00/0000:00:05.7/usb1/1-4
1 Like