I have a problem with starting a script from dzvents. The script won't start no matter what I've done so far, even consulting ai hasn't provided a solution. (I end up in a cricel of solutions).
This is my latest version of the script.
Code: Select all
return {
on = {
devices = {
'3d printen'
}
},
logging =
{
level = domoticz.LOG_INFO, -- set to LOG_ERROR when tested and OK
marker = '3D printen',
},
execute = function(domoticz, device)
if device.state== 'On' then
domoticz.devices('3D systeem').switchOn()
end
if device.state== 'Off' then
domoticz.log("3D systeem is shutting down in progres")
--python3 /home/pi/scripts/octopi_shutdown.py (
domoticz.utils.osExecute("/bin/bash octopi_shutdown.sh")
--domoticz.utils.osExecute("ssh [email protected] 'sudo poweroff'")
domoticz.devices('3D systeem').switchOff().afterSec(30)
domoticz.log("3D systeem is down")
end
end
}
domoticz.utils.osExecute("ssh [email protected] 'sudo poweroff'")
worked fine and stopped octopi
What I tried / did:
the two raspberries can log in via ssh without passwords also for the sudo commands no passwords are needed anymore. If I enter "ssh [email protected] 'sudo poweroff'" in a terminal then the octopi.local stops as expected. But not via dzvents. (tried as user pi and root)
tried with python intermediate step. When running this python script from a terminal the octipi.local also stops here but also not via dzvents
You would think it's a rights problem. Domoticz is executed by the owner PI and all rights are set so that the owner pi can access everything and can start all relevant folders and files have the rights 777.
Even after "sudo chmod 777 -R ./home/pi" it doesn't work from dzvents
os.Execute is recognized by domoticz.
Messages from the domoticz log are and remain the same no matter what I do. And I don't get a single message from the scripts, not even that it's running. (the scripts are full of log messages also to log files)
2025-06-15 11:22:26.786 Status: User: Hans (IP: 192.168.0.xxx) initiated a switch command (148/3d printen/Off)
2025-06-15 11:22:26.814 dzVents: Handling events for: "3d printing", value: "Off"
2025-06-15 11:22:26.814 dzVents: 3D printing: 3D system is shutting down in progress
2025-06-15 11:22:26.816 dzVents: 3D printing: 3D system is down
I'm out of options
Anyone have any ideas