Page 1 of 3

Python 3

PostPosted: Mon Jul 31, 2023 10:36 am
by durosity
I’m guessing this plugin is long dead and won’t be getting a Python 3 update? I’d actually completely forgotten I had one of these which is still in use.. testament to how reliable it’s been I guess!


Sent from my iPhone using Tapatalk Pro

Re: Python 3

PostPosted: Tue Oct 03, 2023 3:50 pm
by Colly
Hi Durosity,
I'm assuming you didn't manage to get this issue solved. Hopefully I'm wrong. :wink:
Anyone else out there willing to take a look at it? Going to prevent me updating to newer versions of Indigo for the time being. :(

Re: Python 3

PostPosted: Tue Oct 03, 2023 6:40 pm
by jay (support)
I just pinged the developer on the plugin's github repository - we'll see what he says.

Re: Python 3

PostPosted: Tue Oct 03, 2023 11:46 pm
by Colly
Thanks Jay. Did the same back in March but heard nothing.

Re: Python 3

PostPosted: Wed Oct 04, 2023 5:02 am
by DaveL17
I opened the plugin up in my development environment (PyCharm) and chose a Python 3.10 interpreter. I didn't see any obvious syntax errors so it may just be a simple fix to update the info.plist file ServerApiVersion node from:

Code: Select all
   <key>ServerApiVersion</key>
   <string>2.0</string>
to:

Code: Select all
   <key>ServerApiVersion</key>
   <string>3.0</string>
I have not tested this, so it's definitely a caveat emptor situation. I read somewhere about issues with https:// vs. http:// (maybe it was with the other 8-channel relay plugin?) so there's no guarantees my suggestion above will work. If trying this out, don't risk mission critical stuff.

If the developer doesn't respond or doesn't want to do the update, I'm willing to take a run at updating it to Python 3 (if it's added to the Indigo Open Source library).

Re: Python 3

PostPosted: Wed Oct 04, 2023 6:35 am
by Colly
Thanks Dave, I might get brave and try it out. I’d like to keep using the board as it’s been solid since day 1. I have some workaround options if all else fails.
Happy to test if you do manage to take it over.

Re: Python 3

PostPosted: Wed Oct 04, 2023 11:44 am
by Colly
OK so, I got brave and made suggested change. Got the following errors in the log. Changed back to original version so working again.
Code: Select all
/Frameworks/Python.framework/Versions/3.10/lib/python3.10/telnetlib.py", line 288, in write
type: 'in <string>' requires string as left operand, not bytes

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

  File "plugin.py", line 129, in runConcurrentThread
  File "plugin.py", line 320, in set_device_states
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/telnetlib.py", line 288, in write
type: 'in <string>' requires string as left operand, not bytes

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

  File "plugin.py", line 129, in runConcurrentThread
  File "plugin.py", line 320, in set_device_states
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/telnetlib.py", line 288, in write
type: 'in <string>' requires string as left operand, not bytes

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

  File "plugin.py", line 129, in runConcurrentThread
  File "plugin.py", line 320, in set_device_states
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/telnetlib.py", line 288, in write
type: 'in <string>' requires string as left operand, not bytes

Re: Python 3

PostPosted: Wed Oct 04, 2023 12:12 pm
by DaveL17
Yep, those are very common errors when converting a plugin to Python 3. Shouldn't be too hard to overcome once the plugin lands in the Indigo Open Source library (hence clearance from the original author). The plugin license may allow for that anyway, but it's up to Jay and Matt to make that call.

Re: Python 3

PostPosted: Wed Oct 04, 2023 2:07 pm
by jay (support)
The license is GPLv2, which is somewhat problematic in that it calls for specific language to be attached to the product, but the developer only references GPLv2 in the Readme file (he references a LICENSE file which is not actually present in the repo, so that sorta violates the license). We are not fans of the GPL license and much prefer the MIT license, but that's just us...

Bottom line, we're not going to fork this into our open source repo without explicit permission from the developer to do so. However, anyone that wants to fork it from his repo, make the changes, then issue a PR to him is more than welcome to do it. Hopefully if a PR shows up on his repo he will take a quick look, merge it, and create a new release.

Feel free to contact him through GitHub to encourage him to do something.

Re: Python 3

PostPosted: Sun Oct 08, 2023 2:25 pm
by Colly
@Jay Does this plugin (https://www.indigodomo.com/pluginstore/245/) make it any easier to adopt? I've tried it and it works albeit with errors in the log. I actually forgot about trying this previously. I tried to contact the developer on GitHub back in May however never got any response..

Re: Python 3

PostPosted: Sun Oct 08, 2023 7:43 pm
by jay (support)
I don't think they are the same, but I don't know.

Re: Python 3

PostPosted: Wed Nov 08, 2023 10:43 pm
by Korey
Well this was one of the last ones I was waiting for to upgrade to then new, (no Python 2 Indigo Version)

I had an extra Zooz ZEN17 kicking around, so I provisioned it and it fits the bill. ( at least for what I need)

In case anyone else is waiting for a Python 3 update to this plugin, this is a cheap option.

Re: Python 3

PostPosted: Wed Nov 22, 2023 12:38 pm
by pacman
I am looking at all the possible issues I can find before upgrading to Indigo 2023.x. This is my https://forums.indigodomo.com/viewtopic.php?f=364&t=27603 from yesterday trying to resolve a similar issue. The 8ChannelNetwork board does not have a compatible plugin upgrade for 2023.x but I found I can operate relays with URL commands using Python2 script bypassing the plugin. According to the reply from yesterday's post, the text needs to be changed to Python3 but is doable. This same logic should apply for the following script:

myURL1 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff1=off"
myURL2 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff2=off"
myURL3 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff3=off"
myURL4 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon4=on"
myURL5 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon5=on"
myURL6 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff6=off"
myURL7 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff7=off"
myURL8 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff8=off"


import urllib
urllib.urlopen(myURL1)
urllib.urlopen(myURL2)
urllib.urlopen(myURL3)
urllib.urlopen(myURL4)
urllib.urlopen(myURL5)
urllib.urlopen(myURL6)
urllib.urlopen(myURL7)
urllib.urlopen(myURL8)

I just need expert advise on how to create Python3 script to accomplish the same result for above v2 script. There isn't a real question here but I do want someone to point me toward proper Python3 syntax. After years of using Indigo Server, I rarely have to make scripting changes, so updating to a whole new version is difficult.

Also, I haven't figured out how to read into Indigo a relay board's input change of state without using the plugin.

Re: Python 3

PostPosted: Wed Nov 22, 2023 1:30 pm
by FlyingDiver
That should work, but the better option for Python3 is:
Code: Select all
import requests

myURL1 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff1=off"
myURL2 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff2=off"
myURL3 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff3=off"
myURL4 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon4=on"
myURL5 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon5=on"
myURL6 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff6=off"
myURL7 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff7=off"
myURL8 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff8=off"

requests.get(myURL1)
requests.get(myURL2)
requests.get(myURL3)
requests.get(myURL4)
requests.get(myURL5)
requests.get(myURL6)
requests.get(myURL7)
requests.get(myURL8)


Re: Python 3

PostPosted: Thu Nov 30, 2023 4:49 pm
by Colly
FlyingDiver wrote:
That should work, but the better option for Python3 is:
Code: Select all
import requests

myURL1 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff1=off"
myURL2 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff2=off"
myURL3 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff3=off"
myURL4 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon4=on"
myURL5 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayon5=on"
myURL6 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff6=off"
myURL7 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff7=off"
myURL8 = "http://admin:1Dc333@192.168.0.61/relay_en.cgi?relayoff8=off"

requests.get(myURL1)
requests.get(myURL2)
requests.get(myURL3)
requests.get(myURL4)
requests.get(myURL5)
requests.get(myURL6)
requests.get(myURL7)
requests.get(myURL8)


This works for me which is great, any chance of some help in requesting status and updating a variable?