[SOLVED] Is it possible to get notification which certain game was started on Playstation 4

Hi guys. I’m using Playstation 4 as one of my integrations with HA. I already configured some custom component for PS4 remote control, launching games with voice via Tasker and AutoVoice from Android phone and I also configured Pushbullet notification and HA Android app notification to arrive on my phone, when some game or PS4 application is started.

Is it possible to have some HA variable for currently started game, so I can use it in message text and get an info which certain game was started? E.g. something like this:

Action type: Call service
Service: notify.mobile_app_myphone
Service data:
message: >-
Hi! This is the automated message from your Home Assistant: The $gamevarible was just started
title: The $gamevarible was just started

I know this way already exist in Tasker for Android (I’m using it lot), but I cannot figure out is it something like this possible in HA.

I also know that all PS4 games which were ever started, by time HA was connected to PS4, were already noted in .ps4-games.json file (in config directory), so I assume data can be pulled from here.

Thanks in advance.

When a game is started. Do you see the game name as an attribute of the Playstation 4 media_player?

The automation you wrote is for a lovelace service call, but you want an automation that triggers everytime the game in your playstation 4 changes.

Can you please tell me the entity_id of the playstation 4 media player, then I can help you set up an automation.

source_list:
  - Far Cry® New Dawn
media_content_id: CUSA13885
media_content_type: game
media_title: Far Cry® New Dawn
source: Far Cry® New Dawn
friendly_name: PlayStation 4
icon: 'mdi:playstation'
entity_picture: >-
  /api/media_player_proxy/media_player.playstation_4?token=[...]&cache=bb999e8d7ce3f664
supported_features: 6529
1 Like

and the state changes to “playing”

Try something like this:

- alias: 'Leave Home notification'
    trigger:
      platform: state
      entity_id: media_player.playstation_4
    action:
      service: notify.mobile_app_myphone
      data_template:
        title: "The {{ state_attr('media_player.playstation_4', 'source') }} was just started."
        message: "Hi! This is the automated message from your Home Assistant: The {{ state_attr('media_player.playstation_4', 'source') }} was just started."
1 Like

Hi guys, thanks for answers. It is working with copy/paste of @Burningstone code, with slightly modifications. Now I know and understand syntax for HA. Thx, once again, topic solved.