Page 1 of 1

Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 15:08
by deve87
I want to run

Code: Select all

commandArray['Door bell'] = 'On AFTER 5'
commandArray['Door bell'] = 'On AFTER 7'
If I try

Code: Select all

commandArray[1]={['Door bell'] = 'On AFTER 5'}
commandArray[2]={['Door bell'] = 'On AFTER 7'}
It only execute the first [1] line

How can I do this?

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 15:56
by waaren
deve87 wrote: Sunday 09 June 2019 15:08 I want to run
  • Door bell On after 5 seconds
  • Door bell On after 7 seconds
How can I do this?

Code: Select all

    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 5 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 7 SECONDS' }

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 16:05
by deve87
Yes also tried that. Same result :cry:

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 16:28
by waaren
deve87 wrote: Sunday 09 June 2019 16:05 Yes also tried that. Same result :cry:
:?: Should work :!: What do you see in the log ? Can you share the complete script. It might just help in finding the issue
I tested with this Lua (V4.10881)

Code: Select all

commandArray = {}

    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 5 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 7 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 9 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 11 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 13 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 15 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 17 SECONDS' }
    commandArray[#commandArray + 1] = {['Door bell'] ='On AFTER 19 SECONDS' }
    
return commandArray
relevant domoticz log

Code: Select all

2019-06-09 16:16:06.036  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:08.056  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:10.035  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:12.057  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:14.041  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:16.066  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:18.045  (Virtual) Light/Switch (Door bell)
2019-06-09 16:16:20.044  (Virtual) Light/Switch (Door bell)
Door bell.png
Door bell.png (141.66 KiB) Viewed 1078 times

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 16:45
by deve87
I haven't actually tried with SECONDS behind. Shall trie that and post back

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 18:10
by deve87
Ok. It don't work. Only triggers one line

Code: Select all

commandArray = {}
if uservariables['Multimedia'] == 0 and otherdevices['Se På Data'] == 'On' then
    commandArray[#commandArray + 1] = {['TV Source'] = 'On AFTER 1 SECONDS' }
    commandArray[#commandArray + 1] = {['TV Source'] = 'On AFTER 3 SECONDS' }
end

if otherdevices['Se På Data'] == 'On' then
    commandArray['Se På Data'] = 'Off'
end
return commandArray
Running stabel V4.10717

Re: Execute same switch On / On AFTER xx

Posted: Sunday 09 June 2019 18:42
by deve87
I figur it out. I had a second scripts setting the device to Off if it becomes On. If I disabled that, it works.