Create Sensor for Bravia PSK Apps using curl command

Hi all…

I’m currently using the Bravia PSK Integration which is working fine, along with Mini Media Player, again, working fine.

I use the Media Player to call a service to start up specific apps.
Ideally I’m wanting to add another button for a Facebook Video… The documentation (here) shows you can call a service to show all the apps you can launch.

I’m struggling to do this and was curious whether I could create a sensor to return the available options?


braviatv_psk.bravia_open_app

If you have an Android TV you can use an uri to open the corresponding app.

You can use the following command to get all uri’s from the TV:

curl -H 'Content-Type: application/json' -H 'X-Auth-PSK:[psk]' -X POST -d "{'id': 1, 'method': 'getApplicationList', 'version': '1.0', 'params': ['']}" http://[IP]/sony/appControl

Change **[u][psk][/u]** with your psk and **[u][IP][/u]** with the IP address of the TV.

Can anybody help with this?

So I tried the below, but still no luck…

sensor:
  - platform: command_line
    command: curl -H 'Content-Type: application/json' -H 'X-Auth-PSK:1234' -X POST -d "{'id': 1, 'method': 'getApplicationList', 'version': '1.0', 'params': ['']}" http://192.168.0.12/sony/appControl
    name: curltest

Any recommendations?

What happens if you try that curl on command-line, or use Postman to do the equivalent?

I’m trying to make it dynamic within Home Assistant…

The goal is to have two ‘helpers’

YT Video URL: (input text box)
Media Player: (dropdown list - template of all available media players)

Then an automation, so you can input the URL, then when you select the media player an automation runs to cast the URL to the selected media player.

Issue I’m having is creating the dynamic list of available Media Players.

Sure, but if the curl doesn’t work in the first place, it won’t work better in HA :wink:

1 Like

ah, sorry… to slightly change the question…
So if they return ok, next step is to add them to a list.

If I run something similar to this in the Template, it looks fine.
But when I add that to an input list, it just returns the text.

      ["{{ states.media_player
       | rejectattr('state', 'equalto', 'off')
       | rejectattr('state', 'equalto', 'idle')
       | map(attribute ='entity_id')
       | join('", "')
      }}"]

In the template

I think this is the issue…
image