Total noob on lua scripting, where to start ?

Moderator: leecollings

Post Reply
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Total noob on lua scripting, where to start ?

Post 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
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
User avatar
Plaagje
Posts: 42
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: Total noob on lua scripting, where to start ?

Post 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
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Total noob on lua scripting, where to start ?

Post by tontze »

Ok thanks, ill check wiki :)

-T
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Total noob on lua scripting, where to start ?

Post by tontze »

Yeah !

I managed to make my first script, allmost :D

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
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 1 guest