Sholofly / lghorizon

Custom integration to control LG Horizon settop boxes for Ziggo(NL), Magenta(AT), UPC(CH), Virgin(GB, IE), Telenet(BE)
GNU General Public License v3.0
58 stars 13 forks source link

Giving up connect / KeyError: 'refreshToken #110

Open steuerzentrale opened 6 months ago

steuerzentrale commented 6 months ago

Describe the bug The integration seemed to stopped working (UPC/Sunrise Switzerland), I dont get any status-updates anymore. I deleted the integration from HACS and reinstalled it again. I cannot get the integration to work, please see the log below. Maybe something changed at the providers backend.

environment Core 2024.2.1 Supervisor 2024.01.1 Operating System 11.5 Frontend 20240207.1

Version of the component v0.5.9

Logging Logger: lghorizon.lghorizon_api Source: /usr/local/lib/python3.12/site-packages/backoff/_common.py:120 First occurred: 09:46:18 (1 occurrences) Last logged: 09:46:18

Giving up connect(...) after 11 tries (KeyError: 'refreshToken')

Additional context I cannot share debug-logs because I cant get the integration to work at all anymore.

Ton-O commented 6 months ago

I'm having similar problems. Connection fails most of the time with: 2024-02-16 14:04:39.780 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon 2024-02-16 14:05:39.865 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon 2024-02-16 14:06:39.942 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon 2024-02-16 14:07:40.020 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon 2024-02-16 14:08:40.090 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon 2024-02-16 14:08:41.951 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxxxx for lghorizon Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/lghorizon/init.py", line 50, in async_setup_entry await hass.async_add_executor_job(api.connect) asyncio.exceptions.CancelledError: Global task timeout 2024-02-16 14:08:41.964 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward 2024-02-16 14:13:44.569 ERROR (SyncWorker_6) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (paho.mqtt.client.WebsocketConnectionError: WebSocket handshake error)

Sometimes a reboot of HA does work (for a short period).

Ton-O commented 6 months ago

I need to add that after several restarts of HomeAssistant, the integration started working again; not sure for how long, but worth while mentioning.

DaveCamenisch commented 6 months ago

Same problem here since a few days...

2024-02-18 10:23:19.143 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon
2024-02-18 10:24:19.250 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon
2024-02-18 10:25:19.369 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon
2024-02-18 10:26:19.479 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: lghorizon
2024-02-18 10:27:15.169 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 079xxxxxxx for lghorizon
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/lghorizon/__init__.py", line 50, in async_setup_entry
    await hass.async_add_executor_job(api.connect)
asyncio.exceptions.CancelledError: Global task timeout
2024-02-18 10:27:15.180 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
filip-heens commented 6 months ago

same here, suddenly LG Horizon wouldn't start anymore when restarting . So I eventually I removed the integration and reinstalled it. But now it won't even log in anymore?

I'm having these errors in the home-assistant.log (I guess that's where I have to go looking for erors? ;) 2024-02-18 23:33:22.742 ERROR (SyncWorker_12) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)) 2024-02-18 23:33:22.744 ERROR (MainThread) [custom_components.lghorizon.config_flow] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000) 2024-02-18 23:36:05.421 ERROR (SyncWorker_13) [lghorizon.lghorizon_api] Giving up _do_api_call(...) after 3 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token. Error:401 Client Error: Unauthorized for url: https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token) 2024-02-18 23:36:21.239 ERROR (SyncWorker_13) [lghorizon.lghorizon_api] Giving up _do_api_call(...) after 3 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token. Error:401 Client Error: Unauthorized for url: https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token) 2024-02-18 23:36:21.241 ERROR (SyncWorker_13) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token. Error:401 Client Error: Unauthorized for url: https://spark-preprod-be.gnp.cloud.telenet.tv/auth-service/v1/mqtt/token) (I did select Telenet and not Telenet PREPROD)

Next trial 2024-02-18 23:43:32.959 ERROR (SyncWorker_8) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)) 2024-02-18 23:43:35.897 ERROR (MainThread) [frontend.js.latest.202402071] Uncaught error from Edge 121.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'domain') keyFunction (src/panels/config/integrations/dialog-add-integration.ts:464:16) keyFunction (src/virtualize.ts:116:41) r (src/directives/repeat.ts:56:28) ct (src/directives/repeat.ts:93:52) update (src/directive.ts:134:16) $AS (src/lit-html.ts:1085:23) S (src/lit-html.ts:1362:12) _$AI (src/async-directive.ts:366:18) setValue (src/virtualize.ts:139:13) dispatchEvent (src/Virtualizer.ts:808:23) 2024-02-18 23:43:39.239 ERROR (MainThread) [frontend.js.latest.202402071] Uncaught error from Edge 121.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'domain') keyFunction (src/panels/config/integrations/dialog-add-integration.ts:464:16) keyFunction (src/virtualize.ts:116:41) r (src/directives/repeat.ts:56:28) ct (src/directives/repeat.ts:93:52) update (src/directive.ts:134:16) $AS (src/lit-html.ts:1085:23) S (src/lit-html.ts:1362:12) _$AI (src/async-directive.ts:366:18) setValue (src/virtualize.ts:139:13) dispatchEvent (src/Virtualizer.ts:808:23) 2024-02-18 23:43:42.132 ERROR (MainThread) [frontend.js.latest.202402071] Uncaught error from Edge 121.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'domain') keyFunction (src/panels/config/integrations/dialog-add-integration.ts:464:16) keyFunction (src/virtualize.ts:116:41) r (src/directives/repeat.ts:56:28) ct (src/directives/repeat.ts:93:52) update (src/directive.ts:134:16) $AS (src/lit-html.ts:1085:23) S (src/lit-html.ts:1362:12) _$AI (src/async-directive.ts:366:18) setValue (src/virtualize.ts:139:13) dispatchEvent (src/Virtualizer.ts:808:23)

image

rudi159 commented 6 months ago

Hi,

I have been experiencing the same problem: since 2 days (after restarting HA due to an update) the integration cannot be loaded anymore and delays the startup of HA. (i'm using Telenet in Belgium)

This is my logfile without personal info: lghorizon failed to setup.txt

Thanks in advance for looking for a cause or solution,

Rudi

filip-heens commented 6 months ago

Issue is due to expired horizon.tv SSL certificate 😉 ☹ See issue 114 for more information Guess we’ll have to wait ☹

Ton-O commented 6 months ago

Issue with certificate seems to be fixed now.

DaveCamenisch commented 6 months ago

Nope, still not working here... 🙁 I tried to reinstall the connection, but it's still the same problem:

2024-02-20 10:02:13.729 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxxxx for lghorizon File "/config/custom_components/lghorizon/init.py", line 50, in async_setup_entry 2024-02-20 10:07:19.403 ERROR (SyncWorker_3) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (KeyError: 'refreshToken')

Ton-O commented 6 months ago

Sorry to hear that. I restarted HomeAssistant because this issue was mentioned as solved. After reboot, iintegration worked again.

steuerzentrale commented 6 months ago

I deleted the HACS-integration and re-installed it. Still got the error like @DaveCamenisch

Logger: lghorizon.lghorizon_api Source: /usr/local/lib/python3.12/site-packages/backoff/_common.py:120 First occurred: 19:10:58 (1 occurrences) Last logged: 19:10:58

Giving up connect(...) after 11 tries (KeyError: 'refreshToken')

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.lghorizon.config_flow Source: custom_components/lghorizon/config_flow.py:58 Integration: lghorizon (documentation, issues) First occurred: 19:10:58 (1 occurrences) Last logged: 19:10:58

'refreshToken'

reda1978 commented 6 months ago

Same issue as @steuerzentrale and @DaveCamenisch

I guess we'll have to wait or something changed with moving to sunrise infrastructure after merger.

scachemaille commented 6 months ago

I have the same issue. I tried to debug lghorizon-python to see.. and this is the response I get when it try to authorize in _authorize_default

{' accessToken': 'xxxxx', 'householdId': 'anonymous' }

I replaced the accessToken by xxxx ;) There is no username or refreshToken field

steuerzentrale commented 6 months ago

are there any updates/news on this issue?

Ton-O commented 6 months ago

are there any updates/news on this issue?

It has been working for me from the moment I reported it as solved. No issues anymore.

DaveCamenisch commented 6 months ago

@Ton-O are you using the LG Horizon Integration with UPC/Sunrise Switzerland?? I have not been able to establish a connection for about 4 weeks. Reinstallation, restart etc. all tested without success.

steuerzentrale commented 6 months ago

to add some context: I use UPC/Sunrise Switzerland and still experience the above mentioned issue, maybe it works fine with other providers, however UPC/Sunrise is not working anymore.

Ton-O commented 6 months ago

@Ton-O are you using the LG Horizon Integration with UPC/Sunrise Switzerland??

I have not been able to establish a connection for about 4 weeks. Reinstallation, restart etc. all tested without success.

No, using Ziggo (UPC) in the Netherlands.

DaveCamenisch commented 6 months ago

Ok, here in Switzerland the problem is unfortunately still there... 🙁 @Sholofly any ideas on this issue?

reda1978 commented 6 months ago

I can only confirm that now two weeks that it doesn't work anymore with UPC Switzerland. I am still wandering if sunrise is not merging servers.

reda1978 commented 5 months ago

Hello,

Did anyone from Switzerland fix the issue with UPC ?

Removed and re-added many times, but unsuccessful to connect...

steuerzentrale commented 5 months ago

@reda1978 No, I experience the same issue with Sunrise Switzerland which is the same as UPC. I am very happy to assist with data and testing as I dont have the knowledge to fix it.

reda1978 commented 4 months ago

@steuerzentrale I am too happy to insist but I am too not a code guy...

Anyhow, I hope it will somehow be fixed because it was so convenient when it was working

DaveCamenisch commented 4 months ago

+1 Yes, it would be really sad if it stopped working! @Sholofly 🫣

netrene commented 2 months ago

@Sholofly Really sad that it doesn´t work since monthes now in Switzerland. Can´t we check together how much effort it is to get it running again? Maybe just some Server adresses changed. I´m willing to help to get this fixed. Please help. René