Skip to content

Commit

Permalink
TellStick - Added stdin, clarified desc. and config (home-assistant#206)
Browse files Browse the repository at this point in the history
* Added event listener

* Updated version

* Add TellStick Logo

* Update run.sh

* Update config.json

* Update config.json

* Update config.json

* Update config.json

* Variable handling..

* Update run.sh
  • Loading branch information
endor-force authored and pvizeli committed Dec 4, 2017
1 parent 2bc8d29 commit 6143c10
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
15 changes: 12 additions & 3 deletions tellstick/config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "Tellstick",
"version": "0.1",
"name": "TellStick",
"version": "0.2",
"slug": "tellstick",
"description": "Telldus Tellstick daemon and tools.",
"description": "TellStick and TellStick Duo service.",
"url": "https://home-assistant.io/addons/tellstick/",
"startup": "services",
"stdin": "true",
"boot": "auto",
"devices": ["/dev/bus/usb:/dev/bus/usb:rwm"],
"options": {
Expand All @@ -16,6 +17,14 @@
"model": "selflearning-switch",
"house": "A",
"unit": "1"
},
{
"id": 2,
"name": "Example device two",
"protocol": "everflourish",
"model": "selflearning-switch",
"house": "A",
"unit": "2"
}
]
},
Expand Down
Binary file added tellstick/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions tellstick/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,23 @@ for (( i=0; i < "$DEVICES"; i++ )); do
) >> /etc/tellstick.conf
done

echo "[Info] Run telldusd & socat"
echo "[Info] Exposing sockets and loading service"

# Expose the unix socket to internal network
socat TCP-LISTEN:50800,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusClient &
socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents &

# Run telldus-core daemon
exec /usr/local/sbin/telldusd --nodaemon < /dev/null
# Run telldus-core daemon in the background
exec /usr/local/sbin/telldusd --nodaemon < /dev/null &

# 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 failed -> $msg"
fi
done

0 comments on commit 6143c10

Please sign in to comment.