mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-18 21:54:20 +01:00
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:
committed by
Pascal Vizeli
parent
81278ce7b0
commit
a2f70caa65
@@ -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/",
|
||||
|
||||
@@ -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"
|
||||
# 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 "--$input")"; then
|
||||
echo "[Error] TellStick Command fails -> $msg"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user