So I have a very basic python script that is activated by a KPL button when I am leaving the house. If the alarm isn't ready to arm, Indigo simply turns the KPL LED off.
if the alarm is ready to arm, it will then go ahead and arm the alarm, open the garage door, wait 3 seconds, and then execute a "Leave Home" group, depending on whether it is day or night. In the first script, the "Leave Home" group isn't added, but when this script is activated, the alarm arms, and the garage door opens practicaly immediately, just as expected.
- Code: Select all
alarmPanel = 15871202
alarmPanelState = indigo.devices[alarmPanel].states['LEDReady']
day = indigo.variables[507666416]
import time
if alarmPanelState == "off": #alarm not ready to arm
indigo.dimmer.setLedState(1075498820, index = 4, value = False) #turns off KPL if alarm isn't ready
elif alarmPanelState == "on" and day.value == "true":
indigo.actionGroup.execute(1582883331) #Arms Alarm in Away Mode
indigo.actionGroup.execute(36130583), #opens Garage Door
elif alarmPanelState == "on" and day.value == "false":
indigo.actionGroup.execute(1582883331), #Arms Alarm in Away Mode
indigo.actionGroup.execute(36130583), #opens garage door
But in this sample, when I add in the Leave Home group with a delay, arming the alarm and opening the garage door takes longer.
- Code: Select all
alarmPanel = 15871202
alarmPanelState = indigo.devices[alarmPanel].states['LEDReady']
day = indigo.variables[507666416]
import time
if alarmPanelState == "off": #alarm not ready to arm
indigo.dimmer.setLedState(1075498820, index = 4, value = False) #turns off KPL if alarm isn't ready
elif alarmPanelState == "on" and day.value == "true":
indigo.actionGroup.execute(1582883331) #Arms Alarm in Away Mode
indigo.actionGroup.execute(36130583), #opens Garage Door
time.sleep(3)
indigo.actionGroup.execute(133011708) #leave day group
elif alarmPanelState == "on" and day.value == "false":
indigo.actionGroup.execute(1582883331), #Arms Alarm in Away Mode
indigo.actionGroup.execute(36130583), #opens garage door
time.sleep(3)
indigo.actionGroup.execute(1346050145), #leave night group
I added in the 3 sec delay for the Leave Home Groups, thinking Z-wave traffic was delaying the garage door open command, but I'm assuming I don't understand how my 3 second time.sleep is actually working, or there is something else going on. What happens immediately in the 1st script always takes longer for some reason in the 2nd, and I can't figure out why. FWIW, the alarm works thru IP, and the garage door is Z-Wave. Both work as expected in the first script, but are delayed in the 2nd.
And the first few entries in the Event Log are exactly the same, regardless of what script is used and Indigo is doing absolutely nothing else at the time:
- Code: Select all
Received INSTEON "Garage Light" on (button 5)
Trigger XT-125 Arm Alarm-Garage Door (AWAY MODE) copy
Action Group Alarm-Away
Action Group Garage Door Open
DSC Alarm Arming Alarm in Away Mode. (Partition 1 'Bradford Drive'