Stdin does not work with quoting on $input (#208)

* Update config.json

* Update run.sh

* Single quotes.. ?

* Nope..  single quotes did not work

* Splitting on space and putting it back together

Spaced..

* Gosh

* Update run.sh

* Cropping msg

Since we wish to output the results from tdtool in either way (error or regular response) i cropped the catching of output.

* Keep it simple.

* ...

* hmm

* Update run.sh

* Update run.sh

* Update run.sh
This commit is contained in:
endor-force
2017-12-07 13:20:37 +01:00
committed by Pascal Vizeli
parent 81278ce7b0
commit a2f70caa65
2 changed files with 9 additions and 8 deletions

View File

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

View File

@@ -68,13 +68,14 @@ socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents &
# Listen for input to tdtool
echo "[Info] Starting event listener"
while read -r input; do
# removing JSON stuff
input="$(echo "$input" | jq --raw-output '.')"
echo "[Info] Read alias: $input"
if ! msg="$(tdtool "--$input")"; then
echo "[Error] TellStick Command fails -> $msg"
# parse JSON value
funct="$(echo "$input" | jq --raw-output '.function')"
devid="$(echo "$input" | jq --raw-output '.device // empty')"
echo "[Info] Read $funct / $devid"
if ! msg="$(tdtool "--$funct" "$devid")"; then
echo "[Error] TellStick $funct fails -> $msg"
else
echo "[Info] TellStick Command success -> $msg"
echo "[Info] TellStick $funct success -> $msg"
fi
done