List of commits:
Subject Hash Author Date (UTC)
Initial commit 826b0a3cd9fb820dbfcc35f710d0a6f22847e9c6 Brett Clark 2019-09-11 16:29:20
Commit 826b0a3cd9fb820dbfcc35f710d0a6f22847e9c6 - Initial commit
Author: Brett Clark
Author date (UTC): 2019-09-11 16:29
Committer name: Brett Clark
Committer date (UTC): 2019-09-11 16:29
Parent(s):
Signing key:
Tree: 6525f4c867aa617e3ad44acc3d8fd12e6ca8cc85
File Lines added Lines deleted
README.md 5 0
repository.json 5 0
rtl4332mqtt/Dockerfile 51 0
rtl4332mqtt/LICENSE 21 0
rtl4332mqtt/README.md 87 0
rtl4332mqtt/config.json 41 0
rtl4332mqtt/rtl2mqtt.currentcost_autodiscovery.sh 204 0
rtl4332mqtt/rtl2mqtt.sh 202 0
File README.md added (mode: 100644) (index 0000000..42756bc)
1 # hassio-addons
2 Repository for hass.io add-ons
3
4 - [Instructions how to add this repository to Hass.io](https://home-assistant.io/hassio/installing_third_party_addons/)
5 - For information about Dasher Amazon Dash button support see https://github.com/maddox/dasher
File repository.json added (mode: 100644) (index 0000000..060d7d2)
1 {
2 "name": "Hass.IO add-on repository by Brett Clark",
3 "url": "https://rocketgit.com/user/bmclark/hassio-addons",
4 "maintainer": "Brett Clark"
5 }
File rtl4332mqtt/Dockerfile added (mode: 100644) (index 0000000..5033e02)
1 # Docker file to create an image for a hass.io add-on that contains enough software to listen to events via RTL_SDR/RTL_433 and then publish them to a MQTT broker.
2 # The script resides in a volume and can be modified to meet your needs.
3 # This hass.io addon is based on Chris Kacerguis' project here: https://github.com/chriskacerguis/honeywell2mqtt,
4 # which is in turn based on Marco Verleun's rtl2mqtt image here: https://github.com/roflmao/rtl2mqtt
5
6 # IMPORTANT: The container needs privileged access to /dev/bus/usb on the host.
7
8 ARG BUILD_FROM
9 FROM $BUILD_FROM
10
11 ENV LANG C.UTF-8
12
13 MAINTAINER James Fry
14
15 LABEL Description="This image is used to start a script that will monitor for RF events on 433Mhz (configurable) and send the data to an MQTT server"
16
17 #
18 # First install software packages needed to compile rtl_433 and to publish MQTT events
19 #
20 RUN apk add --no-cache --virtual build-deps alpine-sdk cmake git libusb-dev && \
21 mkdir /tmp/src && \
22 cd /tmp/src && \
23 git clone git://git.osmocom.org/rtl-sdr.git && \
24 mkdir /tmp/src/rtl-sdr/build && \
25 cd /tmp/src/rtl-sdr/build && \
26 cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/local && \
27 make && \
28 make install && \
29 chmod +s /usr/local/bin/rtl_* && \
30 cd /tmp/src/ && \
31 git clone https://github.com/merbanan/rtl_433 && \
32 cd rtl_433/ && \
33 mkdir build && \
34 cd build && \
35 cmake ../ && \
36 make && \
37 make install && \
38 apk del build-deps && \
39 rm -r /tmp/src && \
40 apk add --no-cache libusb mosquitto-clients jq
41
42 #
43 # Define an environment variable
44 #
45 # Use this variable when creating a container to specify the MQTT broker host.
46 ENV MQTT_HOST="hassio.local"
47 ENV MQTT_USER="guest"
48 ENV MQTT_PASS="guest"
49 ENV MQTT_TOPIC="homeassistant/sensor/rtl433"
50
51 CMD cd / && cp /config/rtl4332mqtt/rtl2mqtt.sh /rtl2mqtt.sh && chmod +x /rtl2mqtt.sh && /rtl2mqtt.sh
File rtl4332mqtt/LICENSE added (mode: 100644) (index 0000000..f7cb4de)
1 MIT License
2
3 Copyright (c) 2017 Chris Kacerguis
4
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE.
File rtl4332mqtt/README.md added (mode: 100644) (index 0000000..a1fe13b)
1 # RTL433 to MQTT Bridge hass.io addon
2 A hass.io addon for a software defined radio tuned to listen for 433MHz RF transmissions and republish the data via MQTT
3
4 This hass.io addon is based on Chris Kacerguis' project here: https://github.com/chriskacerguis/honeywell2mqtt,
5 which is in turn based on Marco Verleun's rtl2mqtt image here: https://github.com/roflmao/rtl2mqtt
6
7 ## Usage
8
9 1) Install the addon.
10
11 2) Use addon configuration to configure:
12 - mqtt_host
13 - mqtt_user
14 - mqtt_password
15 - mqtt_topic
16 - protocol (see https://github.com/merbanan/rtl_433 for more details inc protocol IDs)
17
18 3) Copy rtl2mqtt.sh to your hass.io config dir in a subdir called rtl4332mqtt.
19 i.e.
20 .../config/rtl4332mqtt/rtl2mqtt.sh
21 This allows you to edit the start script if you need to make any changes
22
23 NOTE that some people have reported issues using samba to copy the script. For some reason it does not get copied to the container on start up of the addon. If you see this issue, please scp the script to your hassio config folder, or ssh in and edit the file locally with vi/nano.
24
25 Also there is now an example rtl2mqtt script with MQTT sensor autodiscovery. This is very hard coded to a single sensor currentcost, but might be an interesting example for others to repurpose...
26
27
28 4) Start the addon
29
30
31 ## MQTT Data
32
33 Data to the MQTT server will depend on the protocol.
34 Chris tested Honeywell devices and the JSON is as follows:
35
36 ```json
37 {
38 "time" : "2017-08-17 13:18:58",
39 "model" : "Honeywell Door/Window Sensor",
40 "id" : 547651,
41 "channel" : 8,
42 "event" : 4,
43 "state" : "closed",
44 "heartbeat" : "yes"
45 }
46 ```
47
48 I have tested CurrentCost devices and the JSON is as follows:
49
50 ```json
51 {
52 "time" : "2017-10-16 20:53:09",
53 "model" : "CurrentCost TX",
54 "dev_id" : 3063,
55 "power0" : 617,
56 "power1" : 0,
57 "power2" : 0
58 }
59 ```
60
61 ## Hardware
62
63 This has been tested and used with the following hardware (you can get it on Amazon)
64
65 Chris:
66 - Honeywell Ademco 5818MNL Recessed Door Transmitter
67 - 5800MINI Wireless Door/Window Contact by Honeywell
68 - NooElec NESDR Nano 2+ Tiny Black RTL-SDR USB
69
70 Me:
71 - CurrentCost TX: http://www.ebay.co.uk/itm/Current-Cost-Envi-R-Energy-Monitor-Smart-Electric-Meter-/152084708754
72 - Super cheap RTL dongle: http://www.ebay.co.uk/itm/Mini-USB-DVB-T-RTL-SDR-Realtek-RTL2832U-R820T-Stick-Receiver-Dongle-MCX-Input-PK/222637370515
73
74
75 ## Troubleshooting
76
77 If you see this error:
78
79 > Kernel driver is active, or device is claimed by second instance of librtlsdr.
80 > In the first case, please either detach or blacklist the kernel module
81 > (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
82
83 Then run the following command on the host
84
85 ```bash
86 sudo rmmod dvb_usb_rtl28xxu rtl2832
87 ```
File rtl4332mqtt/config.json added (mode: 100644) (index 0000000..f42abd7)
1 {
2 "name": "RTL_433 to MQTT Bridge",
3 "version": "0.1",
4 "slug": "rtl4332mqtt",
5 "description": "433MHz RF to MQTT Bridge based on RTL_SDR/RTL_433 for RTL2832U based DVB-T USB tuners",
6 "url": "https://github.com/james-fry/hassio-addons/tree/master/rtl4332mqtt",
7 "startup": "before",
8 "boot": "auto",
9 "map": ["config:rw", "ssl"],
10 "devices": ["/dev/bus/usb:/dev/bus/usb:rwm"],
11 "host_network": "False",
12 "arch": [
13 "aarch64",
14 "amd64",
15 "armv7",
16 "i386",
17 "armv61"
18 ],
19 "options":
20 {
21 "mqtt_host": "hassio.local",
22 "mqtt_user": "",
23 "mqtt_password": "",
24 "mqtt_topic": "homeassistant/rtl433[/id]",
25 "protocol": 100,
26 "frequency": 319500000,
27 "gain": 60,
28 "frequency_offset": 350
29 },
30 "schema":
31 {
32 "mqtt_host": "str",
33 "mqtt_user": "str",
34 "mqtt_password": "str",
35 "mqtt_topic": "str",
36 "protocol": "int",
37 "frequency": "int",
38 "gain": "int",
39 "frequency_offset": "int"
40 }
41 }
File rtl4332mqtt/rtl2mqtt.currentcost_autodiscovery.sh added (mode: 100644) (index 0000000..4ddd88e)
1 #!/bin/sh
2
3 # A simple script that will receive events from an RTL433 SDR and resend the data via MQTT
4
5 # Author: Chris Kacerguis <chriskacerguis@gmail.com>
6 # Modification for hass.io add-on: James Fry
7
8 # Below are rtl_433 options and the supported device protocols as of 25/10/2017
9 # **NOTE that the protocol number is NOT persistent and seems to change**
10 # Hence always verify protocol numbers in logs when starting the add-on
11 # The key arguments required are:
12 # -F json --> this sets JSON formatted output for easier MQTT
13 # -R <protocol number> --> this tells rtl_433 which protocol(s) to scan for
14
15 # Usage: = Tuner options =
16 # [-d <RTL-SDR USB device index>] (default: 0)
17 # [-g <gain>] (default: 0 for auto)
18 # [-f <frequency>] [-f...] Receive frequency(s) (default: 433920000 Hz)
19 # [-H <seconds>] Hop interval for polling of multiple frequencies (default: 600 seconds)
20 # [-p <ppm_error] Correct rtl-sdr tuner frequency offset error (default: 0)
21 # [-s <sample rate>] Set sample rate (default: 250000 Hz)
22 # [-S] Force sync output (default: async)
23 # = Demodulator options =
24 # [-R <device>] Enable only the specified device decoding protocol (can be used multiple times)
25 # [-G] Enable all device protocols, included those disabled by default
26 # [-l <level>] Change detection level used to determine pulses [0-16384] (0 = auto) (default: 0)
27 # [-z <value>] Override short value in data decoder
28 # [-x <value>] Override long value in data decoder
29 # [-n <value>] Specify number of samples to take (each sample is 2 bytes: 1 each of I & Q)
30 # = Analyze/Debug options =
31 # [-a] Analyze mode. Print a textual description of the signal. Disables decoding
32 # [-A] Pulse Analyzer. Enable pulse analyzis and decode attempt
33 # [-I] Include only: 0 = all (default), 1 = unknown devices, 2 = known devices
34 # [-D] Print debug info on event (repeat for more info)
35 # [-q] Quiet mode, suppress non-data messages
36 # [-W] Overwrite mode, disable checks to prevent files from being overwritten
37 # [-y <code>] Verify decoding of demodulated test data (e.g. "{25}fb2dd58") with enabled devices
38 # = File I/O options =
39 # [-t] Test signal auto save. Use it together with analyze mode (-a -t). Creates one file per signal
40 # Note: Saves raw I/Q samples (uint8 pcm, 2 channel). Preferred mode for generating test files
41 # [-r <filename>] Read data from input file instead of a receiver
42 # [-m <mode>] Data file mode for input / output file (default: 0)
43 # 0 = Raw I/Q samples (uint8, 2 channel)
44 # 1 = AM demodulated samples (int16 pcm, 1 channel)
45 # 2 = FM demodulated samples (int16) (experimental)
46 # 3 = Raw I/Q samples (cf32, 2 channel)
47 # Note: If output file is specified, input will always be I/Q
48 # [-F] kv|json|csv Produce decoded output in given format. Not yet supported by all drivers.
49 # append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.
50 # [-C] native|si|customary Convert units in decoded output.
51 # [-T] specify number of seconds to run
52 # [-U] Print timestamps in UTC (this may also be accomplished by invocation with TZ environment variable set).
53 # [<filename>] Save data stream to output file (a '-' dumps samples to stdout)
54 #
55 # Supported device protocols:
56 # [01]* Silvercrest Remote Control
57 # [02] Rubicson Temperature Sensor
58 # [03] Prologue Temperature Sensor
59 # [04] Waveman Switch Transmitter
60 # [05]* Steffen Switch Transmitter
61 # [06]* ELV EM 1000
62 # [07]* ELV WS 2000
63 # [08] LaCrosse TX Temperature / Humidity Sensor
64 # [09]* Template decoder
65 # [10]* Acurite 896 Rain Gauge
66 # [11] Acurite 609TXC Temperature and Humidity Sensor
67 # [12] Oregon Scientific Weather Sensor
68 # [13] Mebus 433
69 # [14]* Intertechno 433
70 # [15] KlikAanKlikUit Wireless Switch
71 # [16] AlectoV1 Weather Sensor (Alecto WS3500 WS4500 Ventus W155/W044 Oregon)
72 # [17] Cardin S466-TX2
73 # [18] Fine Offset Electronics, WH2 Temperature/Humidity Sensor
74 # [19] Nexus Temperature & Humidity Sensor
75 # [20] Ambient Weather Temperature Sensor
76 # [21] Calibeur RF-104 Sensor
77 # [22]* X10 RF
78 # [23]* DSC Security Contact
79 # [24]* Brennenstuhl RCS 2044
80 # [25] GT-WT-02 Sensor
81 # [26] Danfoss CFR Thermostat
82 # [27]* Energy Count 3000 (868.3 MHz)
83 # [28]* Valeo Car Key
84 # [29] Chuango Security Technology
85 # [30] Generic Remote SC226x EV1527
86 # [31] TFA-Twin-Plus-30.3049 and Ea2 BL999
87 # [32] Fine Offset Electronics WH1080/WH3080 Weather Station
88 # [33] WT450
89 # [34] LaCrosse WS-2310 Weather Station
90 # [35] Esperanza EWS
91 # [36] Efergy e2 classic
92 # [37]* Inovalley kw9015b, TFA Dostmann 30.3161 (Rain and temperature sensor)
93 # [38] Generic temperature sensor 1
94 # [39] WG-PB12V1
95 # [40]* Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning
96 # [41]* Acurite 986 Refrigerator / Freezer Thermometer
97 # [42] HIDEKI TS04 Temperature, Humidity, Wind and Rain Sensor
98 # [43] Watchman Sonic / Apollo Ultrasonic / Beckett Rocket oil tank monitor
99 # [44] CurrentCost Current Sensor
100 # [45] emonTx OpenEnergyMonitor
101 # [46] HT680 Remote control
102 # [47] S3318P Temperature & Humidity Sensor
103 # [48] Akhan 100F14 remote keyless entry
104 # [49] Quhwa
105 # [50] OSv1 Temperature Sensor
106 # [51] Proove
107 # [52] Bresser Thermo-/Hygro-Sensor 3CH
108 # [53] Springfield Temperature and Soil Moisture
109 # [54] Oregon Scientific SL109H Remote Thermal Hygro Sensor
110 # [55] Acurite 606TX Temperature Sensor
111 # [56] TFA pool temperature sensor
112 # [57] Kedsum Temperature & Humidity Sensor
113 # [58] blyss DC5-UK-WH (433.92 MHz)
114 # [59] Steelmate TPMS
115 # [60] Schrader TPMS
116 # [61]* LightwaveRF
117 # [62] Elro DB286A Doorbell
118 # [63] Efergy Optical
119 # [64] Honda Car Key
120 # [65]* Template decoder
121 # [66] Fine Offset Electronics, XC0400
122 # [67] Radiohead ASK
123 # [68] Kerui PIR Sensor
124 # [69] Fine Offset WH1050 Weather Station
125 # [70] Honeywell Door/Window Sensor
126 # [71] Maverick ET-732/733 BBQ Sensor
127 # [72]* RF-tech
128 # [73] LaCrosse TX141TH-Bv2 sensor
129 # [74] Acurite 00275rm,00276rm Temp/Humidity with optional probe
130 # [75] LaCrosse TX35DTH-IT Temperature sensor
131 # [76] LaCrosse TX29IT Temperature sensor
132 # [77] Vaillant calorMatic 340f Central Heating Control
133 # [78] Fine Offset Electronics, WH25 Temperature/Humidity/Pressure Sensor
134 # [79] Fine Offset Electronics, WH0530 Temperature/Rain Sensor
135 # [80] IBIS beacon
136 # [81] Oil Ultrasonic STANDARD FSK
137 # [82] Citroen TPMS
138 # [83] Oil Ultrasonic STANDARD ASK
139 # [84] Thermopro TP11 Thermometer
140 # [85] Solight TE44
141 # [86] Wireless Smoke and Heat Detector GS 558
142 # [87] Generic wireless motion sensor
143 # [88] Toyota TPMS
144 # [89] Ford TPMS
145 # [90] Renault TPMS
146 # [91]* inFactory
147 # [92] FT-004-B Temperature Sensor
148 # [93] Ford Car Key
149 # [94] Philips outdoor temperature sensor
150 # [95] Schrader TPMS EG53MA4
151 # [96] Nexa
152 # [97] Thermopro TP12 Thermometer
153 # [98] GE Color Effects
154 # [99] X10 Security
155 # [100] Interlogix GE UTC Security Devices
156 # [101]* Dish remote 6.3
157 # * Disabled by default, use -R n or -G
158
159 export LANG=C
160 PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
161
162 CONFIG_PATH=/data/options.json
163 MQTT_HOST="$(jq --raw-output '.mqtt_host' $CONFIG_PATH)"
164 MQTT_USER="$(jq --raw-output '.mqtt_user' $CONFIG_PATH)"
165 MQTT_PASS="$(jq --raw-output '.mqtt_password' $CONFIG_PATH)"
166 MQTT_TOPIC="$(jq --raw-output '.mqtt_topic' $CONFIG_PATH)"
167 PROTOCOL="$(jq --raw-output '.protocol' $CONFIG_PATH)"
168 FREQUENCY="$(jq --raw-output '.frequency' $CONFIG_PATH)"
169 GAIN="$(jq --raw-output '.gain' $CONFIG_PATH)"
170 OFFSET="$(jq --raw-output '.frequency_offset' $CONFIG_PATH)"
171
172 # Start the listener and enter an endless loop
173 echo "Starting RTL_433 with parameters:"
174 echo "MQTT Host =" $MQTT_HOST
175 echo "MQTT User =" $MQTT_USER
176 echo "MQTT Password =" $MQTT_PASS
177 echo "MQTT Topic =" $MQTT_TOPIC
178 echo "RTL_433 Protocol =" $PROTOCOL
179 echo "RTL_433 Frequency =" $FREQUENCY
180 echo "RTL_433 Gain =" $GAIN
181 echo "RTL_433 Frequency Offset =" $OFFSET
182
183 echo "MQTT Autodiscovery:"
184 #AUTO_D="{\"unit_of_measurement\":\"W\",\"device_class\":\"power\",\"value_template\":\"{{ value_json.power }}\",\"state_topic\":\"rtl4332mqtt/CurrentCost\",\"json_attributes_topic\":\"rtl4332mqtt/CurrentCost\",\"name\":\"Current Cost Tx\",\"unique_id\":\"3575_CurrentCost TX_rtl4332mqtt\",\"device\":{\"identifiers\":\"Current Cost Tx_3575\",\"name\":\"Current Cost Tx\",\"sw_version\":\"N/A\",\"model\":\"Current Cost Tx\",\"manufacturer\":\"Current Cost\"},\"availability_topic\":\"rtl4332mqtt/bridge/state\"}"
185 AUTO_D="{\"unit_of_measurement\":\"W\",\"device_class\":\"power\",\"icon\":\"mdi:gauge\",\"value_template\":\"{{ value_json.power0 }}\",\"state_topic\":\"rtl4332mqtt/CurrentCost_TX_3575\",\"json_attributes_topic\":\"tl4332mqtt/CurrentCost_TX_3575\",\"name\":\"Current Cost Tx\",\"unique_id\":\"3575_CurrentCost TX_rtl4332mqtt\",\"device\":{\"identifiers\":\"Current Cost Tx_3575\",\"name\":\"Current Cost Tx\",\"sw_version\":\"N/A\",\"model\":\"Current Cost EnviR Tx\",\"manufacturer\":\"Current Cost\"}}"
186 echo $AUTO_D;
187 echo $AUTO_D | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t homeassistant/sensor/3575/power/config
188
189 #set -x ## uncomment for MQTT logging...
190
191 /usr/local/bin/rtl_433 -F json -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET | while read line
192 do
193 DEVICE="$(echo $line | jq --raw-output '.model' | tr -s ' ' '_')" # replace ' ' with '_'
194 # echo $DEVICE
195 DEVICEID="$(echo $line | jq --raw-output '.dev_id' | tr -s ' ' '_')"
196 # echo $DEVICEID
197 MQTT_PATH="${MQTT_TOPIC}/${DEVICE}_${DEVICEID}"
198 # echo $MQTT_PATH
199
200 # Create file with touch /tmp/rtl_433.log if logging is needed
201 [ -w /tmp/rtl_433.log ] && echo $line >> rtl_433.log
202 # echo $line
203 echo $line | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH
204 done
File rtl4332mqtt/rtl2mqtt.sh added (mode: 100644) (index 0000000..4dabc80)
1 #!/bin/sh
2
3 # A simple script that will receive events from an RTL433 SDR and resend the data via MQTT
4
5 # Author: Chris Kacerguis <chriskacerguis@gmail.com>
6 # Modification for hass.io add-on: James Fry
7
8 # Below are rtl_433 options and the supported device protocols as of 25/10/2017
9 # **NOTE that the protocol number is NOT persistent and seems to change**
10 # Hence always verify protocol numbers in logs when starting the add-on
11 # The key arguments required are:
12 # -F json --> this sets JSON formatted output for easier MQTT
13 # -R <protocol number> --> this tells rtl_433 which protocol(s) to scan for
14
15 # Usage: = Tuner options =
16 # [-d <RTL-SDR USB device index>] (default: 0)
17 # [-g <gain>] (default: 0 for auto)
18 # [-f <frequency>] [-f...] Receive frequency(s) (default: 433920000 Hz)
19 # [-H <seconds>] Hop interval for polling of multiple frequencies (default: 600 seconds)
20 # [-p <ppm_error] Correct rtl-sdr tuner frequency offset error (default: 0)
21 # [-s <sample rate>] Set sample rate (default: 250000 Hz)
22 # [-S] Force sync output (default: async)
23 # = Demodulator options =
24 # [-R <device>] Enable only the specified device decoding protocol (can be used multiple times)
25 # [-G] Enable all device protocols, included those disabled by default
26 # [-l <level>] Change detection level used to determine pulses [0-16384] (0 = auto) (default: 0)
27 # [-z <value>] Override short value in data decoder
28 # [-x <value>] Override long value in data decoder
29 # [-n <value>] Specify number of samples to take (each sample is 2 bytes: 1 each of I & Q)
30 # = Analyze/Debug options =
31 # [-a] Analyze mode. Print a textual description of the signal. Disables decoding
32 # [-A] Pulse Analyzer. Enable pulse analyzis and decode attempt
33 # [-I] Include only: 0 = all (default), 1 = unknown devices, 2 = known devices
34 # [-D] Print debug info on event (repeat for more info)
35 # [-q] Quiet mode, suppress non-data messages
36 # [-W] Overwrite mode, disable checks to prevent files from being overwritten
37 # [-y <code>] Verify decoding of demodulated test data (e.g. "{25}fb2dd58") with enabled devices
38 # = File I/O options =
39 # [-t] Test signal auto save. Use it together with analyze mode (-a -t). Creates one file per signal
40 # Note: Saves raw I/Q samples (uint8 pcm, 2 channel). Preferred mode for generating test files
41 # [-r <filename>] Read data from input file instead of a receiver
42 # [-m <mode>] Data file mode for input / output file (default: 0)
43 # 0 = Raw I/Q samples (uint8, 2 channel)
44 # 1 = AM demodulated samples (int16 pcm, 1 channel)
45 # 2 = FM demodulated samples (int16) (experimental)
46 # 3 = Raw I/Q samples (cf32, 2 channel)
47 # Note: If output file is specified, input will always be I/Q
48 # [-F] kv|json|csv Produce decoded output in given format. Not yet supported by all drivers.
49 # append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.
50 # [-C] native|si|customary Convert units in decoded output.
51 # [-T] specify number of seconds to run
52 # [-U] Print timestamps in UTC (this may also be accomplished by invocation with TZ environment variable set).
53 # [<filename>] Save data stream to output file (a '-' dumps samples to stdout)
54 #
55 # Supported device protocols:
56 # [01]* Silvercrest Remote Control
57 # [02] Rubicson Temperature Sensor
58 # [03] Prologue Temperature Sensor
59 # [04] Waveman Switch Transmitter
60 # [05]* Steffen Switch Transmitter
61 # [06]* ELV EM 1000
62 # [07]* ELV WS 2000
63 # [08] LaCrosse TX Temperature / Humidity Sensor
64 # [09]* Template decoder
65 # [10]* Acurite 896 Rain Gauge
66 # [11] Acurite 609TXC Temperature and Humidity Sensor
67 # [12] Oregon Scientific Weather Sensor
68 # [13] Mebus 433
69 # [14]* Intertechno 433
70 # [15] KlikAanKlikUit Wireless Switch
71 # [16] AlectoV1 Weather Sensor (Alecto WS3500 WS4500 Ventus W155/W044 Oregon)
72 # [17] Cardin S466-TX2
73 # [18] Fine Offset Electronics, WH2 Temperature/Humidity Sensor
74 # [19] Nexus Temperature & Humidity Sensor
75 # [20] Ambient Weather Temperature Sensor
76 # [21] Calibeur RF-104 Sensor
77 # [22]* X10 RF
78 # [23]* DSC Security Contact
79 # [24]* Brennenstuhl RCS 2044
80 # [25] GT-WT-02 Sensor
81 # [26] Danfoss CFR Thermostat
82 # [27]* Energy Count 3000 (868.3 MHz)
83 # [28]* Valeo Car Key
84 # [29] Chuango Security Technology
85 # [30] Generic Remote SC226x EV1527
86 # [31] TFA-Twin-Plus-30.3049 and Ea2 BL999
87 # [32] Fine Offset Electronics WH1080/WH3080 Weather Station
88 # [33] WT450
89 # [34] LaCrosse WS-2310 Weather Station
90 # [35] Esperanza EWS
91 # [36] Efergy e2 classic
92 # [37]* Inovalley kw9015b, TFA Dostmann 30.3161 (Rain and temperature sensor)
93 # [38] Generic temperature sensor 1
94 # [39] WG-PB12V1
95 # [40]* Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning
96 # [41]* Acurite 986 Refrigerator / Freezer Thermometer
97 # [42] HIDEKI TS04 Temperature, Humidity, Wind and Rain Sensor
98 # [43] Watchman Sonic / Apollo Ultrasonic / Beckett Rocket oil tank monitor
99 # [44] CurrentCost Current Sensor
100 # [45] emonTx OpenEnergyMonitor
101 # [46] HT680 Remote control
102 # [47] S3318P Temperature & Humidity Sensor
103 # [48] Akhan 100F14 remote keyless entry
104 # [49] Quhwa
105 # [50] OSv1 Temperature Sensor
106 # [51] Proove
107 # [52] Bresser Thermo-/Hygro-Sensor 3CH
108 # [53] Springfield Temperature and Soil Moisture
109 # [54] Oregon Scientific SL109H Remote Thermal Hygro Sensor
110 # [55] Acurite 606TX Temperature Sensor
111 # [56] TFA pool temperature sensor
112 # [57] Kedsum Temperature & Humidity Sensor
113 # [58] blyss DC5-UK-WH (433.92 MHz)
114 # [59] Steelmate TPMS
115 # [60] Schrader TPMS
116 # [61]* LightwaveRF
117 # [62] Elro DB286A Doorbell
118 # [63] Efergy Optical
119 # [64] Honda Car Key
120 # [65]* Template decoder
121 # [66] Fine Offset Electronics, XC0400
122 # [67] Radiohead ASK
123 # [68] Kerui PIR Sensor
124 # [69] Fine Offset WH1050 Weather Station
125 # [70] Honeywell Door/Window Sensor
126 # [71] Maverick ET-732/733 BBQ Sensor
127 # [72]* RF-tech
128 # [73] LaCrosse TX141TH-Bv2 sensor
129 # [74] Acurite 00275rm,00276rm Temp/Humidity with optional probe
130 # [75] LaCrosse TX35DTH-IT Temperature sensor
131 # [76] LaCrosse TX29IT Temperature sensor
132 # [77] Vaillant calorMatic 340f Central Heating Control
133 # [78] Fine Offset Electronics, WH25 Temperature/Humidity/Pressure Sensor
134 # [79] Fine Offset Electronics, WH0530 Temperature/Rain Sensor
135 # [80] IBIS beacon
136 # [81] Oil Ultrasonic STANDARD FSK
137 # [82] Citroen TPMS
138 # [83] Oil Ultrasonic STANDARD ASK
139 # [84] Thermopro TP11 Thermometer
140 # [85] Solight TE44
141 # [86] Wireless Smoke and Heat Detector GS 558
142 # [87] Generic wireless motion sensor
143 # [88] Toyota TPMS
144 # [89] Ford TPMS
145 # [90] Renault TPMS
146 # [91]* inFactory
147 # [92] FT-004-B Temperature Sensor
148 # [93] Ford Car Key
149 # [94] Philips outdoor temperature sensor
150 # [95] Schrader TPMS EG53MA4
151 # [96] Nexa
152 # [97] Thermopro TP12 Thermometer
153 # [98] GE Color Effects
154 # [99] X10 Security
155 # [100] Interlogix GE UTC Security Devices
156 # [101]* Dish remote 6.3
157 # * Disabled by default, use -R n or -G
158
159 export LANG=C
160 PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
161
162 CONFIG_PATH=/data/options.json
163 MQTT_HOST="$(jq --raw-output '.mqtt_host' $CONFIG_PATH)"
164 MQTT_USER="$(jq --raw-output '.mqtt_user' $CONFIG_PATH)"
165 MQTT_PASS="$(jq --raw-output '.mqtt_password' $CONFIG_PATH)"
166 MQTT_TOPIC="$(jq --raw-output '.mqtt_topic' $CONFIG_PATH)"
167 PROTOCOL="$(jq --raw-output '.protocol' $CONFIG_PATH)"
168 FREQUENCY="$(jq --raw-output '.frequency' $CONFIG_PATH)"
169 GAIN="$(jq --raw-output '.gain' $CONFIG_PATH)"
170 OFFSET="$(jq --raw-output '.frequency_offset' $CONFIG_PATH)"
171
172 # Start the listener and enter an endless loop
173 echo "Starting RTL_433 with parameters:"
174 echo "MQTT Host =" $MQTT_HOST
175 echo "MQTT User =" $MQTT_USER
176 echo "MQTT Password =" $MQTT_PASS
177 echo "MQTT Topic =" $MQTT_TOPIC
178 echo "RTL_433 Protocol =" $PROTOCOL
179 echo "RTL_433 Frequency =" $FREQUENCY
180 echo "RTL_433 Gain =" $GAIN
181 echo "RTL_433 Frequency Offset =" $OFFSET
182
183 #set -x ## uncomment for MQTT logging...
184
185 /usr/local/bin/rtl_433 -F json -R $PROTOCOL -f $FREQUENCY -g $GAIN -p $OFFSET | while read line
186 do
187 DEVICE="$(echo $line | jq --raw-output '.model' | tr -s ' ' '_')" # replace ' ' with '_'
188 DEVICEID="$(echo $line | jq --raw-output '.id' | tr -s ' ' '_')"
189
190 MQTT_PATH=$MQTT_TOPIC
191
192 if [ ${#DEVICE} > 0 ]; then
193 MQTT_PATH=$MQTT_PATH/"$DEVICE"
194 fi
195 if [ ${#DEVICEID} > 0 ]; then
196 MQTT_PATH=$MQTT_PATH/"$DEVICEID"
197 fi
198
199 # Create file with touch /tmp/rtl_433.log if logging is needed
200 [ -w /tmp/rtl_433.log ] && echo $line >> rtl_433.log
201 echo $line | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH
202 done
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/bmclark/hassio-addon

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/bmclark/hassio-addon

Clone this repository using git:
git clone git://git.rocketgit.com/user/bmclark/hassio-addon

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main