PowerView plugin update

Posted on
Mon Apr 17, 2023 1:37 pm
SteveFyfe offline
Posts: 11
Joined: May 05, 2007
Location: Central Mass USA

PowerView plugin update

Three weeks ago I made changes to the PowerView plugin, one to convert it to Python3 and one to support the latest HD PowerView Gateway V3. I put a request on the PowerView Plugin's GitHub page for merging my changes into a new release, but as yet there has been no response.

But what I would really like is for some other people to test my changes, especially those people with V2 Hubs who are using the current released plugin. My changes may not be a big benefit to you, but it would be great for you to try it to make sure there are no problems. Since I only have a V3, I cannot test the V2 code completely.

Just to be clear, the current plugin is still using Python2, so it will stop working with the next release of Indigo. My changes will fix that problem for all V2 users.

To try the new version, go to https://github.com/sdf-cnicorp/indigo-p ... /tree/Gen3 and click the green "Code" button, select "Download ZIP", expand the zip, and double click the plugin.

Please post a reply to this message with your findings, good or bad.

Posted on
Fri Apr 21, 2023 8:00 am
chase offline
Posts: 75
Joined: Oct 27, 2013

Re: PowerView plugin update

I am using a Gen 2 hub. I am experiencing errors:

Code: Select all
Apr 21, 2023 at 6:46:57 AM
   Stopping plugin PowerView (pid 853)
   Stopped plugin PowerView
   Upgrading plugin PowerView to newer version 2.0.0 (previous version moved to trash)
   Loading plugin "PowerView 2.0.0" using API v3.0
   Starting plugin "PowerView 2.0.0" (pid 41001)
   Started plugin "PowerView 2.0.0"
   PowerView Error                 exception in device_start_comm(Active Double French Door): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Back Bedroom): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Double Transom): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Fixed Double French Door): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Front Bedroom): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Kevins Office): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Left Ensuite): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Lower Left): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Lower Right): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Right Ensuite): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Sandra’s Office): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Single French Door): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Single Transom): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Top Left): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Top Right): PowerView() takes no arguments
   PowerView Error                 exception in device_start_comm(Upper Center): PowerView() takes no arguments

Posted on
Fri Apr 21, 2023 8:43 am
SteveFyfe offline
Posts: 11
Joined: May 05, 2007
Location: Central Mass USA

Re: PowerView plugin update

Sorry about that. Stupid error on my part. I just fixed it.

Next time, please check the Debug option in the PowerView plugin Configuration dialog before you try it. You will have to re-download the plugin to get the fix. I hope you try again.

Posted on
Sun Jun 25, 2023 11:46 am
SteveFyfe offline
Posts: 11
Joined: May 05, 2007
Location: Central Mass USA

Re: PowerView plugin update

If there is anyone out there using the PowerView plugin, a new version of my updated plugin is now available. If you tried it before and had to go back to the old version, please try the new one again.

To try the new version, go to https://github.com/sdf-cnicorp/indigo-powerview/tree/Gen3 and click the green "Code" button, select "Download ZIP", expand the zip, and double click the plugin.

Posted on
Fri Nov 03, 2023 7:22 pm
dawson1331 offline
Posts: 32
Joined: Oct 22, 2012

Re: PowerView plugin update

I am using the PowerView plugin. Thanks for your work on it. I updated to the new Indigo and several plugins stopped working. I modified Powerview to get it working for me butI finally found this post and saw that you have upgraded to Python3 and made some improvements. I would like to use your new version. I use this plugin multiple times a day. I thank you again for working on this.

I have a couple of issues. I list some here now and some later as I investigate more. I am pretty sure that I am using a 2nd gen hub.

1. I think that there is a math issue in powerview2.py at procedure setShade Position(). I can close the blinds but not open them. These are the two lines that I changed:
top = int((float(secondary) / 100.0 * 65535.0 ) + 0.5)
bottom = int((float(primary) / 100.0 * 65535.0 ) + 0.5)
Previously top and bottom always went to zero (or a small number). So I could not Open the blinds. The Open would always Close them. They work for me now.

2. When defining an Action Group -> Set Shade Position -> Configure Set Shade Position -> Lookup Current Position? -> Current Position returns 0 for Primary Bottom always (even if the blind is raised). Not sure why yet.
{'position1': 0, 'posKind1': 1, 'position2': 0, 'posKind2': 2, 'primary': 0.0, 'secondary': 0.0, 'tilt': 0.0, 'velocity': 0.0}

3. I have one blind (out of 16) that is not responding. It works with the remote control - just not the hub. I am not trying to fix it yet since it makes a good test case. It gives the following stack trace when the plugin is loaded. I'll spend more time on this one later. We need to catch the failure somewhere.

PowerView Error Exception in update() of device=MB3 with address=10.0.1.219:31213.
Traceback (most recent call last):
File "plugin.py", line 513, in update
data = self.find_shade_on_hub(hub_hostname, shade_id)
File "plugin.py", line 412, in find_shade_on_hub
shade_data = self.get_pv(hubHostname).shade(hubHostname, shadeId, room=need_room)
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/Plugins/PowerView.indigoPlugin/Contents/Server Plugin/powerview2.py", line 124, in shade
data = data.pop('shade')
KeyError: 'shade'

Thanks again,

Bill

Posted on
Sat Nov 04, 2023 1:08 pm
SteveFyfe offline
Posts: 11
Joined: May 05, 2007
Location: Central Mass USA

Re: PowerView plugin update

Thanks for giving this a try. I last updated this on GitHub in July, but I have been working on it since then. I just updated the Gen3 branch with my latest changes. Since this branch supports both generations, would you please try this version to see if it fixed your issues. Hopefully this will fix the first two issues you mentioned.

As far as the third item goes, I have fixed the problem that caused the exception but that only happened because there was some problem getting data from the hub about that shade. The new version should at least give you a message about what went wrong. Maybe that will be enough to figure out how to fix it, although I'm guessing that all you need to do is a calibrate on that shade.

Please keep me up to date on your progress. I'm hoping to put this version into the Plugin Store once I'm confident it works with the Gen 2 hub (that I don't have to test with).

Steve

Posted on
Mon Nov 06, 2023 5:05 pm
dawson1331 offline
Posts: 32
Joined: Oct 22, 2012

Re: PowerView plugin update

I downloaded another PowerView version from Github and have been testing it for a couple of days. Here are some comments - not in any particular order. I will continue to investigate more.

1. It is much slower. I think because of the ‘?refresh=true’ in the powerview2.py shade procedure. I see that this is apparently necessary to accurately retrieve the shade position.

2. The slower response causes a timeout from time to time.

3. The get “Action Group -> Set Shade Position -> Configure Set Shade Position -> Lookup Current Position? -> Current Position” works correctly now - probably because of the ?refresh=true setting. I tried without the refresh option and it did NOT return the correct shade position. Maybe this setting could be set just for this command (to improve overall performance).

4. The math error is gone. The shades open and CLOSE now correctly.

5. I have one shade that needs to be reprogrammed to the hub (it works correctly with the remote control). I'm leaving this way for the testing. There should be some notification when no data is retrieved - probably in the procedure shade:

def shade(self, hubHostname, shadeId, room=False) -> dict:
shadeUrl = 'http://%s/api/shades/%s?refresh=true' % (hubHostname, shadeId)

data = self.get(shadeUrl)
if not data:
*** New *** indigo.server.log('shade ****** No data for shade, url: %s.' % shadeUrl) *** shade name would be better than url, also could be a warning or error
return {}

data = data.pop('shade')
etc

6. It may take a minute or more to see any shade start moving when a call is made to open or close ALL the window blinds (like I’m leaving the house or coming home). I don’t know if its Indigo or PowerView.
Sometimes it take 30 seconds to a minute just the for PowerView configure dialog to come up. When that happens the cursor spins.

7. I get the following stack trace when a call is made to open or close ALL the window blinds. It happens on one random shade. It would be a different one each time. It may be a time out problem. I don’t get this when I comment out the ?refresh=true setting. The behavior is repeatable but the particular shade may be different. I have 16 shades in this experiment. There is one more - a vertical shade - that I’ll add and test later.

PowerView Error Error fetching http://10.0.1.219/api/shades/64014?refresh=true
Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/IndigoPluginHost3.app/Contents/Resources/PlugIns/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/IndigoPluginHost3.app/Contents/Resources/PlugIns/requests/adapters.py", line 440, in send
resp = conn.urlopen(
Etc.

Posted on
Mon Nov 06, 2023 7:01 pm
SteveFyfe offline
Posts: 11
Joined: May 05, 2007
Location: Central Mass USA

Re: PowerView plugin update

when a call is made to open or close ALL the window blinds

How are you doing this? Do you run a single scene, or what?

Posted on
Tue Nov 07, 2023 8:53 pm
dawson1331 offline
Posts: 32
Joined: Oct 22, 2012

Re: PowerView plugin update

I am running a PowerView scene and I will send a more detailed response to your question a little later.

But I was looking at the stack trace and I have a question about the code in powerview2.py, procedure "def get" - around line 185. Your line numbers may be different. I do not know enough python to read the statement below. But it looks like to me that the variable "res" is undefined if the do_get call (in the try block) fails for some reason. If that is true, then the self.logger.debug line may use "res" which is undefined and that will fail possibly causing the stack dump.

self.logger.debug(
f" Get from '{url}' returned {'n/a' if not res else res.status_code}, response body '{'n/a' if not res else res.text}'")


Traceback (most recent call last):
File "plugin.py", line 531, in update
data = self.find_shade_on_hub(hub_hostname, shade_id)
File "plugin.py", line 431, in find_shade_on_hub
shade_data = self.get_pv(hubHostname).shade(hubHostname, shadeId, room=need_room)
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/Plugins/PowerView.indigoPlugin/Contents/Server Plugin/powerview2.py", line 122, in shade
data = self.get(shadeUrl)
File "/Library/Application Support/Perceptive Automation/Indigo 2023.1/Plugins/PowerView.indigoPlugin/Contents/Server Plugin/powerview2.py", line 191, in get
f" Get from '{url}' returned {'n/a' if not res else res.status_code}, response body '{'n/a' if not res else res.text}'")
UnboundLocalError: local variable 'res' referenced before assignment

Posted on
Tue Nov 07, 2023 11:45 pm
dawson1331 offline
Posts: 32
Joined: Oct 22, 2012

Re: PowerView plugin update

1. Yes. The example from yesterday was by running two PowerView scenes back to back. When leaving the house an action group is automatically executed to close the blinds. It calls two PowerView scenes among other things. The scene is “Default Room - All Down” and followed by “Master Bedroom - MB Down”. I have defined 18 scenes in the iPad PowerView app which all show up in Indigo. This scene activation is what caused the stack trace that I sent yesterday.

2. I can also open individual Blinds from an Indigo Control Page Button that executes an action group to Set Shade Position. I have two of these action groups for each window blind (open and close) and 6 combo action groups that call the individual action groups (like close all living room blinds). I have a couple of test action groups to test the jog and calibrate function. About 50 in total.

3. I can open all the Blinds in a room from a Control Page Button that executes an actions group. That action group calls all of the individual action group for the blinds in that room.

4. I can use the iPad PowerView app to open and close individual blinds or to run scenes.

5. The one action group command, “leaving home”, (from Number 1 above) executes the scene “Default Room - All Down” and followed by “Master Bedroom - MB Down”.
According to the PowerView plugin log, it took more than 6 minutes to run (from 2023-11-07 17:23:14.472 to 2023-11-07 17:30:31.141).
This time there was no stack dump.
The PowerView plugin log is a bit too big to post here online. Maybe I could send it as an attachment somehow.

6. Attached are my debugging lines for opening the Dining Room blinds from one Action Group. It calls 5 other action groups. It opens about a third of the number of the above blinds. I added my temporary debugging lines to see what was happening. It looks similar to the log for opening/closing all the blinds - just shorter. It took about two minutes. If the attachment works, I can send a PowerView plugin log tomorrow.
Attachments
Log1.txt
(5.88 KiB) Downloaded 292 times

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests