Sony Bravia TV component with Pre-Shared Key

Hello, this addon has completely broken for my after 0.94, my tv is just gone and i get this in the log:

Error while setting up platform braviatv_psk
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/braviatv_psk/media_player.py", line 90, in setup_platform
    [BraviaTVDevice(host, psk, mac, name, amp, android, source_filter)])
  File "/config/custom_components/braviatv_psk/media_player.py", line 99, in __init__
    from braviapsk import sony_bravia_psk
ModuleNotFoundError: No module named 'braviapsk'

Heeelp

Follow the readme from https://github.com/custom-components/media_player.braviatv_psk/blob/master/README.md and then it should work. Make sure to copy all files, so also __init__.py and manifest.json.
Not on 0.94 myself yet, so it’s untested, but I have seen that the packages of custom components need to be re-installed, which is in line with the error you have.

You can already use the TV as media_player in the Homekit integration of HA. Is that what you mean?

So you are saying i have to reinstall everything and it should work, Remove my current init.py. manifest.json, media_player.py removed and the do everything again?

It does work on 0.93 just not on 0.94

Edit: It did work, thanks

Are the other buttons working?

I don’t have Android TV on my Sony, so I guess that the code to start Netflix on Android TV is different. If you can find out that code, I can add it to the custom component.

Thanks for getting back to me Gerard, really appreciate your work on this.

Yes the other buttons work, including guide etc. Just Netflix, not sure how to find the code though, very new to all this.

At the moment the TV is exposed as Switch. But now you can use HomeKit as an Remote.

„ media_player TelevisionMediaPlayer All media players that have tv as their device_class . Represented as Television and Remote accessories in HomeKit to control on / off , play / pause , select source , or volume increase / decrease , depending on supported_features of entity. Requires iOS 12.2/macOS 10.14.4 or later.“

I’ve had a look and seen that com.netflix.ninja via adb is the command via shield which is android obviously, would this work?

se volessi usare questa versione (braviatv_psk.py) invece che quella con il custom component dove devo inserire il file? cosa cambia nella configurazione?

I don’t think that will work. The latest version of the component also supports the option to start GooglePlay. Can you try if that works (so replace id: Netflix with id: GooglePlay in your config)?

I didn’t know that was added, that seems to be a better solution indeed. Will try here if adding the device_class: tv works.

1 Like

I decided yesterday to add the TV again as a generic Android TV, I then modified the code by mcfrojd to create tthe below remote.

Next step for me is to make a few scripts using this to then integrate with your mini media player lovelace card.

1 Like

Cool. Tell me when you need a beta tester.

You can indeed do some beta testing :grinning:

I haven’t tried this version yet, but here it is-> https://gist.github.com/gerard33/4d1b62a626daddd298bd2ed53be8dc36

And this info is relevant -> https://www.home-assistant.io/components/homekit/#my-media-player-is-not-showing-up-as-a-television-accessory

Please let me know the results :+1:

1 Like

Thank you!

I’ve tested and confirm that it’s working. But I can not select the source. Do I need some configuration? In Home Assistant I can change the source.

Edit: Now I can see the sources. I don’t really know what happend. Maybe it is because I re-configured HomeKit.

Cool! Did you need to do anything in Homekit to make it work? Like removing the old entities?

I did remove the old entitties, restarted HA, add the new entitty and then it just works.

BUT you should care about your sources. If you don’t have any filters, you will have to much sources and HomeKit (or HA) has some issues with it. Maybe it is because of die 100 Device Limit? I am not sure. But I had to filter my sources to an minimum. But I guess, this is nothing for your component.

Hi Gerad, sorry, tested last night, doesn’t work I’m afraid

Yeah there is a limit to the number of devices in Homekit, believe that’s indeed 100 and it’s in the HA Homekit documentation. So in that case filtering is needed.

Were you able to only delete the Sony entities in Homekit? Because for me that’s not working. Or did you remove the entire Homekit integration and enable that again?

Ok so I have a question I’ve been trying to research the answer, so forgive me if this has been asked and answered already. I have a slightly older Sony TV. It is a KDL65W850A. It works with the built-in Bravia component, but just barely. It does not have the PSK functionality, just the PIN authentication. I can control sources, power, and volume, but that’s it.

Would the PSK version (this component) work with this TV and give me some more control such as channel control? In other words, does the PSK version have the normal PIN authentication built in?