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

No longer connecting with a Virgin (GB) box #82

Closed
dickthespoon opened this issue Jan 10, 2024 · 131 comments
Closed

No longer connecting with a Virgin (GB) box #82

dickthespoon opened this issue Jan 10, 2024 · 131 comments
Assignees
Labels
bug Something isn't working

Comments

@dickthespoon
Copy link

Describe the bug
Integration no longer working, not connecting to Virgin (GB)

To Reproduce
Steps to reproduce the behaviour:
Look in Devices and Services and Integration is red and entity is not available

Expected behaviour
Entity to be available

Version of the component
v0.5.3 installed

Logging
2024-01-10 19:52:19.894 ERROR (SyncWorker_2) [lghorizon.lghorizon_api] Giving up connect(...) after 11 tries (AttributeError: 'LGHorizonAuth' object has no attribute 'username')
2024-01-10 19:52:19.895 ERROR (MainThread) [custom_components.lghorizon.config_flow] 'LGHorizonAuth' object has no attribute 'username'

Additional context
Tried removing and re-adding, it just spins for a while then says can't connect. All details used for login are correct, double checked with Virgin TV Go app and that is logging in and all working correctly.

@dickthespoon dickthespoon added the bug Something isn't working label Jan 10, 2024
@ChrisThomas42
Copy link

I'm having the same issues. Posted details here, #62. I first noticed the problem around mid morning today 10/1/24.

I've tried rebooting HA and Virgin box. I then removed the device but I can't add it back in getting the above error.

@Shivy011
Copy link

Same issue

@dickthespoon
Copy link
Author

dickthespoon commented Jan 11, 2024

Just adding what's seen in the debug log:

2024-01-11 13:35:48.508 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Connect to API
2024-01-11 13:35:48.508 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 1 - Get Authorization data
2024-01-11 13:35:48.797 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 2 - Get Authorization cookie
2024-01-11 13:35:49.024 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 3 - Login
2024-01-11 13:35:49.179 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 4 - Follow redirect
2024-01-11 13:35:49.265 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 5 - Extract auth code
2024-01-11 13:35:49.265 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Auth code: ******, Auth state: ************************
2024-01-11 13:35:49.265 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Step 6 - Post auth data with valid code
2024-01-11 13:35:50.054 DEBUG (SyncWorker_10) [lghorizon.lghorizon_api] Obtain Virgin GB mqtt token...
2024-01-11 13:35:50.054 INFO (SyncWorker_10) [lghorizon.lghorizon_api] Backing off connect(...) for 1.0s (AttributeError: 'LGHorizonAuth' object has no attribute 'username')

**Auth code and Auth state redacted!

@KEV-github
Copy link

Same here.

@beanian
Copy link

beanian commented Jan 11, 2024

Also happening here, Virgin Media Ireland

@ArkadiuszSilevis
Copy link

It happened to me, but UPC Poland.

@Pieter-Geerts
Copy link

Same issue with Telenet (BE)

@KEV-github
Copy link

It happened to me just after an update to 2024.1.1

@bdormael
Copy link

same here for Telenet BE

@davepearson1628
Copy link

I'm having the same problem - tried reverting to 2023.12.4, still had the same problem, also reverted to v.0.5.2 and still no connection to my Virgin Media UK devices.

@Sholofly
Copy link
Owner

I suspect there's something changed in the way authentication is implemented by LG. If someone in GB would like to share credentials and a VPN, I can take a look. Find me as Sholofly on discord.

@Sholofly
Copy link
Owner

Sholofly commented Jan 13, 2024

For CH is a beta version available.v0.5.4b0

@ChrisThomas42
Copy link

@Sholofly I'm in the Uk but we're away visiting sick relative for the next few days. I'll make contact when we get back home.

@steuerzentrale
Copy link

For CH is a beta version available.v0.5.4b0

I could test it, I am based in Switzerland. how can I get the beta in order to give feedback?

@robertwigley
Copy link

@Sholofly I am in the UK and happy to assist any way I can. What exactly do you need, my Virgin Media login? Unfortunately, I don't have a VPN.

@BrauseP
Copy link

BrauseP commented Jan 14, 2024

For CH is a beta version available.v0.5.4b0

Works in CH

@robertwigley
Copy link

robertwigley commented Jan 14, 2024

For CH is a beta version available.v0.5.4b0

I could test it, I am based in Switzerland. how can I get the beta in order to give feedback?

In HACS find the integration, click the three dots at the top right, select "Redownload", toggle on "Show beta versions", select the new beta version and click "Download" and restart HA. To switch this off and/or revert, toggle the switch back to off and you can redownload the non-beta version.

@steuerzentrale
Copy link

yes, can confirm too that it is working in CH with v05.4b0

@robertwigley
Copy link

I thought I would try v0.5.4b0 on the off chance it also fixed it for Virgin Media in the UK. Unfortunately not.

@callumeveratt
Copy link

@Sholofly Looks like VM (GB) may have moved MQTT servers?
image

@ChrisThomas42
Copy link

@Sholofly I've only used discord once before so bear with! I've just sent you a friend request. We're home for a day or so, we're waiting the inevitable with my Mother-in-Law.

@Sholofly
Copy link
Owner

I've released a new beta version. That should be sufficient for other countries that don't use oAuth to log in. Unfortunately GB, IE en BE use oAuth and something has changed in the auth. I am on it.

@Sholofly
Copy link
Owner

yes, can confirm too that it is working in CH with v05.4b0

Can you confirm its still working in 0.5.4b1?

@BrauseP
Copy link

BrauseP commented Jan 16, 2024

yes, can confirm too that it is working in CH with v05.4b0

Can you confirm its still working in 0.5.4b1?

No. v0.5.4b1 don't working in CH

@Sholofly
Copy link
Owner

Sholofly commented Jan 16, 2024 via email

@BrauseP
Copy link

BrauseP commented Jan 17, 2024

@ArkadiuszSilevis
Copy link

v0.5.4b1

Works for me. Thanks!!

@marcelkornblum
Copy link

Are you still looking for someone from GB with Virgin to help? I could take a backup and give you direct access to my setup if that'd be useful, or happy to debug with you.

@Sholofly
Copy link
Owner

Updated the component. @ColinRobbins a massive Thank You! Please let me know if this fixes it for all the GB users!
Be aware! UK users have to remove and re-add the current configuration from HA

@robertwigley
Copy link

Thanks @Sholofly @ColinRobbins. I will give this a try at some point over the next few days.

@xtruss
Copy link

xtruss commented Oct 12, 2024

I would like to thank all those on here that are tring to get this working, for the likes of me who wouldnt have a clue on where to start. I have just tried the latest version with the following result.
image

@ColinRobbins
Copy link
Contributor

ColinRobbins commented Oct 12, 2024

Is there anything in your log files?

At a first guess, I suspect this is the same issue as...
#130

@ColinRobbins
Copy link
Contributor

Please also be aware, you can only use the refresh token once.
If something fails, you need to shut the browser down on the virgin tivo page, re-open the page, and capture a new token.

I dont think that is the error here, as it should say "authentication failure" if that happens.

@xpenno255
Copy link

I would like to thank all those on here that are tring to get this working, for the likes of me who wouldnt have a clue on where to start. I have just tried the latest version with the following result. image

That token looks too short in length? I used the whole string under the encoded section of the JWT Debugger and mines working.

@xpenno255
Copy link

Just to report that I reinstalled everything this morning and I've got control back. It's amazing after all this time. Thankyou so much to everyone who contributed!

@xtruss
Copy link

xtruss commented Oct 12, 2024

Thank you, yes it was my fault and the token was to short. I have done it again and it works. Sorry for the false info, and once again thank you to all that have made this work,

@ColinRobbins
Copy link
Contributor

That’s great news.

A shout out to @caraar12345 as it was his research on the refresh token that set us on the path to a solution.

@woody166
Copy link

woody166 commented Oct 12, 2024

Just one question, do we download from the original repository or from Colin's forked repository?

@xpenno255
Copy link

Just one question, do we download from the original repository or from Colin's forked repository?

This repo

@ChrisThomas42
Copy link

Why is it always me.... I can't get it to work. I been through the process a few times this morning but I'm stuck with the spinning wheel. I have installed the new version and restarted HA, logged out of ALL instances I can find of VirginMedia, TVGo and email and when I go the TVGo page I'm asked to login on that platform. I found using Firefox with the JWT extension much easier than Chrome and the extension, so I'm getting this from Firefox. The key I get has not changed since yesterday despite me logging in and out several times of the app on my laptop and the web page.

manifest.json is reporting
"requirements": [ "lghorizon>=0.7.0" ],

The error in the logs;

Logger: lghorizon.lghorizon_api
Source: /usr/local/lib/python3.12/site-packages/backoff/_common.py:120
First occurred: 12:21:54 (4 occurrences)
Last logged: 12:22:08
Giving up _authorize(...) after 3 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Invalid token)

So with the fact that the key hasn't changed since yesterday and this comment makes me think that I'm not logging out somewhere perhaps?

Please also be aware, you can only use the refresh token once.
If something fails, you need to shut the browser down on the virgin tivo page, re-open the page, and capture a new token.
I dont think that is the error here, as it should say "authentication failure" if that happens.

Any suggestions?

@ColinRobbins
Copy link
Contributor

I think the "Invalid Token" messsage means the token is correctly formatted, but has been previously used, so rejected.

If using Firefox I suggest trying to login to Virgin from a "New Private Window", which should force a new token to be generated.

@ColinRobbins
Copy link
Contributor

Just one question, do we download from the original repository or from Colin's forked repository?

This repo - best to use HACS and you'll get correct version.

@dnwlmz
Copy link

dnwlmz commented Oct 12, 2024

Just wanted to say a big thank you to you all for figuring this out 💯 🥇
image

@Sholofly
Copy link
Owner

Happy to close this issue. Thanks again for everybody who contributed to the solution but @ColinRobbins in particular!

@ChrisThomas42
Copy link

Hmm, interesting..... If I use Firefox I get the same token as I did yesterday evening whether normal or private browsing. In Chrome in both normal and incognito browsing I get

Waiting for request with authorization: Bearer [token]

and I never get anything in the dialog box? I even tried Edge with the same result. Time for a coffee and a head scratch

@KEV-github
Copy link

Well done to everyone.

@Catkin75
Copy link

Catkin75 commented Oct 12, 2024 via email

@davepearson1628
Copy link

davepearson1628 commented Oct 12, 2024 via email

@ChrisThomas42
Copy link

Big thank you to everyone who's managed to get this working, let's hope VirginMedia don't change anything!?!?!

My issue I believe was user incompetency! I restarted laptop, turned off Tailscale, fired up Firefox, logged into VirginTVGo and got a different token. Fired up the Integration and success. Let's see if I disabled those old scripts and automations or did I delete them....

@Shivy011
Copy link

Hi all, thanks for sharing and updating, much appreciated.
I am having a constant egg timer when pressing submit after filling in details, has anyone had this?

@Sholofly
Copy link
Owner

Do you see an error in the log?

@ChrisThomas42
Copy link

@Shivy011 I was having this yesterday morning. For me to get it going, I restarted laptop, stopped Tailscale and used Firefox Private window, then following @ColinRobbins guide above, login to VirginMediaTVGo then in the JWT extension make sure that you select "flutter WEB Storage..." and copy the WHOLE token.

I'm suspecting that I didn't copy the whole key, but now everything is working for me, at least until ViginMedia change things again....

@xpenno255
Copy link

@Sholofly / @ColinRobbins after I updated to 0.62 my integration won't start and seems like it needs a new token. Is there an easy way to update the token or do I need to remove and re-add? Is this expected?

@ColinRobbins
Copy link
Contributor

This just happened to me too. Wierd, it did not happen in my dev environment, but is happening in live.
Not quite sure what is happening yet.

Sadly, you have to delete and re-add. Not as bad as it seems and the entities will have the same id’s, so cards and automations will still work.

We could modify the config to make this easier with a “re-configure” config_flow, a bit of a work around rather than a fix.

My guess is something is causing the token to expire, so the initial refresh token is used, but we are not trapping the event and storing the new refresh token generated.
I expect it to be fixable, but will take a bit to figure it out - sadly mostly guess work.

@ColinRobbins
Copy link
Contributor

ColinRobbins commented Oct 14, 2024

I left mine running with debug logs all night, and today.
I can see the problem.

2024-10-14 13:02:42.249 INFO (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Executing API call to https://spark-prod-gb.gnp.cloud.virgintvgo.......
2024-10-14 13:02:42.453 DEBUG (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Authorizing via refresh
2024-10-14 13:02:42.989 DEBUG (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Authorization succeeded
2024-10-14 13:02:42.991 INFO (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Backing off _do_api_call(...) for 0.6s (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://spark-prod-gb.gnp.cloud.virgintvgo.virginmedia.com/......
2024-10-14 13:02:43.618 INFO (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Executing API call to https://spark-prod-gb.gnp.cloud.virgintvgo.virginmedia.com/eng......
2024-10-14 13:02:43.775 DEBUG (Thread-113 (_thread_main)) [lghorizon.lghorizon_api] Result API call: {'imageVersion': 'mRh9TA', 'eventId'.......

When the box has been switched off, and then turns on, it gets a 401-Unauthorise error. from the API It reconnects using the refresh token, and this generates a new refresh token - but we are not catching the new token, and updating the config.

@Sholofly - I didn't spot this before, as the "raise" call, does not produce any log info.

            raise LGHorizonApiConnectionError(
                f"Unable to call {url}. Error:{str(httpEx)}"
            )

Not quite sure why

Its fixable, but not quite sure how yet.
Need to store a new token from the library back to the component. Maybe add something to the async_update to check if a new token has been created, and if so, store it.

Not got time now, hopefully by the weekend.

@Catkin75
Copy link

Catkin75 commented Oct 14, 2024 via email

@ColinRobbins
Copy link
Contributor

ColinRobbins commented Oct 14, 2024

Continuing this restart discussion via #136 as this thread is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests