[Solved] LUA script (to the security panel) -> dzVents script is working well
Moderator: leecollings
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
[Solved] LUA script (to the security panel) -> dzVents script is working well
Hello,
We have a Blockly script for a one button Neo keyfob (it sends only an “On” command.)
The script is: If Keyfob=On and Var Alarm=Off
Set Var Alarm=On
That script is working perfect and every time when we push the button at the key fob it toggles the Variable Alarm from On to Off and Vice versa. (And a Virtual Device is also listening working well with that Variable, it goes on and off with a Blockly script.)
BUT:
Than we made the Lua script below to change the Domoticz Security Panel.
Unfortunately then the Variable “Alarm” (of the Blockly script above) comes in a loop and several times in a row the Domticz security panel displays Armed and Disarmed (see log below).
How is it possible that the Lua script which has only to READ the Variable “Alarm” also changes the Variable? (we saw it automatically changing serval times in the Variable window)
(The only script that may change this Variable “Alarm” is the Blockly script above with the keyfob!
What’s going wrong here?
Thanks for there help and kind regards,
John
commandArray = {}
if (uservariables["Alarm"] == 'On') then
commandArray['Domoticz Security Panel'] = 'Arm Away'
print('### SecPanel: status changed to ' .. globalvariables['Security'])
end
if (uservariables["Alarm"] == 'Off') then
commandArray['Domoticz Security Panel'] = 'Disarm'
print('### SecPanel: status changed to ' .. globalvariables['Security'])
end
return commandArray
2018-10-14 21:08:48.005 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.008 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.014 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.015 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.055 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.058 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.064 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.064 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.104 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.107 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.113 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.114 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.153 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.156 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.162 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.163 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.202 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.205 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.212 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.212 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.251 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.254 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.261 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.261 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.301 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.304 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.310 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.311 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.350 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.353 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.359 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.360 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.399 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.402 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.408 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.409 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.449 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.451 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.458 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.458 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.498 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.501 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.507 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.508 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.547 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.550 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.556 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.557 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.596 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.599 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.605 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.606 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.645 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.648 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.655 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.655 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.695 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.698 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.704 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.704 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.744 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.746 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.753 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.753 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.793 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.796 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.802 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.803 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.843 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.845 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.852 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.852 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.892 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.895 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.901 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.902 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.941 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.944 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.950 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.951 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.990 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.993 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.999 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:49.041 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-14 21:08:49.000 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:49.007 Status: EventSystem: reset all events...
We have a Blockly script for a one button Neo keyfob (it sends only an “On” command.)
The script is: If Keyfob=On and Var Alarm=Off
Set Var Alarm=On
That script is working perfect and every time when we push the button at the key fob it toggles the Variable Alarm from On to Off and Vice versa. (And a Virtual Device is also listening working well with that Variable, it goes on and off with a Blockly script.)
BUT:
Than we made the Lua script below to change the Domoticz Security Panel.
Unfortunately then the Variable “Alarm” (of the Blockly script above) comes in a loop and several times in a row the Domticz security panel displays Armed and Disarmed (see log below).
How is it possible that the Lua script which has only to READ the Variable “Alarm” also changes the Variable? (we saw it automatically changing serval times in the Variable window)
(The only script that may change this Variable “Alarm” is the Blockly script above with the keyfob!
What’s going wrong here?
Thanks for there help and kind regards,
John
commandArray = {}
if (uservariables["Alarm"] == 'On') then
commandArray['Domoticz Security Panel'] = 'Arm Away'
print('### SecPanel: status changed to ' .. globalvariables['Security'])
end
if (uservariables["Alarm"] == 'Off') then
commandArray['Domoticz Security Panel'] = 'Disarm'
print('### SecPanel: status changed to ' .. globalvariables['Security'])
end
return commandArray
2018-10-14 21:08:48.005 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.008 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.014 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.015 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.055 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.058 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.064 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.064 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.104 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.107 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.113 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.114 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.153 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.156 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.162 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.163 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.202 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.205 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.212 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.212 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.251 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.254 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.261 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.261 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.301 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.304 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.310 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.311 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.350 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.353 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.359 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.360 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.399 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.402 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.408 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.409 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.449 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.451 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.458 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.458 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.498 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.501 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.507 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.508 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.547 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.550 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.556 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.557 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.596 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.599 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.605 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.606 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.645 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.648 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.655 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.655 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.695 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.698 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.704 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.704 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.744 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.746 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.753 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.753 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.793 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.796 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.802 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.803 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.843 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.845 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.852 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.852 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.892 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.895 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.901 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.902 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.941 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.944 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.950 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.951 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.990 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:48.993 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:48.999 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-14 21:08:49.041 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-14 21:08:49.000 Status: EventSystem: Script event triggered: AlarmPaneel
2018-10-14 21:08:49.007 Status: EventSystem: reset all events...
Last edited by McJohn on Tuesday 16 October 2018 21:31, edited 1 time in total.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
I only see it being DisarmedMcJohn wrote: ↑Sunday 14 October 2018 21:47 We have a Blockly script for a one button Neo keyfob (it sends only an “On” command.)
The script is: If Keyfob=On and Var Alarm=Off
Set Var Alarm=On
...
Than we made the Lua script below to change the Domoticz Security Panel.
Unfortunately then the Variable “Alarm” (of the Blockly script above) comes in a loop and several times in a row the Domoticz security panel displays Armed and Disarmed (see log below).
Tried to reproduce with dzVents script.How is it possible that the Lua script which has only to READ the Variable “Alarm” also changes the Variable? (we saw it automatically changing serval times in the Variable window)
(The only script that may change this Variable “Alarm” is the Blockly script above with the keyfob!
What’s going wrong here?Code: Select all
[color=#008000]2018-10-14 21:08:48.005 Status: LUA: ### SecPanel: status changed to Disarmed 2018-10-14 21:08:48.008 Status: EventSystem: Script event triggered: AlarmPaneel 2018-10-14 21:08:48.014 Status: LUA: ### SecPanel: status changed to Disarmed 2018-10-14 21:08:48.015 Status: EventSystem: Script event triggered: AlarmPaneel 2018-10-14 21:08:48.055 Status: LUA: ### SecPanel: status changed to Disarmed 2018-10-14 21:08:48.058 Status: EventSystem: Script event triggered: AlarmPaneel .......
Code: Select all
-- Alarm
return {
on = { variables = { "Alarm" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Alarm" },
execute = function(dz, item )
local content = item.value
local securityPanel = dz.devices(1084)
dz.log(item.name .. ", value: " .. item.value,dz.LOG_DEBUG)
if content == "Off" then
securityPanel.disarm().checkFirst()
elseif content == "On" then
securityPanel.armHome().checkFirst()
else
securityPanel.armAway().checkFirst()
end
end
}
Can you confirm that the Lua script is saved as to be triggered by UserVariable and not by "All" ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thank you very much for your quick reply.
The security panel switches ~ 6 times from "disarmed" to "arm away" and indeed it's strange we don't see armed sessions into the log.
- We tried your dzVents script but then nothing happened with the Domoticz security panel.
Or did we have to change the panel name /ID elsewhere in your script?
We looked also to the different Trigger options for our LUA Security Panel script;
- It was saved by "All". We tried it with save by "UserVariabele", then nothing happened anymore with the SecurityPanel when we push the button.
(That's also strange because it has indeed only to listen to a a Variable change)
- Then we made a new LUA script with a Virtual Device (which gets on and off with the Keyfob-Variable script).
We tried this script with trigger "All" and only for "Device" but this difference doesn't matter:
After a push at the key fob, the Security panel says spontaneous Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, etc...
It seems a simple question but the solution is very complex..
Thanks for the help!
2018-10-15 07:39:44.090 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.091 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.184 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.184 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.278 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.278 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.371 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.372 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.465 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.466 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.559 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.560 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.653 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.653 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.747 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.747 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.841 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.841 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.934 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.935 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:45.025 (Dummy) Light/Switch (AlarmOn)
2018-10-15 07:39:45.073 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 07:39:45.075 EventSystem: Event triggered: Keyfob to variabele Off_1
2018-10-15 07:39:45.111 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 07:39:45.119 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 07:39:45.124 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 07:39:45.131 (Aeotec Z-stick) Light/Switch (Emergency)
2018-10-15 07:39:45.139 (Dummy) Light/Switch (AlarmOn)
2018-10-15 07:39:45.147 (Aeotec Z-stick) Light/Switch (Sensor)
2018-10-15 07:39:45.186 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 07:39:45.028 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:45.029 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:45.143 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:45.146 Status: EventSystem: Script event triggered: AlarmPaneel4
The security panel switches ~ 6 times from "disarmed" to "arm away" and indeed it's strange we don't see armed sessions into the log.
- We tried your dzVents script but then nothing happened with the Domoticz security panel.
Or did we have to change the panel name /ID elsewhere in your script?
We looked also to the different Trigger options for our LUA Security Panel script;
- It was saved by "All". We tried it with save by "UserVariabele", then nothing happened anymore with the SecurityPanel when we push the button.
(That's also strange because it has indeed only to listen to a a Variable change)
- Then we made a new LUA script with a Virtual Device (which gets on and off with the Keyfob-Variable script).
We tried this script with trigger "All" and only for "Device" but this difference doesn't matter:
After a push at the key fob, the Security panel says spontaneous Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, Armed, Disarmed, etc...
It seems a simple question but the solution is very complex..
Thanks for the help!
2018-10-15 07:39:44.090 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.091 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.184 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.184 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.278 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.278 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.371 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.372 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.465 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.466 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.559 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.560 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.653 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.653 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.747 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.747 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.841 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:44.841 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:44.934 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:44.935 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:45.025 (Dummy) Light/Switch (AlarmOn)
2018-10-15 07:39:45.073 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 07:39:45.075 EventSystem: Event triggered: Keyfob to variabele Off_1
2018-10-15 07:39:45.111 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 07:39:45.119 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 07:39:45.124 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 07:39:45.131 (Aeotec Z-stick) Light/Switch (Emergency)
2018-10-15 07:39:45.139 (Dummy) Light/Switch (AlarmOn)
2018-10-15 07:39:45.147 (Aeotec Z-stick) Light/Switch (Sensor)
2018-10-15 07:39:45.186 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 07:39:45.028 Status: LUA: ### SecPanel: status changed to Disarmed
2018-10-15 07:39:45.029 Status: EventSystem: Script event triggered: AlarmPaneel4
2018-10-15 07:39:45.143 Status: LUA: ### SecPanel: status changed to Armed Away
2018-10-15 07:39:45.146 Status: EventSystem: Script event triggered: AlarmPaneel4
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Yes, you have to change the number 1084 to the number of your security device. Sorry if that was not clear
also have a look here where you will see that a change to a uservariable by a Lua script or Blockly does not trigger an event. dzVents worked around that restriction by implementing a json API call behind the scenes when a uservariable needs to be updated.We looked also to the different Trigger options for our LUA Security Panel script;
- It was saved by "All". We tried it with save by "UserVariabele", then nothing happened anymore with the SecurityPanel when we push the button.
(That's also strange because it has indeed only to listen to a a Variable change)Code: Select all
2018-10-15 07:39:44.090 Status: LUA: ### SecPanel: status changed to Disarmed 2018-10-15 07:39:44.091 Status: EventSystem: Script event triggered: AlarmPaneel4 2018-10-15 07:39:44.184 Status: LUA: ### SecPanel: status changed to Armed Away 2018-10-15 07:39:44.184 Status: EventSystem: Script event triggered: AlarmPaneel4 .......
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thanks again for your fast help.
This is strange:
In our case the Security Panel event with Lua, triggers (to much) more than 12 times when the user variable changes with another Blockly script!
We found the Lua Security Panel script here:
https://nl.hardware.info/reviews/7925/5 ... tschakelen
Even with a Dummy device (which goes perfectly On and Off with the other Keyfob Variable Blockly) in our case the Security Panel goes ~ 12 times Armed and Disarmed.
Why won’t this be work in our situation?
We changed the ID number in your dzVents script from 1084 to 148702.
But nothing happened. It this the only change or do we have also change a name?
What kind is your dzVents script Trigger? All, Device or User Variable? (We now use All)
Thanks for your help!
Edit: when we save your dzVents script with trigger All, later on it's automaticly changed to "Device" and every time when we saved it into another type after a refresh it's changed to "Device" again.
This is strange:
Code: Select all
also have a look here where you will see that a change to a uservariable by a Lua script or Blockly does not trigger an event.
We found the Lua Security Panel script here:
https://nl.hardware.info/reviews/7925/5 ... tschakelen
Even with a Dummy device (which goes perfectly On and Off with the other Keyfob Variable Blockly) in our case the Security Panel goes ~ 12 times Armed and Disarmed.
Why won’t this be work in our situation?
We changed the ID number in your dzVents script from 1084 to 148702.
But nothing happened. It this the only change or do we have also change a name?
What kind is your dzVents script Trigger? All, Device or User Variable? (We now use All)
Thanks for your help!
Edit: when we save your dzVents script with trigger All, later on it's automaticly changed to "Device" and every time when we saved it into another type after a refresh it's changed to "Device" again.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
A dzVents script is not managed in this way. The on = section does determine how the script will be triggered.
I doubt that the number you use for the security panel is correct. Did you got that number from the http://DOMOTICZ_IP:DOMOTICZ_PORT/#/Devices ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thanks for the explanation.
The ID of the security panel is indeed 148702.
See enclosed screendump. And this is your script:
And below is the BlocklyOn of the Variable:
The ID of the security panel is indeed 148702.
See enclosed screendump. And this is your script:
-- Alarm
return {
on = { variables = { "Alarm" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Alarm" },
execute = function(dz, item )
local content = item.value
local securityPanel = dz.devices(148702)
dz.log(item.name .. ", value: " .. item.value,dz.LOG_DEBUG)
if content == "Off" then
securityPanel.disarm().checkFirst()
elseif content == "On" then
securityPanel.armHome().checkFirst()
else
securityPanel.armAway().checkFirst()
end
end
}
And below is the BlocklyOn of the Variable:
- Attachments
-
- Screen Shot 2018-10-15 at 13.08.16.png (66.39 KiB) Viewed 3016 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
From what I see on your screenshot the id = 1
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Sorry sorry for the wrong number. Changed it to 1 but unfortunately no result

-- Alarm
return {
on = { variables = { "Alarm" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Alarm" },
execute = function(dz, item )
local content = item.value
local securityPanel = dz.devices(1)
dz.log(item.name .. ", value: " .. item.value,dz.LOG_DEBUG)
if content == "Off" then
securityPanel.disarm().checkFirst()
elseif content == "On" then
securityPanel.armHome().checkFirst()
else
securityPanel.armAway().checkFirst()
end
end
}
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Can you please try to change the value of the uservariable using the GUI ?
As explained in one of my earlier replies the change of the uservariable using Blockly or Lua will not trigger an event (in this case the dzVents script)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thanks for your patience!
Indeed when we change the variable via the #/UserVariables window from Off to On, the Security Panel jumps to Armed Home!
So, "we" have 2 options now:
- Change your script from a variable to a dummy device: (SecurityOn) in my case. That device works perfectly now with the Variable.
I didn't know if a change of a Device also don't trigger a Blockly or Lua event?
- Or change your script with the Variable Toggle of the Keyfob included (more complex I think).
Could you help us with the right script?
(And Armed Away is enough for us).
Thanks in advance!
Indeed when we change the variable via the #/UserVariables window from Off to On, the Security Panel jumps to Armed Home!
So, "we" have 2 options now:
- Change your script from a variable to a dummy device: (SecurityOn) in my case. That device works perfectly now with the Variable.
I didn't know if a change of a Device also don't trigger a Blockly or Lua event?
- Or change your script with the Variable Toggle of the Keyfob included (more complex I think).
Could you help us with the right script?
(And Armed Away is enough for us).
Thanks in advance!
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
I hope I have the right names. If not please make sure you adjust the script accordingly
It is important that you disable the blockly and your Lua script before enabling this one. If not you might get yourself in a similar loop.
Script is triggered by the Keyfob and set the security panel, uservariable "Alarm" and device "SecurityOn" accordingly
Code: Select all
-- Alarm
return {
on = { devices = { "Keyfob" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Alarm" },
execute = function(dz, item )
local KeyfobState = item.state
local alarmVar = dz.variables("Alarm")
local securitySwitch = dz.devices("SecurityOn")
local securityPanel = dz.devices(1)
dz.log(item.name .. ", state: " .. item.state,dz.LOG_DEBUG)
if KeyfobState ~= "On" then
securityPanel.disarm().checkFirst()
securitySwitch.switchOff().checkFirst().silent() -- the .silent() ensure that no follow up event will be triggered
else
securityPanel.armAway().checkFirst()
securitySwitch.switchOn().checkFirst().silent() -- just remove .silent() if you don't need it
end
alarmVar.set(KeyfobState).silent()
end
}
Last edited by waaren on Monday 15 October 2018 21:05, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thank you so much for your work!
I set all the Events at de-activated.
Made a new event with dzVents.
Copy/paste your new script (checked all the names).
Saved it.
Pushed the keyfob button (it sends only an On command).
But...
Unfortunately nothing happened; no change of the Variable "Alarm" or the Dummy device AlarmOn, or the Security Panel.
Sorry..
Below the errors in the log.
Thanks!
2018-10-15 19:41:02.518 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 19:41:02.521 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 19:41:02.524 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 19:41:02.532 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 19:41:02.606 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.606 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.640 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.640 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.660 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.660 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.680 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.680 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.730 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.730 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.766 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.766 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.785 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.785 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.805 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.805 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
I set all the Events at de-activated.
Made a new event with dzVents.
Copy/paste your new script (checked all the names).
Saved it.
Pushed the keyfob button (it sends only an On command).
But...
Unfortunately nothing happened; no change of the Variable "Alarm" or the Dummy device AlarmOn, or the Security Panel.
Sorry..
Below the errors in the log.
Thanks!
2018-10-15 19:41:02.518 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 19:41:02.521 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 19:41:02.524 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 19:41:02.532 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 19:41:02.606 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.606 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.640 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.640 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.660 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.660 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.680 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.680 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.730 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.730 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.766 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.766 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.785 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.785 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
2018-10-15 19:41:02.805 Status: dzVents: Error (2.4.6): error loading module 'PanelTest' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/PanelTest.lua':
2018-10-15 19:41:02.805 ...domoticz/scripts/dzVents/generated_scripts/PanelTest.lua:25: <eof> expected near ']'
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Part of the forum control polluted the code. (no character should be there after the last } I fixed it in my previous post. Can you please try again ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Thanks for the hint! That did the trick! The Security Panel goes on
, Dummy Device "SecurityOn" goes on and Variable "Alarm" says On.
But; after the next push at the button the Panel (and the others) didn't goes off..
After a minute (when I write this text) suddenly all the 3 items goes off....
See the log below.
Why is there a delay of 1 minute?
Edit: it goes automatically off after 1 minute (without a push of the botton)...
2018-10-15 21:21:20.536 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 21:21:20.539 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 21:21:20.543 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 21:21:20.553 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 21:21:20.890 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 21:21:20.790 Status: dzVents: Info: Handling events for: "Keyfob", value: "On"
2018-10-15 21:21:20.790 Status: dzVents: Info: Alarm: ------ Start internal script: PanelTest: Device: "Keyfob (Aeotec Z-stick)", Index: 13
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Processing device-adapter for SecurityOn: Switch device adapter
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Processing device-adapter for Domoticz Security Panel: Switch device adapter
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Keyfob, state: On
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Constructed timed-command: Arm Away
2018-10-15 21:21:20.792 Status: dzVents: Debug: Alarm: Constructed timed-command: Arm Away
2018-10-15 21:21:20.792 Status: dzVents: Debug: Alarm: Constructed timed-command: On
2018-10-15 21:21:20.792 Status: dzVents: Info: Alarm: ------ Finished PanelTest
2018-10-15 21:21:20.849 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-10-15 21:21:20.891 Status: Set UserVariable Alarm = On
2018-10-15 21:22:22.046 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 21:22:22.049 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 21:22:22.053 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 21:22:22.061 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 21:22:22.068 (Aeotec Z-stick) Light/Switch (Sensor)
2018-10-15 21:22:22.338 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 21:22:22.342 (Dummy) Light/Switch (SecurityOn)
2018-10-15 21:22:22.272 Status: dzVents: Info: Handling events for: "Keyfob", value: "Off"
2018-10-15 21:22:22.272 Status: dzVents: Info: Alarm: ------ Start internal script: PanelTest: Device: "Keyfob (Aeotec Z-stick)", Index: 13
2018-10-15 21:22:22.273 Status: dzVents: Debug: Alarm: Processing device-adapter for SecurityOn: Switch device adapter
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Processing device-adapter for Domoticz Security Panel: Switch device adapter
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Keyfob, state: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Disarm
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Disarm
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off NOTRIGGER
2018-10-15 21:22:22.274 Status: dzVents: Info: Alarm: ------ Finished PanelTest
2018-10-15 21:22:22.332 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-10-15 21:22:22.342 Status: Set UserVariable Alarm = Off

But; after the next push at the button the Panel (and the others) didn't goes off..
After a minute (when I write this text) suddenly all the 3 items goes off....
See the log below.
Why is there a delay of 1 minute?
Edit: it goes automatically off after 1 minute (without a push of the botton)...
2018-10-15 21:21:20.536 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 21:21:20.539 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 21:21:20.543 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 21:21:20.553 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 21:21:20.890 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 21:21:20.790 Status: dzVents: Info: Handling events for: "Keyfob", value: "On"
2018-10-15 21:21:20.790 Status: dzVents: Info: Alarm: ------ Start internal script: PanelTest: Device: "Keyfob (Aeotec Z-stick)", Index: 13
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Processing device-adapter for SecurityOn: Switch device adapter
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Processing device-adapter for Domoticz Security Panel: Switch device adapter
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Keyfob, state: On
2018-10-15 21:21:20.791 Status: dzVents: Debug: Alarm: Constructed timed-command: Arm Away
2018-10-15 21:21:20.792 Status: dzVents: Debug: Alarm: Constructed timed-command: Arm Away
2018-10-15 21:21:20.792 Status: dzVents: Debug: Alarm: Constructed timed-command: On
2018-10-15 21:21:20.792 Status: dzVents: Info: Alarm: ------ Finished PanelTest
2018-10-15 21:21:20.849 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-10-15 21:21:20.891 Status: Set UserVariable Alarm = On
2018-10-15 21:22:22.046 (Aeotec Z-stick) Light/Switch (Alarm Type)
2018-10-15 21:22:22.049 (Aeotec Z-stick) Light/Switch (Alarm Level)
2018-10-15 21:22:22.053 (Aeotec Z-stick) General/Alarm (Alarm Type: Emergency 10 (0x0A))
2018-10-15 21:22:22.061 (Aeotec Z-stick) Light/Switch (Keyfob)
2018-10-15 21:22:22.068 (Aeotec Z-stick) Light/Switch (Sensor)
2018-10-15 21:22:22.338 (Domoticz Internal) Security (Domoticz Security Panel)
2018-10-15 21:22:22.342 (Dummy) Light/Switch (SecurityOn)
2018-10-15 21:22:22.272 Status: dzVents: Info: Handling events for: "Keyfob", value: "Off"
2018-10-15 21:22:22.272 Status: dzVents: Info: Alarm: ------ Start internal script: PanelTest: Device: "Keyfob (Aeotec Z-stick)", Index: 13
2018-10-15 21:22:22.273 Status: dzVents: Debug: Alarm: Processing device-adapter for SecurityOn: Switch device adapter
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Processing device-adapter for Domoticz Security Panel: Switch device adapter
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Keyfob, state: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Disarm
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Disarm
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off
2018-10-15 21:22:22.274 Status: dzVents: Debug: Alarm: Constructed timed-command: Off NOTRIGGER
2018-10-15 21:22:22.274 Status: dzVents: Info: Alarm: ------ Finished PanelTest
2018-10-15 21:22:22.332 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-10-15 21:22:22.342 Status: Set UserVariable Alarm = Off
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
I think I "know" what the problem is:
Domoticz (or the Z-Stick) automatically switches off the keyfob after 1 minute.
And your script response on that (and won't also fire anymore when the keyfob is in "on" status to Trigger disarmed.
Could you change your script that it only fires (Armed and Disarmed) with the Keyfob On command
(like my simple BLockly to Variable does)
Thanks for all your effort!
Domoticz (or the Z-Stick) automatically switches off the keyfob after 1 minute.
And your script response on that (and won't also fire anymore when the keyfob is in "on" status to Trigger disarmed.
Could you change your script that it only fires (Armed and Disarmed) with the Keyfob On command
(like my simple BLockly to Variable does)
Thanks for all your effort!
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
I don't know the Keyfob device but I suspect it switch to Off automatic (without being pressed) after 1 minute. I can modify the script in such a way that the device, uservar, and security panel will only toggle between On and Off if you push the Keyfob (switch it on) and ignore the automatic Off.
Is that what you want ?
{EDIT]

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
Yep! See my earlier post; as the simple Blocky Variable Alarm Toggles (If Keyfob = On and Var Alarm = On, Set Var Alarm Off) (and vice versa).
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
This should do it .
Code: Select all
-- Alarm
return {
on = { devices = { "Keyfob" }},
logging = { level = domoticz.LOG_DEBUG,
marker = "Alarm" },
execute = function(dz, item )
local KeyfobState = item.state
local alarmVar = dz.variables("Alarm")
local securitySwitch = dz.devices("SecurityOn")
local securityPanel = dz.devices(1)
dz.log(item.name .. ", state: " .. item.state,dz.LOG_DEBUG)
if KeyfobState == "On" and alarmVar.value == "On" then
securityPanel.disarm().checkFirst()
securitySwitch.switchOff().checkFirst().silent()
alarmVar.set("Off").silent()
elseif KeyfobState == "On" then
securityPanel.armAway().checkFirst()
securitySwitch.switchOn().checkFirst().silent()
alarmVar.set("On").silent()
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 91
- Joined: Wednesday 10 October 2018 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Netherlands
- Contact:
Re: LUA script (to the security panel) also changes automatically another Variable which is not in the script (only to r
YES! It's working! Perfectly!
Now we have a simple alarm system for simple users with the push of 1 button!
Thank you so much for all your patience, time and work!

Now we have a simple alarm system for simple users with the push of 1 button!
Thank you so much for all your patience, time and work!



Who is online
Users browsing this forum: No registered users and 1 guest