Page 1 of 1

What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 16:12
by Jan Jansen
Blockley has its limitations. I have therefore started to work with LUA.
Domoticz generates the needed user variables (copy/paste from WIKI user variables).
Knipsel 2.PNG
Knipsel 2.PNG (71.57 KiB) Viewed 856 times

Re: What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 16:17
by Jan Jansen
Stupid my topic was not ready

Next blockley is not working.
Knipsel 1.PNG
Knipsel 1.PNG (47.13 KiB) Viewed 853 times
The selector only responds if the variable season is adjusted via the web interface. (as described on the forum. LUA in combination with Blockley causes problems). Therefore, a first attempt with a LUA script.
Knipsel2.PNG
Knipsel2.PNG (60.98 KiB) Viewed 853 times
I'm looking for help because my first LUA script does not work. Who can point me in the right direction.


Thanks in advance

Re: What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 16:37
by jvdz
Jan,
The Set level command is wrong and should read: 'Set Level 10'.
One other thing to remember is that each time a Variable is changed via the Web interface or JSON, this script will run and set the ventilatie to the set level.

Jos

Re: What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 20:37
by Jan Jansen
Hello Jos,

Thanks for your quick reply.

I changed the script.
Knipsel 4.PNG
Knipsel 4.PNG (95.91 KiB) Viewed 825 times
Then I clicked on the line Season (user variables) and at last I clicked the button adjust. I expected that the selector switches from "Normaal" to "Zomer" but nothing happens, even in the log.
Knipsel3.PNG
Knipsel3.PNG (28.76 KiB) Viewed 825 times
Using blockley the selector switches as expected.

Jan

Re: What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 20:52
by jvdz
Have you made the LUA script with the internal Editor or is it a File in the Lua directory?
In the latter case the name of the file is important and should be: script_variable_xxxxxx.lua.

Jos

Re: What’s wrong with my first LUA script?

Posted: Monday 27 June 2016 21:43
by Jan Jansen
Hello Jos,

Thanks a lot.

The name of the file was the clue. Now every thing works as desired.

Jan