From 949ffa25d36168c0de3779c49c0b3349d7e010b8 Mon Sep 17 00:00:00 2001 From: Bogdan Vlaicu Date: Thu, 7 May 2020 17:47:30 -0400 Subject: [PATCH] rtlamr fix for missing msg type id --- rtlamr/README.md | 6 +++--- rtlamr/config.json | 7 +++---- rtlamr/run.sh | 5 ++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/rtlamr/README.md b/rtlamr/README.md index 2921db3..9e0ea89 100755 --- a/rtlamr/README.md +++ b/rtlamr/README.md @@ -33,15 +33,15 @@ 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 +The `msg_type` option defines the comma-separated list of message types to be processed: all, scm, scm+, idm, netidm, r900 and r900bcd -Default value: all +If a value is not provided, all message types will be processed ### Option: `meter_ids` The `meter_ids` option defines the comma-separated list of meter ids to be processed -If missing or empty, all found meters will be processed +If a value is not provided, all found meters will be processed ## MQTT Data diff --git a/rtlamr/config.json b/rtlamr/config.json index 4be675f..f579225 100755 --- a/rtlamr/config.json +++ b/rtlamr/config.json @@ -1,6 +1,6 @@ { "name": "RTLAMR to MQTT Bridge", - "version": "0.1.12", + "version": "0.1.13", "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", @@ -25,15 +25,14 @@ { "mqtt_host": "hassio.local", "mqtt_user": "", - "mqtt_password": "", - "msg_type": "all" + "mqtt_password": "" }, "schema": { "mqtt_host": "str", "mqtt_user": "str", "mqtt_password": "str", - "msg_type": "str", + "msg_type": "str?", "meter_ids":"str?" } } diff --git a/rtlamr/run.sh b/rtlamr/run.sh index aa9add7..a1aa95f 100755 --- a/rtlamr/run.sh +++ b/rtlamr/run.sh @@ -11,7 +11,7 @@ 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)" -MSG_TYPE="$(jq --raw-output '.msg_type' $CONFIG_PATH)" +MSG_TYPE="$(jq --raw-output '.msg_type // empty' $CONFIG_PATH)" METER_IDS="$(jq --raw-output '.meter_ids // empty' $CONFIG_PATH)" @@ -37,6 +37,9 @@ LASTVAL="0" #tail -f /dev/null +if [ -z ${MSG_TYPE+x} ] || [${MSG_TYPE} = ""]; then + MSG_TYPE="all" +fi if [ -z ${METER_IDS+x} ] || [${METER_IDS} = ""]; then ID_FILTER_OPTION=""