Python 3

Posted on
Wed May 01, 2024 5:13 pm
jay (support) offline
Site Admin
User avatar
Posts: 18247
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python 3

We've got the Github repo forked into our open source repository and kicked the machines in all the right places. If anyone wants to take a stab at updating this plugin for Python 3, they can fork the repo, make the changes, then issue a PR and one of our open source managers will merge the changes and generate a release.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri May 03, 2024 9:03 am
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

I've taken a stab at updating the 8-Channel Relay plugin to Python 3, but I'm unable to test it beyond IDE code inspection. I have one niggling inspection warning that I think is a false positive, but I can't be sure. If someone could try this version and report back, that would be much appreciated. If it appears to be working, I'll get the changes uploaded to the Indigo Open Source repository and update the Indigo Plugin Store.

https://github.com/DaveL17/indigo-8channel-relay/archive/refs/heads/master.zip

I would characterize this version as a beta, so I would suggest babysitting it to be sure it's working properly. I haven't bumped the plugin's version number so you may see a message that this version is already installed--you should go ahead an update it. I have also bumped the minimum required Indigo version to 2022.1.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 03, 2024 9:42 am
Korey offline
User avatar
Posts: 815
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Python 3

Hey Dave!

I can try it out Monday when I get home. Thanks for this!

--
Korey

Posted on
Fri May 03, 2024 9:53 am
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

Hey Korey, thanks. Please let me know what happens.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 03, 2024 9:59 am
Colly offline
Posts: 541
Joined: Jan 16, 2016
Location: Ireland

Re: Python 3

Hi Dave,
Thanks for taking this on, much appreciated.
Quick test and I get the following:
Relay turns on and off from Indigo without issue.
If a relay is operated outside of Indigo the status doesn't update.
I use the Inputs with some door contacts attached, these are not updating in Indigo at present.
I get the following in the log
Code: Select all
   8 Channel Network Relay Error   Error in plugin execution runConcurrentThread:

  File "plugin.py", line 134, in runConcurrentThread
  File "plugin.py", line 346, in set_device_states
type: argument should be integer or bytes-like object, not 'str'

   8 Channel Network Relay Error   plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

I'll be heading out shortly but will pick up any queries later on tonight.

Posted on
Fri May 03, 2024 10:06 am
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

Thanks for the update. That was one of the lines that was flagged, so maybe it's not a false positive after all. I'll do some digging and get a revised build out as soon as I can.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 03, 2024 10:07 am
Colly offline
Posts: 541
Joined: Jan 16, 2016
Location: Ireland

Re: Python 3

No problem, happy to test when you’re ready.

Posted on
Fri May 03, 2024 10:42 am
FlyingDiver offline
User avatar
Posts: 7249
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Python 3

DaveL17 wrote:
Thanks for the update. That was one of the lines that was flagged, so maybe it's not a false positive after all. I'll do some digging and get a revised build out as soon as I can.


I think you're going to need to either convert statuses to a string, or convert the search term (f"IH {chan}") to a bytestring so that find() has the same object types.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri May 03, 2024 10:57 am
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

I've updated the code and have hopefully addressed the "argument should be integer or bytes-like object, not 'str'" error. Same plugin version number; same URL:

https://github.com/DaveL17/indigo-8channel-relay/archive/refs/heads/master.zip

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 03, 2024 1:27 pm
Colly offline
Posts: 541
Joined: Jan 16, 2016
Location: Ireland

Re: Python 3

Getting below in log.
Code: Select all
   8 Channel Network Relay Error   Error in plugin execution runConcurrentThread:

  File "plugin.py", line 134, in runConcurrentThread
  File "plugin.py", line 344, in set_device_states
type: 'int' object has no attribute 'encode'

   8 Channel Network Relay Error   plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

The inputs are updating now, albeit they appear to be slow updating.

Posted on
Fri May 03, 2024 2:06 pm
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

This is highlighting a big difference between Python 2 and Python 3. It also highlights the fun of updating plugins when you don't have the underlying hardware. :)

I've pushed a new version (at the same link) that will hopefully take care of this.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 03, 2024 2:08 pm
Colly offline
Posts: 541
Joined: Jan 16, 2016
Location: Ireland

Re: Python 3

No problem on my side. Only delighted to work through. I’ll give it a go shortly.

Posted on
Fri May 03, 2024 2:38 pm
Colly offline
Posts: 541
Joined: Jan 16, 2016
Location: Ireland

Re: Python 3

Everything seems good now. I’ll keep an eye on it and see if it behaves as expected.
Great work.

Posted on
Fri May 03, 2024 2:42 pm
DaveL17 offline
User avatar
Posts: 6781
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Python 3

Good deal.

Thanks for the troubleshooting (I know it's getting late for you),

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun May 05, 2024 12:03 pm
matt (support) offline
Site Admin
User avatar
Posts: 21424
Joined: Jan 27, 2003
Location: Texas

Re: Python 3

Great work, Dave. Thanks for taking on getting this one updated to work under Python 3!

Image

Who is online

Users browsing this forum: No registered users and 2 guests