Project: "game time" automations in Home Assistant - PS5 now-playing lights, Xbox dashboard reset, Switch bedtime limits

Discuss various Gaming Consoles and Smart Home Integrations
Post Reply
User avatar
ZerOne
Site Admin
Posts: 216
Joined: Sun Dec 13, 2020 8:21 am

A practical project that links the consoles in the house to Home Assistant and builds four small automations. It follows the Home Assistant PlayStation Network, Xbox, Nintendo Switch Parental Controls and Wake on LAN integration pages and the ps5-mqtt README as at October 2026. I have not run every piece on my own hardware, and entity names will differ on your install, so test each step in Developer tools first and post your corrections.

Step 1: PlayStation Network (now playing)
  1. Sign in to playstation.com in a private browser window. The HA docs recommend this, especially with several PlayStation accounts, and say to close the window afterwards without logging out, because logging out invalidates the token.
  2. In Home Assistant go to Settings > Devices & services. If PlayStation Network was discovered, set it up. Otherwise add the integration and follow the link in the dialog to get your NPSSO token. Paste it in.
  3. You should get a media player per console, and sensors including Now playing, Online status and Last online. The docs say the active state only reports for the last used device. The NPSSO token lasts two months, after which HA prompts you to re-authenticate. Treat the token as a password.
Optional: for PS5 wake/standby (rest mode) install the community ps5-mqtt add-on. You need an MQTT broker and MQTT auto-discovery. The README says to add the repository, install the add-on (not the edge version), configure it, start it and use its web UI to authenticate with each console. Entities then appear automatically when a console is discovered on your network. It is a community project, so read the README and check its issue list first.

Step 2: Lights when a game starts

Using the Now playing sensor (name it for yours). Check in Developer tools > States what the sensor reads when nothing is running, because the exact "idle" state may differ:

Code: Select all

alias: "Game on: lounge lights down"
triggers:
  - trigger: state
    entity_id: sensor.my_psn_now_playing
conditions:
  - condition: template
    value_template: >
      {{ trigger.to_state.state not in ['unknown', 'unavailable', 'none', ''] }}
  - condition: sun
    after: sunset
actions:
  - action: scene.turn_on
    target:
      entity_id: scene.lounge_gaming
Create a matching "gaming over" automation that restores the previous scene when the sensor returns to its idle state. Cloud APIs are polled (every 30 seconds for PSN), so expect a delay rather than instant reaction.

Step 3: Xbox

The Xbox integration needs a non-child (18+) Microsoft account, remote features turned on (Settings > Devices & connections > Remote features), and "cloud:" or "default_config:" in your configuration because it uses Home Assistant Cloud's account-linking service. It gives you a media player and remote entity. From the Xbox docs, this example sends it back to the dashboard each night:

Code: Select all

alias: "Return to the Xbox dashboard at night"
triggers:
  - trigger: time
    at: "23:00:00"
actions:
  - action: media_player.play_media
    target:
      entity_id: media_player.xboxone
    data:
      media_content_id: "Home"
      media_content_type: app
Limitation: an Xbox in energy saving mode cannot be woken from Home Assistant. For remote wake, it must be set to sleep mode, which uses significantly more power, so weigh up the electricity cost.

Step 4: Switch bedtime and screen time

The Nintendo Switch Parental Controls integration needs a token from your Nintendo account. The HA docs say you must obtain it on a device without the official parental controls app installed. Follow the dialog's link in the setup. You get these entities:
  • Used screen time and Time remaining sensors;
  • a Max screentime today number (-1 for unlimited);
  • a Restriction mode select (same limit each day or different per day);
  • a Suspend software switch that suspends running software at the bedtime alarm.
The docs also describe setting max screentime to 0 and turning Suspend software on to "lock" the Switch. A cloud connection is required, and the Switch must be online to send usage data. Use it with your kids' agreement, and keep the PIN to yourself.

Step 5: Wake a gaming PC

The Wake on LAN integration sends a magic packet. The docs suggest a helper button plus an automation (a better pattern than a switch if you do not need "off"). Use their YAML for the action, with your own PC's MAC address:

Code: Select all

action: wake_on_lan.send_magic_packet
data:
  broadcast_port: 9
  mac: 00:11:22:33:44:55
The docs say not to change the broadcast port unless you have configured the device to listen elsewhere. Wake on LAN must be enabled in the PC's BIOS/UEFI and network adapter settings. It generally works only on the same subnet as the PC, so a VLAN split needs a directed broadcast or relay. Test it before relying on it.

Safety and security
  • Tokens (NPSSO, Nintendo, Xbox) are account logins. Never post them or screenshots of them. Revoke or re-issue if exposed.
  • Do not port-forward to a console or PC. Remote access to Home Assistant itself should use a VPN or an encrypted remote-access service.
  • Keep the consoles' system software up to date.
Links
Question for the group: which game-time automations have you built for the household, and which ones did the family actually put up with?
Post Reply

Return to “Games Console Integration”