run a lua script on scene execution Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

run a lua script on scene execution

Post by paede »

My next question is about running a lua script I use to shutdown my media-pc.
On the pc I habe MCE Controller running.
The following lua code was run by vera in a scene and it worked.

Code: Select all

function shutDown(host)
	local socket = require("socket")
	c = assert(socket.connect(host, 5150))
	c:send("hibernate\r")
	c:close()
end

luup.call_delay("shutDown", 0, "192.168.0.3")
I made a textfile with that code in /home/pi/domoticz/scripts/ with the name 'Computer_shutdown.lua'
I made a scene that runs this script (On Action: script://Computer_shutdown.lua)

the log shows this:
2020-07-31 20:36:36.889 Status: User: Admin initiated a scene/group command
2020-07-31 20:36:37.101 Status: Executing script: /home/pi/domoticz/scripts/Computer_shutdown.lua
2020-07-31 20:36:37.121 Error: Error executing script command (/home/pi/domoticz/scripts/Computer_shutdown.lua). returned: 32256

I don't have any knowledge about lua programming. I found this code on the vera forum and used it.

Do you have any suggestions?
Greets
paede
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: run a lua script on scene execution

Post by paede »

I guess I try it with samba and "net rpc shutdown". (https://de.wikihow.com/Remote-einen-Com ... nterfahren)
I hope that works.
paede
Posts: 17
Joined: Tuesday 28 July 2020 13:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: run a lua script on scene execution

Post by paede »

I used net rpc shutdown as mentioned before.
On the rpi i made a textfile shutdown.sh with the "net rpc shutdown" command in it.
In Domoticz I run the script when a scene is executed.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest