Logic issue with Insteon I/O device

Posted on
Wed Jun 10, 2020 1:57 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Logic issue with Insteon I/O device

I have a trigger activated by Device State Changed/IO Device/Binary Output 1/Has Any Change.
The actions include a change the value of the IO device (from On to OFF, or OFF to ON).
How can I avoid a recursive loop?
Are there Indigo/Python commands to disable the original trigger, and then enable it? - but I suspect that it wouldn't work because upon activating the trigger, it would respond to the change while it was disabled.

Posted on
Thu Jun 11, 2020 9:40 am
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Logic issue with Insteon I/O device

In another action on the trigger you can disable the trigger with an auto enable after some period of time - give that a shot.

Otherwise, you might need to rethink the logic of your solution. If you need help with that, then please fully explain your scenario and perhaps we can come up with a better approach.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jun 11, 2020 10:37 am
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Logic issue with Insteon I/O device

Thank you for your reply.
I'd like to try the disable/auto enable trigger solution, but need the python syntax.

More detailed explanation of what I'm trying to do:
I have a button that connects to the I/O device. I use this to change the status of my home between Occupied and Vacant. The I/O device also lights 2 LEDs - one red, the other green. When it is ON, the green LED is lit; when it is OFF, the red LED is lit. For someone coming to the unoccupied house, they will see a red LED, and pressing the button will change it to green, and Indigo will turn on the devices that are off when the house is vacant (hot water, heater, etc.).
The problem I'm having is changing the color of the LED which is determined by the I/O status - On or Off - because the initial trigger is 'any change in status'. To change the color of the LED, I need to change the status of the I/O device.
It worked with an apple script, but I seem to have lost the setup in the transition of python. Currently, with the various Occupied/Vacant triggers enabled, pressing the button results in chaos.

Posted on
Thu Jun 11, 2020 11:35 am
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Logic issue with Insteon I/O device

Below is the apple script - looks like it took a more direct approach to setting the I/O status. I don't suppose there is a python equivalent?

Code: Select all
tell application "IndigoServer"
   -- set the downstairs bath LED red
   set binary outputs of device "OccupancySw" to {false}
end tell

Posted on
Thu Jun 11, 2020 12:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Logic issue with Insteon I/O device

No script necessary - just add a Enable/Disable action in the UI.

Python version of your script (using Set Binary Output):

Code: Select all
indigo.iodevice.setBinaryOutput(IDOFDEVICE, index=0, value=False)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jun 13, 2020 2:30 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Logic issue with Insteon I/O device

After multiple stumbles, I have a solution. (part of my problem was resolved that 'any change in status' of the I/O device captured the press (on) and release (off). Changing the trigger to I/O device becomes ON, fixed that. The button press trigger is disabled for 1 second with the UI, but for some unknown reason, I need to add a small delay to make the system work:

Code: Select all
hseStatus = indigo.variables[1568794432].value
import time

if hseStatus == "Vacant":
   time.sleep(1)
   indigo.iodevice.setBinaryOutput(33341465, 0, True)
   indigo.variable.updateValue(1568794432, value = str("Occupied")) # setHse Occupied
else:
   time.sleep(1)
   indigo.iodevice.setBinaryOutput(33341465, 0, False)
   indigo.variable.updateValue(1568794432, value = str("Vacant")) # setHse Vacant


As always, thank you for the patient assistance.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests