Page 1 of 1

Dummy switch won't turn on

Posted: Monday 17 July 2017 0:47
by tapas
Hello, I've been pulling my hair off over this seemingly very simple script that should turn a dummy switch (idx 22) on:

Code: Select all

commandArray = {}
commandArray['UpdateDevice'] = '22|1|On'
I'm trying to run it from linux shell lua script.lua with no luck, what am I missing?

Dummy switch won't turn on

Posted: Monday 17 July 2017 1:43
by pvm
It seems to be missing
'return commandArray'

For examples check the wiki

Re: Dummy switch won't turn on

Posted: Monday 17 July 2017 2:04
by tapas
Thanks for the reply, I added that but still no luck :(

Re: Dummy switch won't turn on

Posted: Monday 17 July 2017 9:13
by mivo
tapas wrote:I'm trying to run it from linux shell lua script.lua with no luck, what am I missing?
Hi,

starting LUA script from Linux shell will not work, there is no Domoticz API available. You should create script in designated folder and correct name - in subfolder of domoticz installation: scripts/lua. Then scrips are started by Domoticz event system.

Look at this, there are good examples:
https://www.domoticz.com/wiki/Events#By ... ion_folder.

Re: Dummy switch won't turn on

Posted: Monday 17 July 2017 10:13
by tapas
mivo wrote:
tapas wrote:I'm trying to run it from linux shell lua script.lua with no luck, what am I missing?
Hi,

starting LUA script from Linux shell will not work, there is no Domoticz API available. You should create script in designated folder and correct name - in subfolder of domoticz installation: scripts/lua. Then scrips are started by Domoticz event system.

Look at this, there are good examples:
https://www.domoticz.com/wiki/Events#By ... ion_folder.
Yes, it works now, thank you! One of my problem was that script names were wrong. Should have read that wiki better.