mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-19 06:04:21 +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",
|
"name": "TellStick",
|
||||||
"version": "0.3",
|
"version": "0.4",
|
||||||
"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/",
|
||||||
|
|||||||
@@ -68,13 +68,14 @@ socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents &
|
|||||||
# Listen for input to tdtool
|
# Listen for input to tdtool
|
||||||
echo "[Info] Starting event listener"
|
echo "[Info] Starting event listener"
|
||||||
while read -r input; do
|
while read -r input; do
|
||||||
# removing JSON stuff
|
# parse JSON value
|
||||||
input="$(echo "$input" | jq --raw-output '.')"
|
funct="$(echo "$input" | jq --raw-output '.function')"
|
||||||
echo "[Info] Read alias: $input"
|
devid="$(echo "$input" | jq --raw-output '.device // empty')"
|
||||||
|
echo "[Info] Read $funct / $devid"
|
||||||
|
|
||||||
if ! msg="$(tdtool "--$input")"; then
|
if ! msg="$(tdtool "--$funct" "$devid")"; then
|
||||||
echo "[Error] TellStick Command fails -> $msg"
|
echo "[Error] TellStick $funct fails -> $msg"
|
||||||
else
|
else
|
||||||
echo "[Info] TellStick Command success -> $msg"
|
echo "[Info] TellStick $funct success -> $msg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user