What’s wrong with my first LUA script?

Moderator: leecollings

Post Reply
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

What’s wrong with my first LUA script?

Post 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 853 times
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

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

Post by Jan Jansen »

Stupid my topic was not ready

Next blockley is not working.
Knipsel 1.PNG
Knipsel 1.PNG (47.13 KiB) Viewed 850 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 850 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
User avatar
jvdz
Posts: 2334
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

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

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

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

Post by Jan Jansen »

Hello Jos,

Thanks for your quick reply.

I changed the script.
Knipsel 4.PNG
Knipsel 4.PNG (95.91 KiB) Viewed 822 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 822 times
Using blockley the selector switches as expected.

Jan
User avatar
jvdz
Posts: 2334
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

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

Post 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

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

Post by Jan Jansen »

Hello Jos,

Thanks a lot.

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

Jan
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest