From 3262be13608b8ecf24157448e4b3a1d2bd39ae9b Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:41:31 +0100 Subject: [PATCH] Message if errors https://github.com/alexbelgium/hassio-addons/issues/676 --- .../rootfs/etc/cont-init.d/91-mqtt_autodiscover.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/91-mqtt_autodiscover.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/91-mqtt_autodiscover.sh index e72a3f600..10c719489 100755 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/91-mqtt_autodiscover.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/91-mqtt_autodiscover.sh @@ -12,11 +12,11 @@ if bashio::config.true 'mqtt_autodiscover'; then if ! bashio::services.available "mqtt"; then bashio::exit.nok "No internal MQTT service found. Please install Mosquitto broker"; fi # Get variables bashio::log.info "... MQTT service found, fetching server detail (you can enter those manually in your config file) ..." - export MQTT_HOST=$(bashio::services mqtt "host") - export MQTT_PORT=$(bashio::services mqtt "port") - export MQTT_SSL=$(bashio::services mqtt "ssl") - export MQTT_USERNAME=$(bashio::services mqtt "username") - export MQTT_PASSWORD=$(bashio::services mqtt "password") + export MQTT_HOST=$(bashio::services mqtt "host") || bashio::log.error "can't fetch bashio::services mqtt 'host'" + export MQTT_PORT=$(bashio::services mqtt "port") || bashio::log.error "can't fetch bashio::services mqtt 'port'" + export MQTT_SSL=$(bashio::services mqtt "ssl") || bashio::log.error "can't fetch bashio::services mqtt 'ssl'" + export MQTT_USERNAME=$(bashio::services mqtt "username") || bashio::log.error "can't fetch bashio::services mqtt 'username'" + export MQTT_PASSWORD=$(bashio::services mqtt "password") || bashio::log.error "can't fetch bashio::services mqtt 'password'" # Export variables for variables in "MQTT_HOST=$MQTT_HOST" "MQTT_PORT=$MQTT_PORT" "MQTT_SSL=$MQTT_SSL" "MQTT_USERNAME=$MQTT_USERNAME" "MQTT_PASSWORD=$MQTT_PASSWORD"; do sed -i "1a export $variables" /etc/services.d/*/*run* 2>/dev/null