run script with parameter from switch or switch selector error 32512 Topic is solved

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

run script with parameter from switch or switch selector error 32512

Post by Xenomes »

I am struggling with a script to get it running from a selector switch with parameter it keeps error out on 32512.

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
setup in Domoticz 2022.2 in the selector switch i use this command 'script://changelights.sh On' (On, Off, Default, Vlag or Oranje)
2022-11-12 10_34_10-Domoticz - Devices_808_LightEdit – Mozilla Firefox.png
2022-11-12 10_34_10-Domoticz - Devices_808_LightEdit – Mozilla Firefox.png (363.49 KiB) Viewed 2051 times
As test I create a script line without a parameter then there is no error.

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
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
User avatar
Xenomes
Posts: 379
Joined: Tuesday 27 November 2018 19:05
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: run script with parameter from switch or switch selector error 32512

Post by Xenomes »

Problem Solved! The answer is easy afterwards the code 32512 meen kinda 'file not found' or 'executable not found'
I have installed mosquitto by Snap for some reason Domoticz can't run or find mosquitto_pub executable and on the CLI give no problem.
But after editing my file and changed mosquitto_pub to /snap/bin/mosquitto_pub the script runs fine now!
Hope it helps others to solve running scrips issues.
HP T630 (32GB SSD/8GB Mem) - Ubuntu 22.04.4 LTS (64Bit) - Domoticz 2024.7 with Machinon theme - RFLink - KaKu - Sonoff - Tasmota - Shelly - MQTT2Zigbee - OpenTherm Gateway - Tinytuya - IR Blaster - P1 Smart Meter - NPN Watermeter - Google Assistant
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest