From d013a961f8bab7131418c9e4f7ecec018080eea6 Mon Sep 17 00:00:00 2001 From: Kevin Read Date: Mon, 23 Oct 2023 14:32:11 +0200 Subject: [PATCH] fix: Fix missing null check for device_topic_suffix config read in next, fixes #155, #159 --- rtl_433_mqtt_autodiscovery/config.json | 2 ++ rtl_433_mqtt_autodiscovery/run.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rtl_433_mqtt_autodiscovery/config.json b/rtl_433_mqtt_autodiscovery/config.json index 17c77d24..cb71be53 100644 --- a/rtl_433_mqtt_autodiscovery/config.json +++ b/rtl_433_mqtt_autodiscovery/config.json @@ -16,6 +16,7 @@ "mqtt_password": "", "mqtt_retain": false, "rtl_topic": "rtl_433/+/events", + "device_topic_suffix": "", "discovery_prefix": "homeassistant", "discovery_interval": 600, "force_update": false, @@ -28,6 +29,7 @@ "mqtt_password": "str?", "mqtt_retain": "bool", "rtl_topic": "str", + "device_topic_suffix": "str?", "discovery_prefix": "str", "discovery_interval": "int", "force_update": "bool", diff --git a/rtl_433_mqtt_autodiscovery/run.sh b/rtl_433_mqtt_autodiscovery/run.sh index 0cea35ab..61a85e20 100755 --- a/rtl_433_mqtt_autodiscovery/run.sh +++ b/rtl_433_mqtt_autodiscovery/run.sh @@ -42,8 +42,8 @@ else OTHER_ARGS="${OTHER_ARGS} --force_update" fi # This is an optional parameter and we don't want to overwrite the defaults - DEVICE_TOPIC_SUFFIX=$(bashio::config "device_topic_suffix") - if [ ! -z $DEVICE_TOPIC_SUFFIX ]; then + if bashio::config.has_value "device_topic_suffix"; then + DEVICE_TOPIC_SUFFIX=$(bashio::config "device_topic_suffix") OTHER_ARGS="${OTHER_ARGS} -T ${DEVICE_TOPIC_SUFFIX}" fi