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
This commit is contained in:
endor-force
2017-12-06 11:35:30 +01:00
committed by Pascal Vizeli
parent e2e2a76a61
commit d5263e9b6e
2 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "TellStick", "name": "TellStick",
"version": "0.2", "version": "0.3",
"slug": "tellstick", "slug": "tellstick",
"description": "TellStick and TellStick Duo service.", "description": "TellStick and TellStick Duo service.",
"url": "https://home-assistant.io/addons/tellstick/", "url": "https://home-assistant.io/addons/tellstick/",

View File

@@ -63,7 +63,7 @@ socat TCP-LISTEN:50800,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusClient &
socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents & socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents &
# Run telldus-core daemon in the background # 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 # Listen for input to tdtool
echo "[Info] Starting event listener" echo "[Info] Starting event listener"
@@ -72,7 +72,9 @@ while read -r input; do
input="$(echo "$input" | jq --raw-output '.')" input="$(echo "$input" | jq --raw-output '.')"
echo "[Info] Read alias: $input" echo "[Info] Read alias: $input"
if ! msg="$(tdtool --"$input")"; then if ! msg="$(tdtool "--$input")"; then
echo "[Error] TellStick Command failed -> $msg" echo "[Error] TellStick Command fails -> $msg"
else
echo "[Info] TellStick Command success -> $msg"
fi fi
done done