Using Google Assistant to start apps on PS4

I thought I’d share an integration I’ve been using for a while now. I can say Hey Google, start Netflix on the PS4 or Hey Google, start Horizon on the PS4 to wake the PS4 and start the app/game I asked for. This works whether the PS4 is in standby or in another app. It’s faster to use this to switch between Amazon and Netflix than using the remote.

Requires: IFTTT.com & ps4-waker.

Set up an IFTTT applet:

Google Assistant: Say a phrase with a text ingredient

What do you want to say?
Start $ on the PS4

What do you want the Assistant to say in response?
OK, Here's $

Webhooks: Make a web request
https://xxxx.example.org:8123/api/services/homeassistant/turn_on?api_password=yourpassword

Method
POST

Content Type (optional)
application/json

Body (optional)
{"entity_id":"script.ps4_start_x", "variables":{ "title": "{{TextField}}"} }

Note: IFTTT needs the space between the last two } characters, otherwise it’ll think it’s closing another TextField

In HA, add the script that IFTTT invokes, which converts the (case sensitive) text string to the Sony App ID:

# Starts the PS4 with the specified App
# use with "Start $ on the PS4"
  ps4_start_x:
    alias: "PS4 Start X"
    sequence:
      - service: shell_command.ps4_start_app
        data_template:
          app_id: >
            {% if (title == "Netflix") %}
                CUSA00127
            {% elif (title == "Amazon") %}
                CUSA00126
            {% elif (title == "Horizon") %}
                CUSA07320
            {% endif %}
#     Also kick the Harmony hub to turn on TV & Amp:
      - service:  remote.turn_on
        data_template:
          entity_id: remote.hubi
          activity: 20685489

Finally the shell command which wakes the PS4 & starts the app:

shell_command:
  ps4_start_app: 'ps4-waker start {{ app_id }} -c /home/homeassistant/.homeassistant/.ps4-wake.credentials.json'

I hope this is useful!

4 Likes

Good stuff, the shell_command thing is new to me, I’ll have to check it out. Thanks for posting!

So what url do I put for the web hook, and what is HA?