From d5263e9b6ef08ccbc3d2503556ab7e11e1ea1176 Mon Sep 17 00:00:00 2001 From: endor-force <1937941+endor-force@users.noreply.github.com> Date: Wed, 6 Dec 2017 11:35:30 +0100 Subject: [PATCH] Fix bash variable input (#207) * Fix bash variable input This will cause error in validation. i have tried with if ! msg="$(tdtool --"$input")"; then if ! msg="$(tdtool --"${input}")"; then if ! msg="$(tdtool --${input})"; then without success. The only one i got working in real life is the one in this PR. * Trying variable with curlies Changed frm only output errors to output all output from tdtool. Enables listing of devices and sensors with output to add-on log. * Update config.json * fix not used exec * fix lint * update output --- tellstick/config.json | 2 +- tellstick/run.sh | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tellstick/config.json b/tellstick/config.json index 7861f2f..0027aeb 100644 --- a/tellstick/config.json +++ b/tellstick/config.json @@ -1,6 +1,6 @@ { "name": "TellStick", - "version": "0.2", + "version": "0.3", "slug": "tellstick", "description": "TellStick and TellStick Duo service.", "url": "https://home-assistant.io/addons/tellstick/", diff --git a/tellstick/run.sh b/tellstick/run.sh index 6cf06d2..ea0a1db 100644 --- a/tellstick/run.sh +++ b/tellstick/run.sh @@ -63,7 +63,7 @@ socat TCP-LISTEN:50800,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusClient & socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents & # Run telldus-core daemon in the background -exec /usr/local/sbin/telldusd --nodaemon < /dev/null & +/usr/local/sbin/telldusd --nodaemon < /dev/null & # Listen for input to tdtool echo "[Info] Starting event listener" @@ -72,7 +72,9 @@ while read -r input; do input="$(echo "$input" | jq --raw-output '.')" echo "[Info] Read alias: $input" - if ! msg="$(tdtool --"$input")"; then - echo "[Error] TellStick Command failed -> $msg" + if ! msg="$(tdtool "--$input")"; then + echo "[Error] TellStick Command fails -> $msg" + else + echo "[Info] TellStick Command success -> $msg" fi done