Error with LUA script

Moderator: leecollings

Post Reply
Roncalli
Posts: 6
Joined: Tuesday 17 February 2015 21:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Germany
Contact:

Error with LUA script

Post by Roncalli »

Hi all,

I am executing the following LUA script (created via the Domoticz HTML interface):

Code: Select all

commandArray = {}

if (devicechanged['Arm 1 partition'] == 'On') then
    if (otherdevices_svalues['Output:Anzeige S-intern'] == 'Off') then
        commandArray['Scene:AllesAus']='On'
        commandArray['Arbeitszimmer']='On'
        commandArray['Badezimmer']='On'
    end
end
return commandArray
and get the following error message:

"Error: EventSystem: in ExternScharf_AllesAus: [string "-- ..."]:28: attempt to index global 'devicechanged' (a nil value)"

Can anyone tell me what I am doing wrong?

Thanks! F.
Domoticz Stable on RaspberryPi 3B+ running stretch-light
Aeon-Labs stick with 23 z-wave devices, RFXtrx with 14 devices, Netatmo with 6 modules, Satel Integra, Instar IP Camera
User avatar
jvdz
Posts: 2189
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Error with LUA script

Post by jvdz »

Did you mark this script as Time Event as in that case the whole devicechanged array won't be available?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
gertlind1
Posts: 29
Joined: Wednesday 25 December 2013 12:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Error with LUA script

Post by gertlind1 »

Also, look at below.
viewtopic.php?f=23&t=9992
---
Gert
Roncalli
Posts: 6
Joined: Tuesday 17 February 2015 21:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Germany
Contact:

Re: Error with LUA script

Post by Roncalli »

Hi Jos,

Thanks for helping out again. I changed the script to device event. Now it works flawlessly.

Thanks :)
F.
Domoticz Stable on RaspberryPi 3B+ running stretch-light
Aeon-Labs stick with 23 z-wave devices, RFXtrx with 14 devices, Netatmo with 6 modules, Satel Integra, Instar IP Camera
User avatar
Alle
Posts: 30
Joined: Friday 26 December 2014 8:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Fryslân boppe, The Netherlands
Contact:

Re: Error with LUA script

Post by Alle »

jvdz wrote:Did you mark this script as Time Event as in that case the whole devicechanged array won't be available?

Jos
Maybe a stupid question, but how can you mark a script as Time Event? I have also have "'devicechanged' (a nil value)" in the log.
ESXi/Ubuntu - Z-wave.me USB Stick - Domoticz Beta - EvoHome - Nest Protect - Logitech Media Server - Netatmo Weather Station - Everspring - Aeonlabs
niceandeasy
Posts: 102
Joined: Thursday 28 January 2016 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: NL
Contact:

Re: Error with LUA script

Post by niceandeasy »

The question is not stupid, it's just not necessary to ask. The answer is in the Domoticz wiki.
https://www.domoticz.com/wiki/Events chapter 2.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest