lusnie wrote: ↑Saturday 29 December 2018 15:53
Device1 is changed to off when i'm testing
When using a print in the code it appears in the log. So it seems that this is OK.
So, this must be the name of the switch linked to security panel status.
I have this kind of scripting to control sec panel from a global presence switch driven by phones BT detection and this works from this code snippet:
Code: Select all
devSecPanel = 'SecPanel'
-- Other stuff ...
-- Global user presence/Domoticz sec panel status management.
if (devicechanged['PresenceGlobal']) then
-- Force auto mode back to on if needed on known user presence.
if (otherdevices[devAlarmAutoSwitch] == 'Off') then
commandArray[devAlarmAutoSwitch] = 'On'
end
-- Update sec panel.
if (devicechanged['PresenceGlobal'] == 'On') then
print('Security : DISARM (Presence)')
commandArray[devSecPanel] = 'Disarm'
else
if (otherdevices[devAlarmAutoSwitch] == 'On') then
print('Security : ARM AWAY (Presence)')
commandArray[devSecPanel] = 'Arm Away'
end
end
end
And this works perfectly. On my side, in hardware, domoticz internal security panel switch is named (by me) "SecPanel" (as set in global variable devSecPanel).
So, that's just some:
commandArray[devSecPanel] = 'Disarm'
commandArray[devSecPanel] = 'Arm Away'
Commands... If your debug print is OK, IMO this is just a naming issue for the switch linked to domoticz security panel status.
Regards.