Cannot change Alarm state in LUA script
Posted: Thursday 08 February 2018 16:12
Hi All,
I made a dummy switch(name: SetSecurity) to toggle the alarm status. It triggers the LUA script, but it doesn't really work. It seems tot change the "otherdevices['Domoticz Security Panel'" to normal state, but will not set the status. It seems not to remember....
What am i doing wrong?
Tnx
commandArray = {}
print("______________________________________________________________")
print(otherdevices["Domoticz Security Panel"])
if (devicechanged['SetSecurity'] == 'On') then
print('Wanna arm:')
print(otherdevices["Domoticz Security Panel"])
otherdevices['Domoticz Security Panel'] = 'Arm Home'
print(otherdevices["Domoticz Security Panel"])
end
if (devicechanged['SetSecurity'] == 'Off') then
print('Wanna disarm:')
print(otherdevices["Domoticz Security Panel"])
otherdevices['Domoticz Security Panel'] = 'Normal'
print(otherdevices["Domoticz Security Panel"])
end
print("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
--Arm Home
return commandArray
2018-02-08 16:01:33.888 User: XXXXinitiated a switch command (1388/SetSecurity/Off)
2018-02-08 16:01:34.009 dzVents: Device based event fired on 'SetSecurity', value 'Off'
2018-02-08 16:01:34.019 dzVents: All based event fired
2018-02-08 16:01:34.025 dzVents: ______________________________________________________________
2018-02-08 16:01:34.025 dzVents: Arm Home
2018-02-08 16:01:34.025 dzVents: Wanna disarm:
2018-02-08 16:01:34.025 dzVents: Arm Home
2018-02-08 16:01:34.025 dzVents: Normal
2018-02-08 16:01:34.025 dzVents: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2018-02-08 16:01:34.026 (DummyHardware) Lighting 2 (SetSecurity)
2018-02-08 16:01:52.793 User: XXXXinitiated a switch command (1388/SetSecurity/On)
2018-02-08 16:01:52.907 dzVents: Device based event fired on 'SetSecurity', value 'On'
2018-02-08 16:01:52.917 dzVents: All based event fired
2018-02-08 16:01:52.924 dzVents: ______________________________________________________________
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: Wanna arm:
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2018-02-08 16:01:52.925 (DummyHardware) Lighting 2 (SetSecurity)
2018-02-08 16:02:00.506 dzVents: Time based event fired
2018-02-08 16:02:00.513 dzVents: All based event fired
https://snag.gy/dpIt7D.jpg
I made a dummy switch(name: SetSecurity) to toggle the alarm status. It triggers the LUA script, but it doesn't really work. It seems tot change the "otherdevices['Domoticz Security Panel'" to normal state, but will not set the status. It seems not to remember....
What am i doing wrong?
Tnx
commandArray = {}
print("______________________________________________________________")
print(otherdevices["Domoticz Security Panel"])
if (devicechanged['SetSecurity'] == 'On') then
print('Wanna arm:')
print(otherdevices["Domoticz Security Panel"])
otherdevices['Domoticz Security Panel'] = 'Arm Home'
print(otherdevices["Domoticz Security Panel"])
end
if (devicechanged['SetSecurity'] == 'Off') then
print('Wanna disarm:')
print(otherdevices["Domoticz Security Panel"])
otherdevices['Domoticz Security Panel'] = 'Normal'
print(otherdevices["Domoticz Security Panel"])
end
print("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
--Arm Home
return commandArray
2018-02-08 16:01:33.888 User: XXXXinitiated a switch command (1388/SetSecurity/Off)
2018-02-08 16:01:34.009 dzVents: Device based event fired on 'SetSecurity', value 'Off'
2018-02-08 16:01:34.019 dzVents: All based event fired
2018-02-08 16:01:34.025 dzVents: ______________________________________________________________
2018-02-08 16:01:34.025 dzVents: Arm Home
2018-02-08 16:01:34.025 dzVents: Wanna disarm:
2018-02-08 16:01:34.025 dzVents: Arm Home
2018-02-08 16:01:34.025 dzVents: Normal
2018-02-08 16:01:34.025 dzVents: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2018-02-08 16:01:34.026 (DummyHardware) Lighting 2 (SetSecurity)
2018-02-08 16:01:52.793 User: XXXXinitiated a switch command (1388/SetSecurity/On)
2018-02-08 16:01:52.907 dzVents: Device based event fired on 'SetSecurity', value 'On'
2018-02-08 16:01:52.917 dzVents: All based event fired
2018-02-08 16:01:52.924 dzVents: ______________________________________________________________
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: Wanna arm:
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: Arm Home
2018-02-08 16:01:52.924 dzVents: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2018-02-08 16:01:52.925 (DummyHardware) Lighting 2 (SetSecurity)
2018-02-08 16:02:00.506 dzVents: Time based event fired
2018-02-08 16:02:00.513 dzVents: All based event fired
https://snag.gy/dpIt7D.jpg