rtlamr improvements
This commit is contained in:
@@ -11,8 +11,6 @@ FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
MAINTAINER bvlaicu
|
||||
|
||||
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"
|
||||
|
||||
#
|
||||
@@ -40,15 +38,6 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
|
||||
|
||||
RUN go get github.com/bemasher/rtlamr
|
||||
|
||||
#
|
||||
# Define an environment variable
|
||||
#
|
||||
# Use this variable when creating a container to specify the MQTT broker host.
|
||||
ENV MQTT_HOST="hassio.local"
|
||||
ENV MQTT_USER="guest"
|
||||
ENV MQTT_PASS="guest"
|
||||
ENV MQTT_TOPIC="homeassistant/sensor/rtl433"
|
||||
|
||||
ADD ./run.sh /run.sh
|
||||
|
||||
CMD cd / && chmod +x /run.sh && /run.sh
|
||||
+32
-34
@@ -1,56 +1,54 @@
|
||||
# RTLAMR to MQTT Bridge hass.io addon
|
||||
A hass.io addon for a software defined radio tuned to listen for 433MHz RF transmissions and republish the data via MQTT
|
||||
|
||||
This hassio addon is based on biochemguy's (non-docker) setup: https://community.home-assistant.io/t/get-your-smart-electric-water-and-gas-meter-scm-readings-into-home-assistant-with-a-rtl-sdr
|
||||
This addon is based on the addon from jdeath here: https://github.com/jdeath/RTLAMR2MQQT
|
||||
which in tturn is based on James Fry' project here: https://github.com/james-fry/hassio-addons/tree/master/rtl4332mqtt
|
||||
which is based on biochemguy's (non-docker) setup: https://community.home-assistant.io/t/get-your-smart-electric-water-and-gas-meter-scm-readings-into-home-assistant-with-a-rtl-sdr
|
||||
which in turn is based on James Fry' project here: https://github.com/james-fry/hassio-addons/tree/master/rtl4332mqtt
|
||||
which was based on Chris Kacerguis' project here: https://github.com/chriskacerguis/honeywell2mqtt,
|
||||
which is in turn based on Marco Verleun's rtl2mqtt image here: https://github.com/roflmao/rtl2mqtt
|
||||
|
||||
## Usage
|
||||
## Configuration
|
||||
|
||||
1) Install the addon. Do this by downloading this repository and adding in a folder under /addons/ (eg. /addons/rtlamr2mqtt)
|
||||
Add-on configuration example:
|
||||
|
||||
2) Use addon configuration to configure:
|
||||
- mqtt_host
|
||||
- mqtt_user
|
||||
- mqtt_password
|
||||
- msgType
|
||||
- ids
|
||||
```yaml
|
||||
mqtt_host: hassio.local
|
||||
mqtt_user: mqtt
|
||||
mqtt_password: '!secret mqtt_password'
|
||||
msg_type: all
|
||||
meter_ids: '1487813232,15527764'
|
||||
```
|
||||
|
||||
3) Copy rtl2mqtt.sh to your hass.io config dir in a subdir called rtlamr2mqtt.
|
||||
i.e.
|
||||
.../config/rtlamr2mqtt/rtl2mqtt.sh
|
||||
This allows you to edit the start script if you need to make any changes
|
||||
### Option: `mqtt_user`
|
||||
|
||||
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.
|
||||
The `mqtt_host` option defines the hostname or ip of the MQTT server
|
||||
|
||||
### Option: `mqtt_user`
|
||||
|
||||
4) Start the addon
|
||||
The `mqtt_user` option defines the username for the MQTT server
|
||||
|
||||
### Option: `mqtt_password`
|
||||
|
||||
The `mqtt_password` option defines the password for the MQTT server
|
||||
|
||||
### Option: `msg_type`
|
||||
|
||||
The `msg_type` option defines the comma-separated list of message types to receive all, scm, scm+, idm, netidm, r900 and r900bcd
|
||||
|
||||
Default value: all
|
||||
|
||||
### Option: `meter_ids`
|
||||
|
||||
The `meter_ids` option defines the comma-separated list of meter ids to be processed
|
||||
|
||||
Optional. If not provided, all found meters will be processed
|
||||
|
||||
## MQTT Data
|
||||
|
||||
Data to the MQTT server is based on biochemguy setup: readings/$DEVICEID/meter_reading
|
||||
Topic: rtlamr/<METER_ID>/meter_reading
|
||||
|
||||
## Hardware
|
||||
|
||||
This has been tested and used with the following hardware (you can get it on Amazon)
|
||||
This add-on has been tested and used with the following hardware
|
||||
|
||||
- NooElec NESDR Nano 2+ Tiny Black RTL-SDR USB
|
||||
- RTL-SDR Blog R820T2 RTL2832U 1PPM TCXO SMA Software Defined Radio
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you see this error:
|
||||
|
||||
> Kernel driver is active, or device is claimed by second instance of librtlsdr.
|
||||
> In the first case, please either detach or blacklist the kernel module
|
||||
> (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
|
||||
|
||||
Then run the following command on the host
|
||||
|
||||
```bash
|
||||
sudo rmmod dvb_usb_rtl28xxu rtl2832
|
||||
```
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "RTLAMR to MQTT Bridge",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"slug": "rtlamr",
|
||||
"description": "RF to MQTT Bridge based on RTL_SDR/RTL_433 for RTL2832U based DVB-T USB tuners",
|
||||
"url": "https://github.com/bvlaicu/home-assistant-addons/tree/master/rtlamr",
|
||||
@@ -26,15 +26,15 @@
|
||||
"mqtt_host": "hassio.local",
|
||||
"mqtt_user": "",
|
||||
"mqtt_password": "",
|
||||
"msgType": "all",
|
||||
"ids": ""
|
||||
"msg_type": "all",
|
||||
"meter_ids": ""
|
||||
},
|
||||
"schema":
|
||||
{
|
||||
"mqtt_host": "str",
|
||||
"mqtt_user": "str",
|
||||
"mqtt_password": "str",
|
||||
"msgType": "list(all|scm|scm+|idm|netidm|r900|r900bcd)",
|
||||
"ids":"str?"
|
||||
"msg_type": "str",
|
||||
"meter_ids":"str?"
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -5,14 +5,14 @@ PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
|
||||
|
||||
echo "/usr/local/lib64/" > /etc/ld.so.conf
|
||||
export LD_LIBRARY_PATH=/usr/local/lib64/
|
||||
touch /var/log/rtl_433.log
|
||||
# touch /var/log/rtl_433.log
|
||||
|
||||
CONFIG_PATH=/data/options.json
|
||||
MQTT_HOST="$(jq --raw-output '.mqtt_host' $CONFIG_PATH)"
|
||||
MQTT_USER="$(jq --raw-output '.mqtt_user' $CONFIG_PATH)"
|
||||
MQTT_PASS="$(jq --raw-output '.mqtt_password' $CONFIG_PATH)"
|
||||
MQTT_MSGTYPE="$(jq --raw-output '.msgType' $CONFIG_PATH)"
|
||||
MQTT_IDS="$(jq --raw-output '.ids' $CONFIG_PATH)"
|
||||
MQTT_MSGTYPE="$(jq --raw-output '.msg_type' $CONFIG_PATH)"
|
||||
MQTT_IDS="$(jq --raw-output '.meter_ids' $CONFIG_PATH)"
|
||||
|
||||
|
||||
# Start the listener and enter an endless loop
|
||||
@@ -50,9 +50,9 @@ while true; do
|
||||
|
||||
do
|
||||
VAL="$(echo $line | jq --raw-output '.Message.Consumption' | tr -s ' ' '_')" # replace ' ' with '_'
|
||||
DEVICEID="$(echo $line | jq --raw-output '.Message.ID' | tr -s ' ' '_')"
|
||||
METERID="$(echo $line | jq --raw-output '.Message.ID' | tr -s ' ' '_')"
|
||||
MSGTYPE="$(echo $line | jq --raw-output '.Type' | tr -s ' ' '_')"
|
||||
MQTT_PATH="rtlamr/$DEVICEID/meter_reading"
|
||||
MQTT_PATH="rtlamr/$METERID/reading"
|
||||
|
||||
# Create file with touch /var/log/rtl_433.log if logging is needed
|
||||
[ -w /var/log/rtl_433.log ] && echo $line >> /var/log/rtl_433.log
|
||||
|
||||
Reference in New Issue
Block a user