LogicMachine Forum
Script not triggering - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Script not triggering (/showthread.php?tid=231)



Script not triggering - zoltan - 29.02.2016

Hello,

I have a couple of this exact script running (8). The total number of scripts is around 60, but most are one or two liners, no timers, wait, delay etc.

All of them are working except this one, the script is enabled and the group address is of the correct data type.
What can I do to clear the problem?

System: CPU/IO: 0.52 0.58 0.57, Memory: 10%, KNX/TP:  OK, error log is empty.


Code:
--SPV_act='15/5/3'                 -- ovdje salje vrijednost SPV --SPV_dan='SPV_TEST_dan'            -- varijabla u koju se sprema dnevni SPV --SPV_noc='SPV_TEST_noc'             -- varijabla u koju se sprema nocni SPV --Vremenski_enabled_var='Vremenski_TEST_enable' -- da li je vremenski program omogucen --Dan_Noc='SPV_TEST_dan_noc'            -- podatak da li je aktivan dnevni ili nocni SPV value = event.getvalue() SPV_act='1/3/1'                                      -- SPV active value sending SPV_dan='SPV_hodnik_kat1_dan'                        -- SPV day SPV_noc='SPV_hodnik_kat1_noc'                        -- SPV night Vremenski_enabled_var='Vremenski_hodnik_kat1_enable' -- Is time scheduler enabled? Dan_Noc='SPV_hodnik_kat1_dan_noc'                    -- Is day or night SPV selected storage.set(Dan_Noc,value) enable_vremenski = storage.get(Vremenski_enabled_var) if (enable_vremenski == true) then    if (value == true) then      my_data = storage.get(SPV_dan)      grp.write(SPV_act, my_data)    storage.set(Dan_Noc,value)     end  if (value == false) then      my_data = storage.get(SPV_noc)      grp.write(SPV_act, my_data)        storage.set(Dan_Noc,value)     end end if (enable_vremenski == false) then  my_data = storage.get(SPV_dan)  grp.write(SPV_act, my_data) end
Thanks


RE: Script not triggering - admin - 29.02.2016

Check what kind of variable you have in 'Vremenski_hodnik_kat1_enable' storage. As you have strict checks against true / false, for example, if your variable is set to 1, it will fail both checks. In Lua (1 == true) and (1 == false) are both false.

For less strict checks, you can add toboolean conversion:
http://openrb.com/docs/lua.htm#toboolean


RE: Script not triggering - zoltan - 29.02.2016

Thanks Admin, you nailed it!

Checked the variable type - the receiving group is "switch", but it's not the problem.

The problem was in the variable name. I deliberately wrote the scripts to be identical with differences in the variable declaration part only. So that I can copy/paste them without errors. Somehow my copy paste didn't worked Sad and ended with different  variable names in two connected scripts.

Stupid error, should found it myself on the first run, heh!