I am making a script. The intention is that when the switch goes off, it first stops another raspberry in the network. and then turn off another switch about 30 sec later.
In itself a fairly simple script.
The problem lies in controlling the other raspberry. the raspberry where domoticz runs on can control the other raspberry by ssh, to do that I created an ssh keypair.
the command
ssh [email protected] 'sudo poweroff'
works fine and the remote raspberry is actually stopped
When this command is processed in a dzevents script it will no longer work. Does anyone have any idea to get this working.
the script i wrote:
Code: Select all
return {
on = {
devices = {
'3d printen'
}
},
execute = function(domoticz, device)
if device.state== 'Off' then
domoticz.utils.osExecute("ssh [email protected] 'sudo poweroff'")
domoticz.log("shutting down in 30 sec")
domoticz.devices(139).switchOff().afterSec(30)
end
end
}