ryanbuckner wrote:This was going to be my first attempt. I got a little fuzzy around the action groups and toggle since the I/O takes the same command to open and close the door.
Here's what I was thinking :
- On Group: Action Group that opens Garage Door #1 (Does the Group need to know to execute only if it's closed?)
- Off Group: Action Group that closes Garage Door #1 (Does the Group need to know to execute only if it's open?)
-Toggle Group: Python based Action Group that checks the status of Garage Door #1 and opens or closes based on the result
- Status Variable: Variable that holds the status of ON or OFF based on the sensor state of Garage Door #1?
- Status Group - Not really sure what to do here
That looks about right, though I'm not sure I'd implement toggle as that could get very complicated if you end up with one open and one closed - would it toggle them both, neither, or what?
In terms of testing the current state, I suppose it depends on how you've got things set up. In the case of an I/O Linc with a garage door kit, controlling the door means opening the output (which will automatically close per the configuration after a few seconds). The relay temporarily opening is what causes the door to actuate, so there is fundamentally no difference between open and close in terms of the raw command.
If that's the case, then you'd want to write a simple script that first tests the door to see if it's already open before opening the relay (for the Turn On command) etc. This would keep the doors from acting wonky when one is in a different state than the other and it would really only open if the door isn't already open.
Something like this should work, though I don't have an I/O Linc to test it with, so I'm just guessing:
- Code: Select all
iolinc = indigo.devices[ID_OF_IOLINC]
if iolinc.states['binaryInput1']:
# The input is True (which I believe means closed, but I could have it backwards), so execute whatever you need to do here
indigo.iodevice.setBinaryOutput(iolinc, 0, True) # Temporarily open the output to actuate (open) the door
Anyway, that should get you started.