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
New (0.84.5) harmony component fails with "websockets.exceptions.InvalidStatusCode" on 3 of 4 Harmony Hubs #19466
Comments
Heads up @ehendrix23 (blame @balloob he told me to tag you :P ) |
@aderusha. LOL. I will . Issue definitely is with not being able to switch from HTTP to web sockets. During testing when I saw this it was because the wrong hub ID was sent. Can you enable debugging in HASS for components homeassistant.components.remote.harmony and pyharmony.client? For example (you might already have logger there):
That will allow me to see what is being sent and received. I'm especially interested in the beginning parts when it is being setup and does 1st connection as that is when it gets the required information. Thx. |
I set |
OK, errors are not reported in there however I do also find it interesting already that I can only see send requests and responses for your Garden one. Can you send me the log information from the start till right after you see the errors appearing? Appreciate it. |
That is 100% the contents of the log with the following
The log entries repeat every 6 seconds. |
So right now no errors being reported? Seems to me that this time the 3 other's are "hanging" then as I do not see log entries there about them actually connecting. Can you try just 1 hub in your configuration (i.e bedroom)? I have 2 hub's here at home and both work, but just wanna see what would happen then. Further, can you run the following command just to check what version of websockets you have: Thx. |
From inside the venv:
Device is not created |
So it looks like it is hanging when trying to connect. Already updated the code here so that there is a timeout instead, but that won't solve you're issue except for getting an error then. :-) Just with the 1 hub, run it with debug again but this time let's add websockets in there:
I know we're able to connect otherwise we would not be able to get the hub id (7174072 for the bedroom one). Thus the question is why is it hanging when trying to connect with websockets. |
Updated logs with |
Well ....... You sure you wanna use those other 3? :-) Here is the portion of the log file:
So the web socket connection itself is failing (or being disconnected). When I researched this what I mainly found was stating about a firewall. Now I'm doubtful this is the case here, but can you think of anything different between the 3 HUBs that fail and the one that works? Anything from a network perspective? |
LOL, well up until your PR I wasn't able to use any of the 4, so being able to use 1 is a massive improvement :D All 4 Harmony Hubs and Hass are on the same VLAN and /16 address space. All 4 hubs are on the same WiFi SSID while Hass is a VM wired via 10gbit. There are no east/west firewalls in place and being on the same subnet/VLAN the traffic shouldn't traverse the router or be impacted by firewall rules. Prior to the firmware update all 4 Harmony devices were working as expected. Finally, from the Hass VM I can issue a Power cycling one of the hubs (in this case, the hub labeled "Living Room" @ 10.0.100.8) and changing |
I figured that but was hoping. :-) I know that from HASS we're able to connect 8088 cause we can get the Hub ID number. We use HTTP to get that information to the HUB on port 8088. But when we try to connect for Web Socket it fails. Any way you can do a packet trace between your HASS and a HUB that fails? Here is another idea. Do you have the Harmony app on a mobile device (i.e. iOS, Android)? If you do, are you able to connect from that app to those HUBs? It uses the same web socket API. I'm also switching to use the aiohttp websocket implementation. Makes more sense as I already use aiohttp. Maybe an issue in the websocket implementation? |
Harmony app on mobile devices (both Android and IOS) continue to work as expected against all 4 hubs. I executed a packet capture of unicast traffic between my Hass VM and the target hub "Living Room" @ 10.0.100.8 via the following command: In packet 16 we have a request being sent to the hub: |
I think I got it. :-) When doing the post, the response returned on my HUB for discoveryServerUri is https://svcs.myharmony.com/Discover/Discover.svc. Then when opening the websocket I provide: domain=svcs.myharmony.com In yours that is failing, it has https://svcs-preview.myharmony.com/Discover/Discover.svc instead. Interesting however that I'm not getting an exception there or so. Anyways, checking now how I can provide a fix to you for this. I need to know if my theory is right |
Ooooohhhh. So this MIGHT just be a "me" thing! Some long time ago Logitech had a beta forum and user group who would receive firmware updates before everyone else. They've since stopped doing that, but seeing that |
OK, I created what hopefully is a fix for this. Here is what you need to do:
Now restart HASS. In the logs it should show a warning about custom component. Check if this works. :-) |
CONFIRMED WORKING! That version now discovers and allows control of all 4 of my hubs. Now the component supports people who were in the beta group too! |
For anyone else, my plan is to get this into HASS itself with the next release as I do not believe too many would be impacted by this and for anyone who is there is a temporary solution available. |
I've got a full updated version ready using a new module I developed. This one will be able to better handle everything. If you would be willing to test it out and let me know of any issues. Working good here but then again I do not have every scenario here. :-) It has the following improvements:
How to update:
Now restart HASS. The new aiomodule will be downloaded automatically. If you have issues, reverting back is as easy as replacing harmony.py in your custom folder back with the copy made earlier (harmony.py.bak) and restarting HASS. Appreciate it! |
Here's the result on startup:
|
Well, that is definitely not the fireworks I was expecting. :-) Clearly something different between Python 3.6 and 3.7 here. Just pushed a new update. Download it with curl and see if that works. I might need to see to get Python 3.6 and 3.5.3 as well locally to test with. |
Updated version now works as expected across all 4 hubs! |
Home Assistant release with the issue:
0.84.5
Last working Home Assistant release (if known):
N/A - issue was triggered by changes made in latest Harmony firmware
Operating environment (Hass.io/Docker/Windows/etc.):
Standard Home Assistant install in a Python venv on Ubuntu 18.04 LTS. Details:
4 x Harmony Hubs running new 206 firmware.
Component/platform:
remote.harmony
Description of problem:
pip3 install websockets
configuration.yaml
Problem-relevant
configuration.yaml
entries and (fill out even if it seems unimportant):Traceback (if applicable):
The text was updated successfully, but these errors were encountered: