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

Issue with Sony Bravia Integration after upgrade #123310

Closed
RobDemandt opened this issue Aug 7, 2024 · 32 comments · Fixed by #124113
Closed

Issue with Sony Bravia Integration after upgrade #123310

RobDemandt opened this issue Aug 7, 2024 · 32 comments · Fixed by #124113
Assignees

Comments

@RobDemandt
Copy link

RobDemandt commented Aug 7, 2024

The problem

After the upgrade, the integrations with 2 of my Sony TVs have been broken (requiring reauthentication). I am however not able to reauthenticate any more. I have removed existing connections from both TVs.

When attempting to authenticate, both TVs show a PIN. Upon entering the PIN in HA, I get a success message on the TVs, but a failure in HA and the integration does not work.

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

Previous version

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Bravia TV

Link to integration documentation on our website

https://www.home-assistant.io/integrations/braviatv

Diagnostics information

home-assistant_braviatv_2024-08-07T21-34-40.117Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Aug 7, 2024

Hey there @bieniu, @Drafteed, mind taking a look at this issue as it has been labeled with an integration (braviatv) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of braviatv can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign braviatv Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


braviatv documentation
braviatv source
(message by IssueLinks)

@TorbjornMohn
Copy link

I am seeing the exact same issue. Went back to 2024.7.4, and problem is gone. So something is broken on the authentication part in 2024.8. Hope it is sorted soon

@wisienoza
Copy link

Same problem here. Updated to 2024.8, restarted and i'm unable to authenticate anymore.

@sonyboypatrick
Copy link

I got the authentication failure message too. As mentioned on the reauthentication page psk auth should be more stable than pin and this did the trick for me.

@l-marchesi
Copy link

When attempting to authenticate, both TVs show a PIN. Upon entering the PIN in HA, I get a success message on the TVs, but a failure in HA and the integration does not work.

Same problem here, since the update it won't work anymore. Removing and adding did not help.

@sonyboypatrick Where can you set the PSK auth key? Looked in all menus on the TV but found nothing. I'd appreciate if you let me know how you did it, so that I can learn something 😄 Thanks in advance!

@karimbizid
Copy link

Yep. Got the exact same thing. Also curious about the PSK. I have found it in the menu on the TV (it's under local network settings), but I am just not savy enough to now where to get such a key. If I can provide anything to help fix this... let me know

@wisienoza
Copy link

wisienoza commented Aug 8, 2024

To me, using PSK has never worked with my XR55X90JAEP. Theoretically all you need to do is this:

  1. Enable pre-shared key on your TV: [Settings] => [Network] => [Home Network Setup] => [IP Control] => [Authentication] => [Normal and Pre-Shared Key].
  2. Set pre-shared key on your TV: [Settings] => [Network] => [Home Network Setup] => [IP Control] => [Pre-Shared Key] => sony

Unfortunately, after setting [Normal and Pre-Shared Key], the option to set [Pre-Shared Key] is grayed out and cannot be accessed. In addition, after restarting the TV [Authentication] is set to empty.

asdasd

@iEddy1985
Copy link

Same Problem.

@RobDemandt
Copy link
Author

I got the authentication failure message too. As mentioned on the reauthentication page psk auth should be more stable than pin and this did the trick for me.

Can confirm that this indeed does work and I switched over. However still worth checking the PIN authentication logic as there does appear to be a bug since the update.

@Drafteed
Copy link
Contributor

Drafteed commented Aug 9, 2024

Hi all!

Add this to configuration.yaml:

logger:
  logs:
    homeassistant.components.braviatv: debug
    pybravia: debug

Then restart HA and share the logs here please.

@wisienoza
Copy link

Hi all!

Add this to configuration.yaml:

logger:
  logs:
    homeassistant.components.braviatv: debug
    pybravia: debug

Then restart HA and share the logs here please.

I already restored the VM with the previous version of HA and wanted to wait with the installation of the new version until the problem is solved. If someone can collect these logs who is on the new version it would be great.

@Nokkasiili
Copy link

Home Assistant Core
2024-08-09 21:10:38.594 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration kodi_media_sensors which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-09 21:10:38.597 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration adaptive_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-09 21:10:38.598 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nordpool which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-09 21:10:38.600 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-09 21:10:38.601 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration browser_mod which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-08-09 21:11:00.036 DEBUG (MainThread) [pybravia.client] Connect with pin: 8198, psk: None, clientid: HomeAssistant, nickname: Home Assistant
2024-08-09 21:11:00.037 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': 'HomeAssistant', 'nickname': 'Home Assistant', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:11:00.246 DEBUG (MainThread) [pybravia.client] Response status: 401
2024-08-09 21:11:00.248 DEBUG (MainThread) [homeassistant.components.braviatv.coordinator] Finished fetching braviatv data in 0.212 seconds (success: False)
2024-08-09 21:11:56.893 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:11:57.072 DEBUG (MainThread) [pybravia.client] Response status: 200
2024-08-09 21:11:57.073 DEBUG (MainThread) [pybravia.client] Response result: {'error': [1, 'Internal Server Error'], 'id': 1}
2024-08-09 21:12:01.392 DEBUG (MainThread) [pybravia.client] Connect with pin: 0081, psk: None, clientid: 019690a892fd43bfb20e274ffb29489b, nickname: Home Assistant 019690
2024-08-09 21:12:01.393 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:01.576 DEBUG (MainThread) [pybravia.client] Response status: 401
2024-08-09 21:12:01.577 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:01.755 DEBUG (MainThread) [pybravia.client] Response status: 401
2024-08-09 21:12:11.089 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:11.263 DEBUG (MainThread) [pybravia.client] Response status: 401
2024-08-09 21:12:15.441 DEBUG (MainThread) [pybravia.client] Connect with pin: 3752, psk: None, clientid: 019690a892fd43bfb20e274ffb29489b, nickname: Home Assistant 019690
2024-08-09 21:12:15.441 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:15.727 DEBUG (MainThread) [pybravia.client] Response status: 200
2024-08-09 21:12:15.728 DEBUG (MainThread) [pybravia.client] Response result: {'result': [], 'id': 1}
2024-08-09 21:12:15.729 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/system, data: {'method': 'getSystemInformation', 'params': [], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:15.740 DEBUG (MainThread) [pybravia.client] Response status: 403
2024-08-09 21:12:15.741 DEBUG (MainThread) [pybravia.client] Request http://192.168.1.34/sony/accessControl, data: {'method': 'actRegister', 'params': [{'clientid': '019690a892fd43bfb20e274ffb29489b', 'nickname': 'Home Assistant 019690', 'level': 'private'}, [{'value': 'yes', 'function': 'WOL'}]], 'id': 1, 'version': '1.0'}, headers: {'Cache-Control': 'no-cache', 'Connection': 'keep-alive'}
2024-08-09 21:12:16.055 DEBUG (MainThread) [pybravia.client] Response status: 200
2024-08-09 21:12:16.056 DEBUG (MainThread) [pybravia.client] Response result: {'result': [], 'id': 1}

First one failed at TV and HA
Second one failed in HA but not in TV

@RobDemandt
Copy link
Author

Hi all!

Add this to configuration.yaml:

logger:

  logs:

    homeassistant.components.braviatv: debug

    pybravia: debug

Then restart HA and share the logs here please.

Already included mine with the initial issue creation ;)

@bmdadu
Copy link

bmdadu commented Aug 11, 2024

Hi. I was afraid to install 2024.8.1. Anyone knows if sony bravia integration is working now? În 8.0 ver it was broken. Thx

@bmdadu
Copy link

bmdadu commented Aug 11, 2024

It's working only with PSK authentification

@banan77
Copy link

banan77 commented Aug 11, 2024

Somehow it is working with PSK. My automations do not work as with PSK authentication it's very slow and dropping commands while with PIN it was working well so with 2024.8.1 integration is still broken

@Drafteed
Copy link
Contributor

@RobDemandt, @banan77 @bmdadu What language is set on the TV?

@banan77
Copy link

banan77 commented Aug 12, 2024

@RobDemandt, @banan77 @bmdadu What language is set on the TV?

Polish in my case

@wisienoza
Copy link

@RobDemandt, @banan77 @bmdadu What language is set on the TV?

Polish too

@RobDemandt
Copy link
Author

@RobDemandt, @banan77 @bmdadu What language is set on the TV?

Dutch in my case

@Drafteed
Copy link
Contributor

So, it seems that workaround with non-RFC cookie stop working after some aiohttp update.
Unfortunately, I don't have free time to check it now, but I will try to do it soon.

In the meantime, I recommend everyone to switch to PSK auth.
If TV does not have a PSK authorization menu, you can try to search it in the PRO mode.

@slovdahl
Copy link
Contributor

Is this PRO mode something every model has? I cannot seem to activate it on my KD-65X85J.

@wisienoza
Copy link

Is this PRO mode something every model has? I cannot seem to activate it on my KD-65X85J.

I believe Sony removed Pro Mode access from Android TV 10 or higher.

@slovdahl
Copy link
Contributor

I see, so I guess I'm out of luck then, no PSK auth for Android TV 10?

slovdahl added a commit to slovdahl/pybravia that referenced this issue Aug 16, 2024
aiohttp 3.10 and more specifically aio-libs/aiohttp#7944 changed the way cookies are handled. Previously, the domain did not have to be part of the cookie jar for a cookie to be used. As this was changed in 3.10, we now need to pass in the response URL when updating the cookie jar, otherwise the domain will not be part of the stored cookie, and consequently will not be used for the next request.

Fixes home-assistant/core#123310.
@slovdahl
Copy link
Contributor

slovdahl commented Aug 16, 2024

@Drafteed I digged into it a bit, and I think Drafteed/pybravia#28 fixes it.

@TorbjornMohn
Copy link

TorbjornMohn commented Aug 17, 2024

@Drafteed I digged in to it a bit, and I think Drafteed/pybravia#28 fixes it.

Yes.... Seems to work now with 2024.8.2. Just updated my testlab-system which skipped 2024.8.0 and 2024.8.1 for the bravia/Sony issue discribed here. Authentication now works with the old PIN setup! :-)

@slovdahl
Copy link
Contributor

Thanks for the confirmation @TorbjornMohn!

And just to make it clear: the fix I linked to is not part of 2024.8.2, it has to be manually applied until we get pybravia updated in Home Assistant.

@TorbjornMohn
Copy link

Thanks for the confirmation @TorbjornMohn!

And just to make it clear: the fix I linked to is not part of 2024.8.2, it has to be manually applied until we get pybravia updated in Home Assistant.

What ever changed from 2024.8.0 to 2024.8.2 has fixed the problem here, without any manually applied updated "pybravia"?

@Drafteed Drafteed mentioned this issue Aug 17, 2024
19 tasks
@slovdahl
Copy link
Contributor

Huh, that's interesting. Nice that it works, but that's unexpected.

I didn't actually test this in HA, but with my TV, pybravia before my fix, aiohttp 3.10.3 (same version as HA 2024.8.2) and a test script, I had a 100% failure rate yesterday. With aiohttp 3.9.5 it worked (same version as HA 2024.7).

@Drafteed
Copy link
Contributor

2024.8.3 is released. Can someone confirm that PIN auth is working properly?

@slovdahl
Copy link
Contributor

Works fine for me.

@banan77
Copy link

banan77 commented Aug 26, 2024

Works for me too

@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.