Page 1 of 1
Total noob on lua scripting, where to start ?
Posted: Sunday 16 April 2017 13:42
by tontze
HI !
Im total noob with lua, python etc. I would like to start LUA to get more control on my devices. Can someone suggest where to start, some very well commented scripts or something ?
Thanks !
-T
Re: Total noob on lua scripting, where to start ?
Posted: Sunday 16 April 2017 17:32
by Plaagje
I suggest you take a look at the demo scripts and change then and see what happens, check the log when you have changed something so you can see any mistakes you make such as punctuation errors..
The wiki has a lot of scripts with good explanation.
Basically you have to do it and experience programming. Lua is a lot like python.
Remember to make a backup of your system before you are going to experiment on it
-Plaagje
Sent from my Nexus 5X using Tapatalk
Re: Total noob on lua scripting, where to start ?
Posted: Sunday 16 April 2017 18:32
by tontze
Ok thanks, ill check wiki
-T
Re: Total noob on lua scripting, where to start ?
Posted: Saturday 22 April 2017 16:49
by tontze
Yeah !
I managed to make my first script, allmost
Below i have a uservariable "Tag_blue" which is in my bmw

I wanted to have a switch to be updated if Tag_blue is "home". It currently is a device script, which im not sure should it be that .. Anyways, script spams in log window very much, and its not changing the state of a dummy switch "BMW".
Where to go from here ? How do i make it change state and stop spamming so much ...
Thnx !
Code: Select all
commandArray = {}
if (devicechanged['Variable:Tag_blue'] =='HOME') then
commandArray['BMW']='On'
else
commandArray['BMW']='Off'
end
return commandArray