Logitech Harmony removes local API

do I need to upgrade my Harmony Hub now to the latest firmware? I get since 0.84.5 following error message “Update for remote.harmony_hub fails”
I’m still on 201 on my harmony hub

if you are on 84.5 , 201 should still work, or you can download the older harmony.py file, and load it as a custom component, so you can still work with the classic api

Guys, I think we have some good news:

a little time ago i try to reset my (2 day…) new harmony hub (for this story of break local api)with desktop app and ,surprise!software inform me that they are a new fw update (4.15.210)that RESTORE xmpp api .(with warning that this is for developer and are not secure and bla bla ).
now i try to load

How did you update to this?

@Fdovio - how did you get the firmware to show?

This looks exciting. Do we know if 0.84.4+ will still use the local API or is it web socket only now?

Waiting on the same info here. Everything is working with web socket its just a bit slow on my voice commands from Google Home. Local API was much faster and I would prefer to use it if 0.84.x will support both.

I think I see the issue. When I press the button to turn on my TV in the HA GUI, it immediately turns on, but takes a LONG time for the GUI to reflect that. Just like you see.

Here’s what’s going on in the logs ass soon as I press the button:

2018-12-21 12:29:15 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:19 WARNING (MainThread) [homeassistant.helpers.entity] Update of remote.living_room is taking over 10 seconds
2018-12-21 12:29:20 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:26 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:32 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:38 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:44 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:50 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:29:56 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:30:02 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05
2018-12-21 12:30:08 WARNING (MainThread) [homeassistant.components.remote] Updating harmony remote took longer than the scheduled update interval 0:00:05

Then it immediately throws this error:

2018-12-21 12:30:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for remote.living_room fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 528, in transfer_data
    msg = yield from self.read_message()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 580, in read_message
    frame = yield from self.read_data_frame(max_size=self.max_size)
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 645, in read_data_frame
    frame = yield from self.read_frame(max_size)
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 710, in read_frame
    extensions=self.extensions,
  File "/usr/local/lib/python3.6/site-packages/websockets/framing.py", line 100, in read
    data = yield from reader(2)
  File "/usr/local/lib/python3.6/asyncio/streams.py", line 672, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 347, in async_device_update
    await self.async_update()
  File "/usr/src/app/homeassistant/components/remote/harmony.py", line 205, in async_update
    activity_id = await self._client.get_current_activity()
  File "/usr/local/lib/python3.6/site-packages/pyharmony/client.py", line 234, in get_current_activity
    'vnd.logitech.harmony/vnd.logitech.harmony.engine'
  File "/usr/local/lib/python3.6/site-packages/pyharmony/client.py", line 184, in _send_request
    return await self._wait_response(msgid)
  File "/usr/local/lib/python3.6/site-packages/pyharmony/client.py", line 190, in _wait_response
    response_json = await self._websocket.recv()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 350, in recv
    yield from self.ensure_open()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 501, in ensure_open
    self.close_code, self.close_reason) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
2018-12-21 12:30:09 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 528, in transfer_data
    msg = yield from self.read_message()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 580, in read_message
    frame = yield from self.read_data_frame(max_size=self.max_size)
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 645, in read_data_frame
    frame = yield from self.read_frame(max_size)
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 710, in read_frame
    extensions=self.extensions,
  File "/usr/local/lib/python3.6/site-packages/websockets/framing.py", line 100, in read
    data = yield from reader(2)
  File "/usr/local/lib/python3.6/asyncio/streams.py", line 672, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/service.py", line 277, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/src/app/homeassistant/components/remote/harmony.py", line 240, in async_turn_on
    await self._client.start_activity(activity_id)
  File "/usr/local/lib/python3.6/site-packages/pyharmony/client.py", line 289, in start_activity
    response = await self._wait_response(msgid)
  File "/usr/local/lib/python3.6/site-packages/pyharmony/client.py", line 190, in _wait_response
    response_json = await self._websocket.recv()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 350, in recv
    yield from self.ensure_open()
  File "/usr/local/lib/python3.6/site-packages/websockets/protocol.py", line 501, in ensure_open
    self.close_code, self.close_reason) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason

So it appears that that it’s expecting a reply of some sort, but it never comes, then then the connection times out after 30s or so and life goes on.

I’ll vote for the use of the old api. The new web version is very very slow. Unless the response time could be adjusted. Plus Logitech has warned us that only xmpp will be officially supported.

Hell. When I click update I get a blank screen with the option to return to firmware update screen or return to login screen. Am I missing a step?

Seems like they listened. Time to buy a lottery ticket :sunglasses:

So, to revert back to using the fast XMPP instead of slower websockets:

  1. Update to beta Harmony firmware .210
  2. Downgrade HA to 0.84.2
  3. Win!

Right?

So many threads now… many people are suggesting the websockets api is more superior – is this true or not? Without knowing the implementations details, I’m not sure which to support.

Can you link me where it is stated the Websocket API might be more superior? Have not seen an argument for this yet.

On Logitech community forums…where it all began. In responses to Logi_WillWong, some say both websockets is more superior and making it more superior than XMPP. I haven’t seen any specific claims or reasons why. I personally am not familiar with XMPP protocol from a technical perspective.

https://community.logitech.com/s/question/0D55A00008D2zYD/harmony-hub-fw-415206?s1oid=00Di0000000j2Ck&s1nid=0DB31000000Go9U&emkind=chatterCommentNotification&s1uid=0055A00000ANkIm&emtm=1545424706322&fromEmail=1&s1ext=0

Amazingly @Logitech’s point about this being a security directive, was true: a Research Advisory
While I never accused them of trying to manipulate some sort of subscription model, going forward, I suspected as much. So apologies to Logitech for any of us that did openly accused them of that, their intentions were true.
Having seen that the firmware’s written in Lua and that two of the three main offending parts of the advisory could be locked down by removing 2 if statements and a little fudgepackery applied for the third, I think Logitech’s response to lock the Api down alltogether, was complete overkill.
Nevertheless, let the good times roll again! I was struggling to get my system running properly with the websockets implementation.

Hope @IanHarmony will remain in the forum as an official/unofficial Logitech representative?

I have been using harmony hub for 2 years and it started out like a really nice product. Then it got really laggy, unusable.

Read these forum posts:
https://community.logitech.com/s/question/0D55A00007Vv0XESAZ/harmony-hubbased-remotes-service-interruption-and-lag

And decided to block internet access for the hub due to all pubnub requests.

Still slow, I don’t use it anymore.

Doesn’t people face major lag using it?

1 Like

It is true. The websocket API is modern and easier to integrate with. It is the API used by the iOS app. As such, it is also the API where new development will happen.

Note that the websocket API is local. I know it has “web” in its name but HA talks directly to the hub. It is not the cloud API. I think this point has confused a lot of people and I find it unfortunate that this confused anger has forced Logitech to commit to maintaining the legacy XMPP interface. We would have been better served by official support for the websocket API. Still, commitment to any API is obviously a major step forward.

The current slowness is due to Home Assistant, not Logitech. The HA websocket support was thrown together in a day and it is not complete. It changed from push to poll which means delays. The bug that @ha_steve points out makes the delay even longer than it should be. These things will be fixed in Home Assistant 0.85.

(Full disclosure: I once implemented PR #10218 which moved XMPP from poll to push, removing a similar slowness that the XMPP protocol once had in HA)

@amelchio Will HA continue to use the websocket API? If so maybe we could support @Logitech through a transition next year where we can help support other implementers/users transition accross to the websocket API slowly, under Logitech’s control with plenty of communication to 3rd Parties.
Is that something Logitech would consider @IanHarmony? That way you could eventually close the XMPP Api and bring documented support to the WS API?

I know this websocket connection is local, no question there. I was just curious which is actually better. Websockets tend to have a better potential as it’s an established socket connection vs individual request messages – right? Sure, it will need more attention to become truly robust and speedier. Currently I’m on fw 206 and using ws API, no need to revert back to xmpp.