Simple Lua on/off

Moderator: leecollings

Post Reply
Danny94
Posts: 7
Joined: Monday 18 January 2016 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Simple Lua on/off

Post by Danny94 »

So, decided to give Lua a look.. Got stuck allready...
I want to learn it, so i start with the basics: Turn a light of..... Sigh

Code: Select all

commandArray = {}
 if (devicechanged['Dressoir Rechts'] == 'Off') then
      commandArray['Dressoir Links']='Off'

 end
 return commandArray
Saved it as UTF-8, uploaded it to scripts/lua/ folder...
Looks quite simple but something is wrong..
3x Hue Lux, 1x Hue Ambiance, 1x Hue rgbwstrip, 1x Hue Iris, 4x KiKa, KiKa doorbell
Raspberry Pi 3, RFXtrx433 USB
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Simple Lua on/off

Post by nayr »

what is the name of the file? it has to be like: scripts/lua/script_device_dressoirrechts.lua if you want to catch devicechanged.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Danny94
Posts: 7
Joined: Monday 18 January 2016 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple Lua on/off

Post by Danny94 »

That did it! Thanks!
Are there rules for what filename you have to use?
3x Hue Lux, 1x Hue Ambiance, 1x Hue rgbwstrip, 1x Hue Iris, 4x KiKa, KiKa doorbell
Raspberry Pi 3, RFXtrx433 USB
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Simple Lua on/off

Post by nayr »

read the demo lua scripts.
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Danny94
Posts: 7
Joined: Monday 18 January 2016 18:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simple Lua on/off

Post by Danny94 »

Oh! Didn't realize that part talked about filename!

Thanks again, My Lua journey starts!
3x Hue Lux, 1x Hue Ambiance, 1x Hue rgbwstrip, 1x Hue Iris, 4x KiKa, KiKa doorbell
Raspberry Pi 3, RFXtrx433 USB
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest