Skip to content

Media player: "stop music" is routed to HassTurnOff and fails when turn_off is unsupported #32

Description

@michalkrzempek

Bug

A spoken request to stop music can be classified as turn_off for a media_player, which HA-Jev then routes to Home Assistant's HassTurnOff intent.

That fails for media players which support pause/stop but do not support media_player.turn_off.

Environment

  • HA-Jev: 1.16.0
  • Home Assistant Core: 2026.9.3
  • Target: Music Assistant media_player

Reproduction

Spoken Polish command:

Wyłącz muzykę.

("Turn off / stop the music.")

Assist STT recognized it correctly.

HA-Jev diagnostics:

Jev: turn_off, ok, confidence 0.97
Slots: {
  "name": {"value": "Chromecast Audio"},
  "domain": {"value": ["media_player"]},
  "preferred_area_id": {"value": "salon"}
}
entity: media_player.chromecast_audio 0.93
domain: media_player 1.00

The selected entity was correct. The failure happened when HA-Jev executed HassTurnOff:

intent HassTurnOff failed: Failed to call turn_off for: ['media_player.chromecast_audio']

homeassistant.exceptions.ServiceNotSupported:
Entity media_player.chromecast_audio does not support action media_player.turn_off

Home Assistant then returned:

Podczas przetwarzania zapytania wystąpił nieoczekiwany błąd

("An unexpected error occurred while processing the request.")

Why this appears to come from HA-Jev routing

Current custom_components/jev/interpret.py describes:

"turn_off": "Switch something off, close it, or stop it"

and maps:

"turn_off": ha_intent.INTENT_TURN_OFF

So "stop it" is semantically grouped with generic HassTurnOff.

The conversation tests also explicitly expect media players to use turn_on / turn_off:

("media_player.tv", "off", "turn_on", "turn_off")

This works only for media players implementing the turn-off feature. Many playback entities instead implement media pause/stop.

Home Assistant has a native HassMediaPause intent, and Music Assistant media players implement media_stop.

Expected behavior

For a request whose meaning is "stop/pause playback", HA-Jev should not issue HassTurnOff to a media player that does not support turning off.

Possible approaches:

  1. add media-player-specific routing for stop/pause (for example HassMediaPause), or
  2. route such requests to the fallback agent, or
  3. make the action capability-aware before executing HassTurnOff.

The important part is to distinguish turning a media device off from stopping its playback.

Related

This looks like the same general class of domain-specific semantics that was addressed for locks in #5 / PR #6, but this is a separate case for media_player.

I can reproduce this consistently with a Music Assistant player that supports playback stop/pause but not media_player.turn_off.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions