Python 3
- durosity
- Posts: 4381
- Joined: Thu May 10, 2012 3:21 pm
- Location: Newcastle Upon Tyne, Ye Ol' England.
Python 3
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
Sent from my iPhone using Tapatalk Pro
Computer says no.
Re: Python 3
Hi Durosity,
I'm assuming you didn't manage to get this issue solved. Hopefully I'm wrong.
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.![Sad :(](./images/smilies/icon_sad.gif)
I'm assuming you didn't manage to get this issue solved. Hopefully I'm wrong.
![Wink :wink:](./images/smilies/icon_wink.gif)
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.
![Sad :(](./images/smilies/icon_sad.gif)
- jay (support)
- Site Admin
- Posts: 18339
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Python 3
I just pinged the developer on the plugin's github repository - we'll see what he says.
Re: Python 3
Thanks Jay. Did the same back in March but heard nothing.
Re: Python 3
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:
to:
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).
Code: Select all
<key>ServerApiVersion</key>
<string>2.0</string>
Code: Select all
<key>ServerApiVersion</key>
<string>3.0</string>
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).
I came here to drink milk and kick ass....and I've just finished my milk.
[My Plugins] - [My Forums]
[My Plugins] - [My Forums]
Re: Python 3
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.
Happy to test if you do manage to take it over.
Re: Python 3
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
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.
I came here to drink milk and kick ass....and I've just finished my milk.
[My Plugins] - [My Forums]
[My Plugins] - [My Forums]
- jay (support)
- Site Admin
- Posts: 18339
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Python 3
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.
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
@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..
- jay (support)
- Site Admin
- Posts: 18339
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Python 3
I don't think they are the same, but I don't know.
Re: Python 3
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.
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.
--
Korey
Korey
Re: Python 3
I am looking at all the possible issues I can find before upgrading to Indigo 2023.x. This is my 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.
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.
- FlyingDiver
- Posts: 7294
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: Python 3
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)
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: Python 3
This works for me which is great, any chance of some help in requesting status and updating a variable?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)