diff --git a/tellstick/config.json b/tellstick/config.json index 0aee192..7861f2f 100644 --- a/tellstick/config.json +++ b/tellstick/config.json @@ -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": { @@ -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" } ] }, diff --git a/tellstick/logo.png b/tellstick/logo.png new file mode 100644 index 0000000..4ebc3ec Binary files /dev/null and b/tellstick/logo.png differ diff --git a/tellstick/run.sh b/tellstick/run.sh index 82cb263..6cf06d2 100644 --- a/tellstick/run.sh +++ b/tellstick/run.sh @@ -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