[Solve] LUA : attempt to index global 'devicechanged' (a nil value)
Posted: Thursday 09 June 2016 12:43
Hi there,
Got an error on my script and don't know how to solve, maybe someone can help me
1 - Situation :
Running Domoticz (Version: 3.5228) on a Syno + RFLink + RFXTRXE
2 - Goal :
Manage Milight Bulb or wall socket true wall switch with chacon module inside, i want to be able to turn on/off the device or group depending of his previous state who can be drive by a scene or a remote
I Don't care about ON or Off wall switch status, just want : when his status change, script check "esclave device" status and toggle it from On to OFF or OFF to ON
3 - Script :
This one have to drive a wall plug From IDK with a Chacon wall switch
Inter lum Salon : the wall switch
Lumiere Salon = the wall plug
4 - Current status :
For the Wall switch
For the wall Plug
5 - Error :
Your Help will be very appriciated to solve this.
Got an error on my script and don't know how to solve, maybe someone can help me
1 - Situation :
Running Domoticz (Version: 3.5228) on a Syno + RFLink + RFXTRXE
2 - Goal :
Manage Milight Bulb or wall socket true wall switch with chacon module inside, i want to be able to turn on/off the device or group depending of his previous state who can be drive by a scene or a remote
I Don't care about ON or Off wall switch status, just want : when his status change, script check "esclave device" status and toggle it from On to OFF or OFF to ON
3 - Script :
This one have to drive a wall plug From IDK with a Chacon wall switch
Inter lum Salon : the wall switch
Lumiere Salon = the wall plug
Code: Select all
commandArray = {}
if (devicechanged['Inter lum salon']) then
commandArray['Lumiere Salon']='Toggle'
end
return commandArray
4 - Current status :
For the Wall switch
Code: Select all
1297 Inter lum salon On 2016-06-09 09:46:59 15
{
"ActTime" : 1465469517,
"ServerTime" : "2016-06-09 12:51:57",
"Sunrise" : "06:17",
"Sunset" : "21:45",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "On",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 11,
"HardwareName" : "RFXTRXE",
"HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",
"HardwareTypeVal" : 1,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "1145DC6",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2016-06-09 09:46:59",
"Level" : 100,
"LevelInt" : 15,
"MaxDimLevel" : 15,
"Name" : "Inter lum salon",
"Notifications" : "false",
"PlanID" : "1",
"PlanIDs" : [ 1 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : 7,
"Status" : "On",
"StrParam1" : "",
"StrParam2" : "",
"SubType" : "AC",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "Lighting 2",
"TypeImg" : "lightbulb",
"Unit" : 1,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "1297"
}
],
"status" : "OK",
"title" : "Devices"
}
For the wall Plug
Code: Select all
105 Lumiere Salon Off 2016-06-09 09:47:03 0
{
"ActTime" : 1465469552,
"ServerTime" : "2016-06-09 12:52:32",
"Sunrise" : "06:17",
"Sunset" : "21:45",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 110,
"Data" : "Off",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 25,
"HardwareName" : "RFLink Ser2net",
"HardwareType" : "RFLink Gateway with LAN interface",
"HardwareTypeVal" : 62,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "00000060",
"Image" : "Lampadaire",
"IsSubDevice" : false,
"LastUpdate" : "2016-06-09 09:47:03",
"Level" : 0,
"LevelInt" : 0,
"MaxDimLevel" : 100,
"Name" : "Lumiere Salon",
"Notifications" : "false",
"PlanID" : "2",
"PlanIDs" : [ 2, 11 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"Status" : "Off",
"StrParam1" : "",
"StrParam2" : "",
"SubType" : "ELRO AB400",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "true",
"Type" : "Light/Switch",
"TypeImg" : "lightbulb",
"Unit" : 4,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "105"
}
],
"status" : "OK",
"title" : "Devices"
}
Code: Select all
2016-06-09 12:40:00.959 Error: EventSystem: in Lum salon: [string "commandArray = {} ..."]:2: attempt to index global 'devicechanged' (a nil value)
Your Help will be very appriciated to solve this.