Using Home Assistant for some weeks now and it works great
I have a Sony Bravia TV and I have used the braviatv platform, but that was not working very well for me.
After some days the state card wasn’t updating anymore and I got a lot of errors in the log. Only a restart of HASS would fix that problem.
I think this was caused by the PIN/cookie method which isn’t working fine (at least not in my setup).
That’s why I have made a custom component which is using a Pre-Shared Key to connect to the TV instead of the PIN/cookie method.
I am using this component for some weeks now without any issues, so now sharing it here and hopefully other Sony Bravia owners are pleased to test and use it as well.
Please let me know if you have found any issues or have suggestions to improve the component .
The changes I have made to the braviatv component are:
- use of Pre-Shared Key instead of connecting with a pin and the use of a cookie
- option for amplifier: don’t show volume slider when amp is attached as the volume slider only works for TV speakers
- option for Android: turn TV on with other method as WakeOn LAN doesn’t work on Android
- possibility to filter source list to avoid a long list with unused channels and radio stations
The following changes are only available if the built-in TV tuner is used
- show program info on second line of state card, this will also show the start and end time of the program
- pause/play TV when TV is playing, otherwise normal pause/play function is used
- channel up/down with next and previous buttons when TV is playing, otherwise normal previous/next function is used
See the bottom of this post for some more screenshots.
Installation instructions Home Assistant
__init.py from here and place that file in the folder
custom_components/braviatv_psk/ in your config folder (for HA 0.88 and newer, for older versions of HA rename the file to
braviatv_psk.py and place it in the folder
Add the following to your
media_player: - platform: braviatv_psk name: MyBraviaTV host: 192.168.1.191 psk: sony mac: AA:BB:CC:DD:EE:FF amp: True android: True sourcefilter: - ' HD' - HDMI
- name (Optional): The name to use on the frontend, defaults to Sony Bravia TV
- host (Required): The IP of the Sony Bravia TV, eg. 192.168.1.191
- psk (Required): The Pre-Shared Key of the Sony Bravia TV, eg. sony (see below for instructions how to configure this on the TV)
- mac (Required): The MAC address of the Sony Bravia TV (see below for instructions how to get this from the TV)
- amp (Optional): Boolean, defaults to False. Set this to True if you have an amplifier attached to the TV and not use the internal TV speakers. Then the volume slider will not be shown as this doesn’t work for the amplifier. Mute and volume up and down buttons are there and working with an amplifier.
- android (Optional): Boolean, defaults to False. Set this to True when you have an Android TV as these TV’s don’t respond to WakeOn LAN commands, so another method of turning on the TV can be used.
- sourcefilter (Optional): List of text that is used to filter the source list, eg. ’ HD’ (with quotes) will only show TV channels in the source list which contain ‘HD’, eg. ‘NPO 3 HD’ (in my config this will only show HD channels)
Installation instructions TV
- Enable remote start on your TV: [Settings] => [Network] => [Home Network Setup] => [Remote Start] => [On]
- Enable pre-shared key on your TV: [Settings] => [Network] => [Home Network Setup] => [IP Control] => [Authentication] => [Normal and Pre-Shared Key]
- Set pre-shared key on your TV: [Settings] => [Network] => [Home Network Setup] => [IP Control] => [Pre-Shared Key] => sony
- Give your TV a static IP address, or make a DHCP reservation for a specific IP address in your router
- Determine the MAC address of your TV: [Settings] => [Network] => [Network Setup] => [View Network Status]
I would like to add some more functionalities, but need some help from the community to get this working.
Any ideas how to add the following points?
- The Play/Pause button is not shown on the card (between the previous and next buttons).
- I want to show the progress bar (the orange bar in eg. the Sonos component) which shows the progress of the current TV program. I have tried to add this using this and this, but the bar is not shown. Maybe that has to do with point 1?
- When starting the TV with the on/off button, the TV will only respond around a minute after starting. That is also the time the card will show that the TV is on. I would like the card to instantly show the TV is on and with the text ‘TV starting’.
Some automations added with a TV channel list and a play/pause TV button