rtlamr addon improvements
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "RTLAMR to MQTT Bridge",
|
"name": "RTLAMR to MQTT Bridge",
|
||||||
"version": "0.1.13",
|
"version": "0.1.14",
|
||||||
"slug": "rtlamr",
|
"slug": "rtlamr",
|
||||||
"description": "RF to MQTT Bridge based on RTL_SDR/RTL_433 for RTL2832U based DVB-T USB tuners",
|
"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",
|
"url": "https://github.com/bvlaicu/home-assistant-addons/tree/master/rtlamr",
|
||||||
|
|||||||
+5
-7
@@ -31,8 +31,6 @@ echo "Meter IDs =" $METER_IDS
|
|||||||
# Sleep to fill buffer a bit
|
# Sleep to fill buffer a bit
|
||||||
sleep 15
|
sleep 15
|
||||||
|
|
||||||
LASTVAL="0"
|
|
||||||
|
|
||||||
# set a time to listen for. Set to 0 for unliminted
|
# set a time to listen for. Set to 0 for unliminted
|
||||||
|
|
||||||
#tail -f /dev/null
|
#tail -f /dev/null
|
||||||
@@ -55,14 +53,14 @@ while true; do
|
|||||||
VAL="$(echo $line | jq --raw-output '.Message.Consumption' | tr -s ' ' '_')" # replace ' ' with '_'
|
VAL="$(echo $line | jq --raw-output '.Message.Consumption' | tr -s ' ' '_')" # replace ' ' with '_'
|
||||||
METERID="$(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 ' ' '_')"
|
MSGTYPE="$(echo $line | jq --raw-output '.Type' | tr -s ' ' '_')"
|
||||||
MQTT_PATH="rtlamr/$METERID/reading"
|
MQTT_PATH="rtlamr/$METERID"
|
||||||
|
|
||||||
# Create file with touch /var/log/rtl_433.log if logging is needed
|
# 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
|
[ -w /var/log/rtl_433.log ] && echo $line >> /var/log/rtl_433.log
|
||||||
if [ "$VAL" != "$LASTVAL" ]; then
|
|
||||||
echo $VAL | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH
|
# Publish to MQTTT
|
||||||
LASTVAL=$VAL
|
echo $VAL | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH/reading
|
||||||
fi
|
echo $MSGTYPE | /usr/bin/mosquitto_pub -h $MQTT_HOST -u $MQTT_USER -P $MQTT_PASS -i RTL_433 -r -l -t $MQTT_PATH/type
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user