REST API tts

Dear Sirs,

I'm migrating from the deprecated tts/picotts_say service to the new tts/speak API and I'm having trouble reproducing the old behavior.

This old function worked correctly (to test define in bash HAOS_BASEURL and HAOSTOKEN):

log_audio() {
    local message="$1"

  curl -s -k -X POST "$HAOS_BASEURL/api/services/tts/picotts_say" \
  -H "Authorization: Bearer $HAOSTOKEN" \
  -H "Content-Type: application/json" \
  -d @- <<EOF
{
  "cache": false,
    "entity_id": "media_player.music_player_daemon",
    "message": "$message"
}
EOF
}

I'm trying to migrate to:

log_audio() {
    local message="$1"

     curl -v -s -k -X POST \
      "$HAOS_BASEURL/api/services/tts/speak" \
      -H "Authorization: Bearer $HAOSTOKEN" \
      -H "Content-Type: application/json" \
      -d @- <<EOF
{
  "entity_id":"tts.picotts",
  "media_player_entity_id":"media_player.music_player_daemon",
  "message":"$message",
  "cache":false,
  "options":{
      "announce":true
    }
}
}

Instead if I try this I get a 400 Bad request:


curl -s -k -X POST \
  "$HAOS_BASEURL/api/services/tts/speak" \
  -H "Authorization: Bearer $HAOSTOKEN" \
  -H "Content-Type: application/json" \
  -d @- <<EOF
{
  "target": {
    "entity_id": "tts.picotts"
  },
  "data": {
    "media_player_entity_id": "media_player.music_player_daemon",
    "message": "ciao",
    "cache": false
  }
}
EOF

The request returns HTTP 200 OK, but instead of speaking the TTS message, no speech is produced.

Environment:

  • Home Assistant OS
  • MPD (media_player.music_player_daemon)
  • PicoTTS

Am I missing something in the migration to tts/speak?
Did the behavior change for MPD/media_player integrations?

Thanks. BR