Lua script not triggered anymore

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post
Post Reply
Thomasdc
Posts: 236
Joined: Wednesday 11 March 2015 20:13
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Lua script not triggered anymore

Post by Thomasdc » Thursday 12 October 2017 19:08

Hi all!

I have a script that used to work,
but now (since a while, but didnt had the time to look for it sooner) its not working anymore

i have a multi selector switch for my outdoor lightning:
(on - off- motion)

but the script isn't executed anymore and i dont know why..
the script is made in LUA in the 'events' web interface of domoticz, its set as "device" and the event is active..

here is the code (but i dont think the problem is in the code..)
Spoiler: show

Code: Select all

-- script_device_motion.lua
local Switch_Phares = 'Phares' --status
local Switch_Night_Time_Phares = 'Night_Time_Phares' -- night
local Switch_Motion = 'SomeoneHome' -- Motion

local Switch_Q_Phares = '$Q_Phares'  -- phares (lights) hulpcontact
local Switch_Q_Phare_1 = '$Phares_1'
local Switch_Q_Phare_2 = '$Phares_2'
 
commandArray = {}
 
if devicechanged[Switch_Phares] then
	if otherdevices[Switch_Phares] == 'Off' then
 	   commandArray[Switch_Q_Phares]='Off'
 	elseif otherdevices[Switch_Phares] == 'On' then
 	    commandArray[Switch_Q_Phares]='On'
 	 elseif otherdevices[Switch_Phares] == 'Beweging' and otherdevices[Switch_Motion] == 'Off' then
 	    commandArray[Switch_Q_Phares]='Off'   
    end
end

if devicechanged[Switch_Motion] then
        if otherdevices[Switch_Motion] == 'On' and otherdevices[Switch_Phares] == 'Beweging' and otherdevices[Switch_Night_Time_Phares] == 'On' then
         commandArray[Switch_Q_Phares]='On'
     elseif otherdevices[Switch_Motion] == 'Off' and otherdevices[Switch_Phares] == 'Beweging' and otherdevices[Switch_Night_Time_Phares] == 'On' then
         commandArray[Switch_Q_Phares]='Off'
     elseif  otherdevices[Switch_Motion] == 'Off' and otherdevices[Switch_Phares] == 'Beweging' and otherdevices[Switch_Night_Time_Phares] == 'Off' then
         commandArray[Switch_Q_Phares]='Off'
    end
end
 
if devicechanged[Switch_Night_Time_Phares] then
    if otherdevices[Switch_Night_Time_Phares] == 'On' and otherdevices[Switch_Motion] == 'On' and otherdevices[Switch_Phares] == 'Beweging' then
         commandArray[Switch_Q_Phares]='On'
    elseif otherdevices[Switch_Night_Time_Phares] == 'Off' and otherdevices[Switch_Motion] == 'On' and otherdevices[Switch_Phares] == 'Beweging' then
           commandArray[Switch_Q_Phares]='Off'
     end
end

if devicechanged[Switch_Q_Phares] then
    if otherdevices[Switch_Q_Phares] == 'On' then
     commandArray[Switch_Q_Phare_1]='On'   
     commandArray[Switch_Q_Phare_2]='On'   
 elseif otherdevices[Switch_Q_Phares] == 'Off' then
      commandArray[Switch_Q_Phare_1]='Off'   
     commandArray[Switch_Q_Phare_2]='Off'
 end
end
 print ("pharestest")

    
return commandArray
I hope someone can help me with this

User avatar
jannl
Posts: 902
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: Lua script not triggered anymore

Post by jannl » Thursday 12 October 2017 22:13

Do other scripts still work?

Thomasdc
Posts: 236
Joined: Wednesday 11 March 2015 20:13
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Lua script not triggered anymore

Post by Thomasdc » Friday 13 October 2017 18:40

no, other scripts dont work neither...
blocky scripts neither..

--> found it, it was a switch in the settings that i needed to turn on!
Thanks!

Post Reply

Who is online

Users browsing this forum: FAnl and 6 guests