IP control of Sony TV with HA

I would try this if it fits your needs.

thanks. I want to make use of the shell commands. but I am not sure how to find the path of where config folder is on hassio

Hi, can you explain this for me? I have a sony android tv and try to get this to work

I don’t use hass.io but I think its fairly tied down so you might no be able to run shell commands on the same machine as the hass.io.

You can try another computer on the network like here.

In my opinion, the braviatv-Integration should be extended with this commands (from the soap-interface I think?)

The REST API on which the integration is apparently based does not provide that much functions.

I need to simulate remote-input like arrow keys…


I made a remote in the past and I am still using it. You can read all about it here:

This could be a workaround for you. It is for me…

Thank you, I stumbled over this while google-ing. I will have a look at it - as it is a native sony feature, I guess IRCC-IP is quite responsive.
I set up ADB and the androidtv integration, but this is laggy and input takes 2 seconds to happen on the TV…

The thing with the REST API of the Sony TVs is, that quite a few things aren’t documented. Depending on what you want to do there might even be an interface for that.

With this payload


You can get all possible methods from an API endpoint. With this command I was able to find the method getSceneSetting from the /videoScreen endpoint to get all “Scenes” (picture modes) from my Bravia as well as the current one. With that I can now easily automate switching my TV into “game” mode when my AVR has a gaming console selected as source or “cinema” mode when watching Netflix since the picture mode enables or disables certain post processing effects which reduce input lag.

Building a REST command around the /ircc interface wouldn’t be so difficult. I gave it a try:

    url: 'http://{{ host }}/sony/ircc'
    method: POST
      Content-Type: 'text/xml; charset=UTF-8'
      SOAPACTION: 'urn:schemas-sony-com:service:IRCC:1#X_SendIRCC'
      X-Auth-PSK: '{{ psk }}'
    payload: >-
              <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
                  <IRCCCode>{{ ircccode }}</IRCCCode>

And here is a simple button card which now sends the ‘AAAAAQAAAAEAAABgAw==’ IRCC code which maps to the home for my Bravia.

type: button
  action: call-service
  service: rest_command.sony_bravia_tv_send_ircc_code
    host: <your bravia ip>
    psk: <your private shared key>
    ircccode: AAAAAQAAAAEAAABgAw==
  action: more-info
show_icon: true
show_name: true
name: Home
icon: 'hass:home'

This works fine for my KDL-55W805B, you might have to change the URL path to /sony/IRCC instead of /sony/ircc in the rest_command as my older model seems to use /sony/IRCC where as the documentation from sony suggests /sony/ircc.

If you want a full list of IRCC commands that your TV supports just send the payload


to the /sony/system endpoint

If you want to try out stuff just use a rest client for testing, like Advanced REST Client or Postman.

And about that, I’m afraid this won’t happen as the integration is a simple media_player entity and the media_player component only supports changing sound modes, sources, volume, media playback and media information. Adding functionality that is specific to Sony Bravias or other TVs would mean the devs had to extend the default media player entity to support that as well.

In my opinion we should have more specific components for TVs and AVRs, then the other devs who do integrations could add more features as well since they wouldn’t be bound by the available methods of media_player entity interface.


Great, thanks a lot! :beers:
I created a feature request to extend the braviatv integration.

However, I will follow your example and build a rest bridge which I can utilize in the meantime (I am quite new to HA, but I think I see what you did there :slightly_smiling_face:).

I kickstartered for a YIO-remote (Touchscreen remote for HA) and in the end I want to be able to get rid of the ugly original sony remote and control everything with YIO.

Glad I could help.

Don’t get your hopes up too high for your feature request to go through though, but you might want to link it here so everybody can upvote it to increase the chance. :slight_smile:

The YIO-remote thingy looks pretty damn cool, thanks for sharing!

Edit Oh I forgot, the interfaces mentioned in the Sony documentation aren’t all available interfaces. But you can get all possible API endpoints by sending the following payload to the /sony/guide interface


Which will return an overview of all possible endpoints, then you can just crawl through every endpoint by sending the {"method":"getMethodTypes","params":[""],"id":1,"version":"1.0"} payload I mentioned before. With that you can map the complete API of your TV and use rest sensors and rest commands to control everything.

Hi @shawly

Thank you very much for your input, I will set this up in my environment. I think after this I don’t even need the requested features!

Don’t get your hopes up too high for your feature request to go through though, but you might want to link it here so everybody can upvote it to increase the chance.

braviatv-Integration - support IRCC-IP :slight_smile:

Best regards


Hi @shawly
I set up the rest_command. I forgot the PIN I had to enter when I set up ADB, so I created a PSK which I think should work too?

I am trying to send

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
            <IRCCCode comment="Home">AAAAAQAAAAEAAABgAw==</IRCCCode>

with header


But I am getting the following error:

<?xml version="1.0"?>
                <UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
                    <errorDescription>Invalid Action</errorDescription>

Does this ring any bells for you?

Never mind, I found it. The action in the header needs to be within quotation marks:


Oh alright. :smiley:

Great solution, i tried to implement it but im gettin error.Does anyone has any solution for this? what should i check. I also tired with ircc lowercase, same error.

Logger: homeassistant.components.rest_command
Source: components/rest_command/init.py:132
Integration: rest_command (documentation, issues)

Error. Url: http://xxx.xxx.xxx.xxx/sony/IRCC. Status code 500.

Send your entity configs, nobody can guess whats wrong without seeing the configuration.

I have the same error as @meternich

WARNING (MainThread) [homeassistant.components.rest_command] Error. Url: Status code 500.
  url: ''
  method: POST
    Content-Type: 'text/xml; charset=UTF-8'
    SOAPACTION: 'urn:schemas-sony-com:service:IRCC:1#X_SendIRCC'
    X-Auth-PSK: "mike01"
  payload: >-
            <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
                <IRCCCode>{{ ircccode }}</IRCCCode>

I have tried all various things but cannot get passed this. The call works if I use another REST client (ie Postman). I suspect the Xml payload is not getting through…but not sure why. Any tips would be greatly appreciated.

The payload is fine, your issue is either that the PSK you sent is wrong or the ircccode you’ve sent is invalid.
How do you test your rest_command? Did you create a button in lovelace or are you using the developer tools for sending the data? Please post the other stuff as well.

I have tried a ton of stuff. If the PSK is incorrect the HTTP response is a 403. For testing, the ircc code is hardcoded and I have tested it with another REST client. TBH I am out of ideas. I might have to step through the rest_command and see what the response is along with the 500 status code.

On my KDL-55W805B, the error response is 500 if the wrong PSK is sent.
But if you say the same data works in Postman your best bet is to turn on debug logging to see what has been sent to your TV.
Or you could use an interceptor to send the request to so you can see what home assistant is sending to your TVs API with something like this https://intercept.rest/