Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hdpowerview] All things are offline with PowerView Hub v1 #11856

Closed
jlaur opened this issue Dec 25, 2021 · 16 comments · Fixed by #11857
Closed

[hdpowerview] All things are offline with PowerView Hub v1 #11856

jlaur opened this issue Dec 25, 2021 · 16 comments · Fixed by #11857
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@jlaur
Copy link
Contributor

jlaur commented Dec 25, 2021

This issue was reported by Jeewan Bahra in a Community post

All things are offline, but seems to still be controllable.

This is a regression of #11534 which unfortunately was tested only with a v2 hub and with an assumption about API compatibility since Scene Collections are not marked with "V2 only" in the available documentation.

Expected Behavior

Binding should work correctly for both v1 and v2 hubs.

Current Behavior

Logged:
2021-12-24 20:51:41.763 [WARN ] [ternal.handler.HDPowerViewHubHandler] - Error connecting to bridge: java.util.concurrent.ExecutionException: "java.io.EOFException: HttpConnectionOverHTTP@107dadb::SocketChannelEndPoint@108d59a{l=/192.168.1.2:35804,r=/192.168.3.226:80,ISHUT,fill=-,flush=-,to=12/0}{io=0/0,kio=0,kro=1}->HttpConnectionOverHTTP@107dadb(l:/192.168.1.2:35804 <-> r:/192.168.3.226:80,closed=false)=>HttpChannelOverHTTP@1bd77f6(exchange=HttpExchange@183984{req=HttpRequest[GET /api/sceneCollections/ HTTP/1.1]@11cff9e[TERMINATED/null] res=HttpResponse[null 0 null]@a55162[PENDING/null]})[send=HttpSenderOverHTTP@6b9887(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@1d04057{s=START}],recv=HttpReceiverOverHTTP@1acb77c(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]"

Possible Solution

If scene collections are not supported by v1 hub, these channels should not be available and the binding shouldn't try to load them. If it's not possible to determine hub version, the binding should detect inability to load scene collections and stop polling.

Steps to Reproduce

Simply install and configure binding while having a v1 hub. Problem is in the bridge handler and occurs doing polling, so no actions are needed to reproduce the problem.

@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Dec 25, 2021
@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/hd-powerview-binding-connection-error/130552/5

@JeewanBahra
Copy link

JeewanBahra commented Dec 25, 2021

@jlaur thanks for creating this bug.

API Responses below:

http:///api/fwversion:

{
   "firmware":{
      "mainProcessor":{
         "name":"PowerView Hub",
         "revision":1,
         "subRevision":1,
         "build":857
      }
   }
}

http:///api/sceneCollections/: No response (error)

http:///api/scheduledevents:

{
   "scheduledEventIds":[
      
   ],
   "scheduledEventData":[
      
   ]
}

I can see both Scene and Scene Groups in the PowerView app. However, I can only create a Scene - not Scene Group....(not using scene feature)

Automation's are available on V1 but again not actively using this feature as this is being controlled through openHAB

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - thanks a lot for reporting this, this should make me able to provide a quick fix. For Hub v2 I get the following response (formatted):

{
	"firmware": {
		"mainProcessor": {
			"name": "PV Hub2.0",
			"revision": 2,
			"subRevision": 0,
			"build": 1056
		},
		"radio": {
			"revision": 2,
			"subRevision": 0,
			"build": 2610
		}
	}
}

So I can use this for correctly identifying hub version, which is good news in terms of being able to deliver a proper fix. For starters I will not be able to provide Scene Group compatibility with Hub v1 as it seems they have renamed/changed that method and I don't own a v1 hub for reverse engineering.

If you are using Android and able and willing to help with technical analysis, perhaps you can install Packet Capture.

It will allow you to start a recording. The only thing you would need to do is open the app freshly (after having flushed it) and go to the scenes activity. Then stop recording and have a look at the requests/responses. That information may provide information about how scene groups are fetched through v1 hub. Even though the feature is deprecated now, the app will probably still try to fetch existing scene groups, at least it does for me.

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - here's a jar file for testing:
https://drive.google.com/file/d/1rYCHiZu_jn0rP8nkS93PQrxG84BuMpsq/view?usp=sharing

I would very much appreciate feedback on:

  • Does it work?
  • Screenshot of the Hub Thing properties.

For me, properties look like this now with a v2 hub:

image

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - secondly I would like to follow up on the scene group issue with v1 hub.

  • As you can no longer create any scene groups from the app, do you have any existing ones?
  • If you have, would you be able to create a new automation referencing one of those scene groups?
  • If possible, after that please send me the response from http://<hub ip>/api/scheduledevents

First of all, I would love to be able to support scene groups for v1 hub also. Secondly, automations can reference scene groups. If scene groups are not supported, this can lead to warnings being logged when fetching automations referring to unknown scene groups.

A trace of the app loading scene groups would of course be really awesome, but seeing how automations referencing scene groups look like might also give enough information.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/hd-powerview-binding-connection-error/130552/8

@JeewanBahra
Copy link

JeewanBahra commented Dec 25, 2021

@jlaur - couple of updates;

I installed the Packet Capture app and gone through the process you outlined above. However, I'm not sure I'm understanding this correctly. Is there any way that I can export and attach here?

I hope I've done this correctly, I uninstalled the release version of PowerView and downloaded and placed the jar file into the 'openHAB-addons' folder.

With the above - I see no errors and bridge/rollershutters are all online.

Properties as follows:

image

The PowerView app just does not allow me to create a Scene Group. However, can create a normal Scene....(maybe this is only a V2 feature?)

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - thanks for verifying the fix. From your description you installed it correctly. So if I understand you correctly, this fix resolved your issue?

For the scene group reverse engineering: If you have created a capture from the PowerView:
image

you should be able to save it to a file:
image
image

If you have somehow upload/share the contents of that file, that would hopefully reveal how the app fetches scene groups, even if you don't have any. Please make sure that the file doesn't contain any information you wouldn't like to share.

jlaur added a commit to jlaur/openhab-addons that referenced this issue Dec 25, 2021
@JeewanBahra
Copy link

@jlaur - Yes, I can confirm the fix has worked perfectly - Thank you very much for this quick turnaround, it is most appreciated! :)

With regards to scene groups as I've mentioned it doesn't allow me to create - as soon as I click 'New Scene Group' it just closes and goes back to Scenes.

However, I attach a complete list of steps - one thing I have noticed is that the connection is always closed.

I hope these are helpful in some way shape or form :(

scenemember.txt
scenecollection.txt
scene.txt
scenecollectionmembers.txt

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - very useful, thanks!

Can you confirm that:

  • http://<hub ip>/api/sceneCollections/ fails
  • http://<hub ip>/api/scenecollections/ works

From your trace, this seems to be the difference. And for v2 hub scenecollections will automatically redirect to sceneCollections, so this would make it really easy to support both versions.

@JeewanBahra
Copy link

JeewanBahra commented Dec 25, 2021

@jlaur you are absolutely correct! :D

http://<hub ip>/api/sceneCollections/ failed
http://<hub ip>/api/scenecollections/ works

Output below:

{
   "sceneCollectionIds":[
      
   ],
   "sceneCollectionData":[
      
   ]
}

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@JeewanBahra - I have uploaded a new JAR (same link), can you try this one also? It should support scene groups for v1 hub, which you won't notice unless you enable debug logging. But most importantly, this version should work with your Hub without removing support for scene groups.

jlaur added a commit to jlaur/openhab-addons that referenced this issue Dec 25, 2021
@JeewanBahra
Copy link

@jlaur downloaded the new JAR and seems to be working as expected - no errors so far :)

@jlaur
Copy link
Contributor Author

jlaur commented Dec 25, 2021

@jlaur downloaded the new JAR and seems to be working as expected - no errors so far :)

@JeewanBahra, thanks a lot for all your assistance and quick feedback. Only because of that was I able to learn enough about the v1 hub to provide a quick fix for this issue.

For your information: I created #11857 which directly fixes this incompatibility issue found by your captured packets. This can probably be merged sooner as it doesn't contain all the other changes with firmware information etc. I'm very happy about this fix because we were able to preserve scene group support and didn't need any firmware version conditions, so thanks again!

#11853 is the "extended" fix with additional refactoring and adding firmware properties (for now just as information, but later can be used to select specific features to support).

@jlaur jlaur changed the title [hdpowerview] Regression in 3.2 with PowerView Hub v1 [hdpowerview] All things are offline with PowerView Hub v1 Dec 25, 2021
@JeewanBahra
Copy link

@jlaur, thank you for all the help and quick fixes - especially considering today is Christmas day!! Honestly greatly appreciated!

Also, thank you for the clarifications around what fixes have been put in place. :)

Have a great remainder of the festive period :)

lolodomo pushed a commit that referenced this issue Dec 26, 2021
jlaur added a commit to jlaur/openhab-addons that referenced this issue Dec 26, 2021
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this issue Dec 30, 2021
Fixes openhab#11856

Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Nick Waterton <[email protected]>
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 2, 2022
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 3, 2022
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 4, 2022
jlaur added a commit to jlaur/openhab-addons that referenced this issue Jan 6, 2022
mischmidt83 pushed a commit to mischmidt83/openhab-addons that referenced this issue Jan 9, 2022
Fixes openhab#11856

Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Michael Schmidt <[email protected]>
moesterheld pushed a commit to moesterheld/openhab-addons that referenced this issue Jan 18, 2022
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Jan 28, 2022
jlaur added a commit that referenced this issue Feb 4, 2022
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this issue May 5, 2022
andan67 pushed a commit to andan67/openhab-addons that referenced this issue Nov 6, 2022
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Nov 12, 2022
Fixes openhab#11856

Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Andras Uhrin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@openhab-bot @JeewanBahra @jlaur and others