Sony Bravia TV component with Pre-Shared Key

Can you share the config.yaml file for the bravia_psk part?

- platform: braviatv_psk
   name: Bravia
   host: 10.x.x.x
   mac: ff:ff:ff:ff:ff:ff
   android: True

Actually even if I commented this out I still had that error in log. I had to rename custom_components so that HA doesn’t try to use this.

Is your folder/file structure like this?

config/
  custom_components/
    media_player/
        braviatv_psk.py

Yes. Exactly like this.
Edit 1:
Yesterday I updated 0.67.1 (that’s what .HA_VERSION shows) and just now I enabled your component without any problems. When I had probs with this earlier I just renamed custom_components to c_components and commented out relevant entries in configuration. Now I reversed all this and… it just works… Can’t say I understand… Must be something in the platform…
Anyway I’m testing this now :slight_smile:
Edit 2:
Is it supposed to re-use bravia.conf created with HA media_player.bravia? I’m using PIN mode with Bravia Android TV 2015 (currently running Android 7.0). Your component cant distinguish between tv beeing on or off but that’s all it can. Can’t turn it of or on, can’t change volume can’t even see what’s playing. PIN is correct cause media_player.bravia works correctly at the same time

This component has been working great, however, I just realized that my Source List is no longer showing (not sure when it stopped).

It does show a good sized list in Dev States, but not on the front end. Any ideas?

I’m on the latest version found HERE

{
  "volume_level": 0.19,
  "is_volume_muted": false,
  "media_content_type": "tvshow",
  "media_series_title": "No info (resumed after pause or                                           app opened)",
  "source_list": [
    "KASA HD",
    "NMPBS",
    "H and I",
    "Movies!",
    "KRQE",
    "FoxNM",
    "MeTV   ",
    "KWBQ-TV",
    "Bounce",
    "HDMI 1",
    "HDMI 2",
    "HDMI 3/ARC",
    "HDMI 4",
    "Video 1",
    "Video 2/Component"
  ],
  "friendly_name": "Sony Bravia",
  "supported_features": 23993
}

Are you on the beta version of HA (0.68)?
Then this issue will have caused it I think
https://github.com/home-assistant/home-assistant/issues/14098.

1 Like

I am indeed, not sure why the beta train didn’t cross my mind with this error,

Thanks for finding that and thanks for your hard work on this component!

1 Like

Can this component be used to extract the status of the App? I have a Sony Bravia Android TV, the default component only shows the input on HA. If I’m using any streaming service, it only shows ‘App’
I want an automation based on the status of the TV when streaming (idle, playing, paused etc)
Is this possible using this custom component?

That is not possible as the TV doesn’t provide the idle, playing, paused etc. info via the API.

@gerard33

This is working great for me, thank you so much!
Is it possible to now pass commands through home assistant via ifttt to select sources or channels etc?
It would also be great if we can set volume by percentage like in this video?

Hello, I just setup sony bravia tv with pre-shared key. I used default config setting from the github. However, I would like to be able to change the app like netflix and spotify. How do I put in the config or any other setting need. Please kindly advice.

  - platform: braviatv_psk
    name: Sony TV
    host: !secret sony_ip
    psk: sony
    mac: !secret sony_mac
    amp: False
    android: True
    sourcefilter:
      - ' HD'
      - HDMI

The media player in ha frontend show correctly, I can turn on/off. In Source show hdmi1-4. I would like to be able to change to netflix and other apps from ha frontend as well.

I do that with this method.

or

Thank you very much. I will try Sony Bravia TV tonight.

I still cannot do the share project youtube part o.O"

I get all the commands. Thank you very much. So…must be a lot of script to use by alexa and google.

I really just use it for Netflix and I programmed two channels on my cable box that I go to often.

  netflix:
    sequence:
      - service: shell_command.netflix
      - delay: 00:00:04
      - service: shell_command.left
#      - delay: 00:00:01
      - service: shell_command.enter
  cnbc:
    sequence:
      - service: switch.turn_on
        entity_id: switch.tv
      - delay: 00:00:03
      - service: shell_command.hdmi4
      - delay: 00:00:01
      - service: shell_command.num1
      - delay: 00:00:01
      - service: shell_command.num4
      - delay: 00:00:01
      - service: shell_command.num3
1 Like

Can you advice in the shell_command.netflix example.

shell_command:
  netflix: '/home/homeassistant/.homeassistant/bravia/./send_command.sh 192.168.1.66 AAAAAgAAABoAAAB8Aw=='

So it has to be ./send_command.sh ip command

Did you download the program and get it working?

https://github.com/breunigs/bravia-auth-and-remote/archive/master.zip

Yes. I have download and rename the folder to bravia and put in homeassistant folder. Then I also do the print_ircc_codes.sh to get all the commands.

Can you control your tv from the command prompt?

./send_command.sh 192.168.1.66 AAAAAgAAABoAAAB8Aw==

Yes. I can control via ssh. But when putting in shell_command. Do I have to put in with full directory where the send_command.sh is?

I have test send_command.sh via pi user which bravia folder is also in pi account. So I relocated the folder bravia to be in homeassistant folder to use shell_command.