8000 GitHub - phoinixgrr/ps5lm_ha: Start PS5LM (llama.cpp on a jailbroken PS5) on demand from Home Assistant: wake from rest mode, sign in, launch, stop, and the model and console metrics as sensors. · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2FgitHub.com%2Fphoinixgrr%2Fps5lm_ha","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=phoinixgrr%2Fps5lm_ha","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://gitHub.com/phoinixgrr/ps5lm_ha\",\"user_id\":null}}","auth_hydro_click_hmac":"4dcd0bb28b462aa03e56ab51a42eb27e595449ab3c6fd81fe53faae44bcc03fa"}}
phoinixgrrPublic

About

Start PS5LM (llama.cpp on a jailbroken PS5) on demand from Home Assistant: wake from rest mode, sign in, launch, stop, and the model and console metrics as sensors.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

Validate with HACS Action Validate with hassfest Action Tests

PS5LM for Home Assistant

On-demand local LLM inference on a PS5.

PS5LM runs llama.cpp on the GPU of a jailbroken PS5 and serves an OpenAI-compatible API (about 45 tok/s on Qwen 3.5 9B Q6_K). Keeping a console on all day for that wastes power and makes noise. This integration starts it when you need it and sends it back to rest mode when you are done.

Device page

Model dropdown

What it does

  • Wakes the PS5 from rest mode, signs the user in, starts PS5LM and waits until the model is loaded (about 2 minutes)
  • Stops PS5LM, or puts the whole console back to rest mode
  • Switches the loaded model: the dropdown lists the models on the console and restarts PS5LM with the one you pick
  • Exposes PS5LM and console metrics as sensors
  • Everything is a switch or a service, so automations can do it

How it works

  1. Wake packet over the Remote Play discovery port (UDP 9302)
  2. A Remote Play control connection signs the user in. A console woken from rest mode sits at the "press the PS button" screen and cannot launch apps until someone is signed in.
  3. ps5-payload-websrv (loaded via Payload Manager) launches PS5LM
  4. PS5LM's /health is polled until the model answers
  5. Rest mode is sent as a Remote Play control message

A model switch writes PS5LM's app-args.txt through the console's web file manager (port 8888, loaded via Payload Manager) and restarts the app, because a model cannot be swapped in place. A tuned command line per model can be kept as /data/PS5LM/profiles/<model>.args and is then used as it is; otherwise the current one is reused with the new model and a smaller context.

No cloud and no extra Python packages. The Remote Play part is a small Python re-implementation of what chiaki-ng does; chiaki-ng is only needed once, to register the console.

Requirements

  • A jailbroken PS5 with Payload Manager installed
  • PS5LM application installed on the console
  • ps5-payload-websrv payload loaded via Payload Manager (port 8080)
  • ps5-payload-filemanager payload loaded via Payload Manager (port 8888)
  • The console registered for Remote Play in chiaki-ng
  • On the PS5: Enable Turning On PS5 from Network (Settings > System > Power Saving > Features Available in Rest Mode) and Log In to PS5 Automatically (Settings > Users and Accounts > Login Settings)

Installation

HACS: add https://github.com/phoinixgrr/ps5lm_ha as a custom repository (category Integration), install PS5LM, restart.

Manual: copy custom_components/ps5_launcher/ to your custom_components/ and restart.

Configuration

  1. Get the Remote Play keys from chiaki-ng: python3 tools/chiaki_keys.py

  2. Settings > Devices & Services > Add Integration > PS5LM: enter the PS5 host and the two keys

    Setup
  3. The second screen has defaults for everything; change them only if your setup differs

Option Default
PS5LM title ID PPSA99575 (PPSA99581 for PS5LM Plus)
PS5LM API URL http://<host>:8081
websrv port 8080
ps5-exporter port 9100
Update interval 30 s
Console metrics interval 120 s
Model server / console metrics on

Everything except the host can be changed later under Configure.

Settings

Entities

Entity
Console switch on = awake, off = rest mode
Server switch on = start PS5LM (wakes the console if needed), off = stop PS5LM
Status Rest mode, Waking the console, Signing in, Starting PS5LM, Loading the model, Model ready, Starting the fleet worker, Fleet worker ready, ...
Model ready PS5LM answers its health check. Always off for a fleet worker, which has no model API
Model select the models on the console; picking one restarts PS5LM with it (about 2 minutes)
Model metrics model, context size, generation and prompt speed, active and queued requests, token counters, prompt cache hit rate
Console metrics CPU and SoC temperature, fan speed, PS5LM memory, uptime, free space

Metrics and diagnostics

Services: ps5_launcher.wake, ps5_launcher.standby, ps5_launcher.start_app, ps5_launcher.stop_app.

Automations

Entity IDs below are for a console added as ps5.home; check yours on the device page. Replace notify.notify and the conversation agent with your own.

R 8000 eady on demand

A script other automations can call: starts PS5LM if needed and returns once the model answers (fails after 5 minutes).

script:
  ps5lm_ready:
    alias: PS5LM ready
    mode: queued
    sequence:
      - action: switch.turn_on
        target:
          entity_id: switch.ps5lm_ps5_home_server
      - wait_template: "{{ is_state('binary_sensor.ps5lm_ps5_home_model_ready', 'on') }}"
        timeout: "00:05:00"
        continue_on_timeout: false

Ask the model, then sleep again

Wakes the console, asks the local model, sends the answer, and puts the console back to rest mode only if it was asleep before.

- alias: PS5LM morning briefing
  triggers:
    - trigger: time
      at: "07:30:00"
  actions:
    - variables:
        was_asleep: "{{ is_state('switch.ps5lm_ps5_home_console', 'off') }}"
    - action: script.ps5lm_ready
    - action: conversation.process
      data:
        agent_id: conversation.your_ps5lm_agent
        text: "Two short lines: today's weather and anything in the house that needs attention."
      response_variable: answer
    - action: notify.notify
      data:
        title: Good morning
        message: "{{ answer.response.speech.plain.speech }}"
    - if: "{{ was_asleep }}"
      then:
        - action: switch.turn_off
          target:
            entity_id: switch.ps5lm_ps5_home_console

Rest mode when idle

Two hours after the last generated token, counting every client (Assist, opencode, the web chat).

- alias: PS5LM idle to rest mode
  triggers:
    - trigger: time_pattern
      minutes: "/10"
  conditions:
    - condition: state
      entity_id: binary_sensor.ps5lm_ps5_home_model_ready
      state: "on"
    - condition: numeric_state
      entity_id: sensor.ps5lm_ps5_home_active_requests
      below: 1
    - condition: template
      value_template: >
        {{ now() - states.sensor.ps5lm_ps5_home_tokens_generated.last_changed > timedelta(hours=2)
           and now() - states.switch.ps5lm_ps5_home_console.last_changed > timedelta(hours=2) }}
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.ps5lm_ps5_home_console

It checks every 10 minutes rather than waiting with for:, because a Home Assistant restart cancels a for: wait and an idle model never changes the counter again. It only acts while the model is loaded: with PS5LM stopped the counter is unavailable, which would otherwise count as idle and send the console to rest mode in the middle of a game.

Rest mode when nobody is home

- alias: PS5LM off when the house is empty
  triggers:
    - trigger: numeric_state
      entity_id: zone.home
      below: 1
      for: "00:15:00"
  conditions:
    - condition: state
      entity_id: switch.ps5lm_ps5_home_console
      state: "on"
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.ps5lm_ps5_home_console

Overheat protection

Stops PS5LM if the hottest SoC sensor stays above 85 °C, and tells you.

- alias: PS5LM too hot
  triggers:
    - trigger: numeric_state
      entity_id: sensor.ps5lm_ps5_home_soc_temperature_hottest
      above: 85
      for: "00:02:00"
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.ps5lm_ps5_home_server
    - action: notify.notify
      data:
        message: >-
          PS5LM stopped: SoC at {{ states('sensor.ps5lm_ps5_home_soc_temperature_hottest') }} °C,
          fan {{ states('sensor.ps5lm_ps5_home_fan_speed') }} %.

Ready and failure alerts

- alias: PS5LM model ready
  triggers:
    - trigger: state
      entity_id: binary_sensor.ps5lm_ps5_home_model_ready
      from: "off"
      to: "on"
  actions:
    - action: notify.notify
      data:
        message: "{{ states('sensor.ps5lm_ps5_home_model') }} is ready."

- alias: PS5LM start or stop failed
  triggers:
    - trigger: state
      entity_id: sensor.ps5lm_ps5_home_status
      attribute: last_result
  conditions:
    - "{{ (trigger.to_state.attributes.last_result or '').startswith('failed') }}"
  actions:
    - action: notify.notify
      data:
        message: "PS5LM: {{ trigger.to_state.attributes.last_result }}"

Fleet worker mode

PS5LM v0.11 can run as an RPC worker for another machine's llama.cpp (fleet docs): put /data/PS5LM/fleet-worker.txt on the console and the app serves no model API at all, only an RPC endpoint (the file's first line, ip:port). The integration reads that file and adapts:

  • A start is ready when the RPC endpoint accepts a connection, not when /health answers (it never does). Status goes Starting the fleet worker, then Fleet worker ready.
  • Model ready stays off, so automations that treat it as "the model API can be used or closed" (an idle rest mode, a job stop) leave a worker alone.
  • The Model dropdown refuses to switch, with a message: a worker has no model of its own. Delete fleet-worker.txt and restart PS5LM to go back to a normal server.
  • A fleet-worker.txt without a valid ip:port first line fails the start at once instead of waiting 7 minutes.
  • Stop and Rest mode cancel a start that is still waiting for the model or the worker, instead of being refused until its 7 minute timeout ends.

An unauthenticated RPC port is probed (a plain TCP connect, no data) while a worker runs, about once per scan. Keep workers on a trusted network, as the fleet docs require.

Notes

  • Tested with PS5LM v0.9.1, websrv v0.34, filemanager v1.12 and ps5-exporter v0.2.0 on a CFI-1216A, Home Assistant 2026.10
  • The console handles one Remote Play session at a time. While chiaki-ng, the PS Remote Play app or a previous session is connected, rest mode (and the sign-in after a wake) is refused; the integration retries for up to 90 s and then shows "Failed: Remote Play is in use" in the Status sensor for 5 minutes. Close the other app and try again.
  • Reading the console metrics makes the console stall the model for a few seconds (the exporter walks the whole process table), so they are read only every 2 minutes and never while a request is running. Lowering the interval makes answers stutter.
  • A full power-off ends the jailbreak; etaHEN and websrv then have to be loaded again by hand
  • websrv and the PS5LM API have no authentication. Keep the console on a trusted network.

Credits and license

Built on PS5LM, chiaki-ng, ps5-payload-websrv and ps5-exporter.

AGPL-3.0, because the Remote Play code is derived from chiaki-ng. Not affiliated with Sony Interactive Entertainment.

About

Start PS5LM (llama.cpp on a jailbroken PS5) on demand from Home Assistant: wake from rest mode, sign in, launch, stop, and the model and console metrics as sensors.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0