Python-iodevice - not responding to command

Posted on
Thu Apr 08, 2021 6:45 pm
SMUSEBY offline
Posts: 272
Joined: Sep 16, 2009

Python-iodevice - not responding to command

In the following script, the IODevice is not responding to either iodevice command. There is no error code. I've confirmed the device ID. I am able to change the value manually. I think I've eliminated all possibilities with the exception of the python code.
Suggestions?

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

Posted on
Fri Apr 09, 2021 1:49 pm
SMUSEBY offline
Posts: 272
Joined: Sep 16, 2009

Re: Python-iodevice - not responding to command

I created the following test script, and the second iodevice line (bold) produces the following error message:

Trigger run a script #1
Script Error test.py: output binary index out-of-range
Script Error Exception Traceback (most recent call shown last):

test.py, line 10, at top level
InvalidParameter: output binary index out-of-range


With 12 possible iodevice options, this suggests that format of the iodevice line is wrong.

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

if hseStatus == "Vacant":
   time.sleep(1)
   indigo.iodevice.setBinaryOutput(33341465, 0, True)
else:
   time.sleep(1)
   indigo.iodevice.setBinaryOutput(33341465, 0, False)
   indigo.iodevice.setBinaryOutput(33341465, 1, True) # this line fails
   indigo.iodevice.setBinaryOutput(33341465, 2, 0)
   indigo.iodevice.setBinaryOutput(33341465, 3, 1)
   indigo.iodevice.setBinaryOutput(33341465, 4, false)
   indigo.iodevice.setBinaryOutput(33341465, 5, true)
   indigo.iodevice.setBinaryOutput(33341465, 6, True)
   indigo.iodevice.setBinaryOutput(33341465, 7, False)


[MODERATOR NOTE]: you can't use formatting inside code tags, so I removed them and added a comment

Posted on
Fri Apr 09, 2021 2:32 pm
jay (support) offline
Site Admin
User avatar
Posts: 16770
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python-iodevice - not responding to command

"True" and "False" (without quotes) are the correct value.

The error seems to indicate that the IODevice only has one binary output...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 09, 2021 3:03 pm
SMUSEBY offline
Posts: 272
Joined: Sep 16, 2009

Re: Python-iodevice - not responding to command

The test script is not relevant. The original script still fails, but I just discovered that sometimes it works.
My 'solution' below is not very elegant. Is there a way I can get the status of the output, and then make a loop?
Workaround 'solution':
Code: Select all
hseStatus = indigo.variables[1568794432].value
import time

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

Posted on
Fri Apr 09, 2021 3:43 pm
jay (support) offline
Site Admin
User avatar
Posts: 16770
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python-iodevice - not responding to command

Are you getting any errors in the Event Log window when the command to set the output fails? What kind of device is that? When the command to set the output fails, how do you know it fails? Does its state in Indigo not change?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 09, 2021 3:59 pm
SMUSEBY offline
Posts: 272
Joined: Sep 16, 2009

Re: Python-iodevice - not responding to command

The device is the Insteon iodevice - I/O linc controller. Selecting the device with Indigo reveals a section labeled Output Controls which has 12 squares, numbered 1-12. The squares become light/dark indicating their T/F status. - I apologize as I thought my mentioning "iodevice" at the top of this post was specific to this item.
To answer your questions,
- There is no mention of a failure to respond in the event log.
- I know the command fails because observing the device in Indigo, the square labeled "1" does not change to Light or Dark
- Its state in Indigo is not changing.
Now that I know the failure is intermittent, repeated send of the change command, sooner or later should change the device, although my 12 repetitions may not be sufficient. An if/then loop would be better.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests