Here is the script, it runs fine in the cli.
Code: Select all
#!/bin/bash
Host=127.0.0.1
case $1 in
Off)
mosquitto_pub -h $Host -t zigbee2mqtt/Tuin/set -m "{\"state\":\"Off\"}"
;;
On)
mosquitto_pub -h $Host -t zigbee2mqtt/Tuin/set -m "{\"brightness\":130,\"state\":\"On\"}"
mosquitto_pub -h $Host -t zigbee2mqtt/Tuin/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
;;
Default)
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 1/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 2/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 3/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 1/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 2/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 3/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 4/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 5/set -m "{\"color\":{\"x\":0.46400,\"y\":0.41149}}"
;;
Vlag)
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 1/set -m "{\"color\":{\"x\":0.64000,\"y\":0.33000}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 2/set -m "{\"color\":{\"x\":0.31273,\"y\":0.32902}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 3/set -m "{\"color\":{\"x\":0.15000,\"y\":0.06000}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 1/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 2/set -m "{\"color\":{\"x\":0.15000,\"y\":0.06000}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 3/set -m "{\"color\":{\"x\":0.31273,\"y\":0.32902}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 4/set -m "{\"color\":{\"x\":0.64000,\"y\":0.33000}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 5/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
;;
Oranje)
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 1/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 2/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ voortuin\ 3/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 1/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 2/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 3/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 4/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
mosquitto_pub -h $Host -t zigbee2mqtt/Lamp\ achtertuin\ 5/set -m "{\"color\":{\"x\":0.54299,\"y\":0.40704}}"
;;
*)
echo don\'t know
;;
esac
Code: Select all
2022-11-12 08:55:33.695 Schakelaars: Light/Switch (Tuinverlichting keuze)
2022-11-12 08:55:33.690 Status: User: Admin (IP: 192.168.1.11) initiated a switch command (808/Tuinverlichting keuze/Set Level)
2022-11-12 08:55:33.925 Status: Executing script: /home/pi/domoticz/scripts/changelights.sh
2022-11-12 08:55:56.812 Schakelaars: Light/Switch (Tuinverlichting keuze)
2022-11-12 08:55:56.807 Status: User: Admin (IP: 192.168.1.11) initiated a switch command (808/Tuinverlichting keuze/Set Level)
2022-11-12 08:55:57.044 Status: Executing script: /home/pi/domoticz/scripts/changelights.sh
2022-11-12 08:55:57.050 Error: Error executing script command (/home/pi/domoticz/scripts/changelights.sh). returned: 32512