#Using custom sentence to call an entity_id and then converting that entity_id to something else.

1 messages · Page 1 of 1 (latest)

fierce sedge
#

I'm probably asking a question that I know the answer to: "doable but very complicated".

I'm trying to have a voice command like "play release radar on device x" so that it would play Spotify's Release Radar on a device of my choosing. I have the following YAMLs:

intents.yaml:

 SoitaReleaseRadar:
    action:
       - service: media_player.play_media
         target:
           entity_id: media_player.spotify
         data:
           media_content_id: "https://open.spotify.com/playlist/abcd1234"
           media_content_type: playlist
      - service: "media_player.select_source"
        target:
          entity_id: "media_player.spotify"
        data:
          source: "{{ spotify_kohteet }}"

Spotify needs the name for the source it "knows" when changing source, but in this case I have no way to give that source name back to it. I know I'm not calling {{ spotify_kohteet }} anywhere in the sentence, but I'm wondering if it could resolve to two different lists?

#

...whatever .yaml in /custom_sentences/

language: "fi"
intents:
  SoitaReleaseRadar:
    data:
      - sentences:
        - "soita Release Radar [{media_player}]"
        - "soita Uutuus kattaus [{media_player}]"
        - "soita Uutuuskatsaus [{media_player}]"
        - "soita uutuuskattaus [{media_player}]"
        - "testi"

lists:
  media_player:
    values:
      - in: "työhuoneessa|työhuoneen echossa|vierashuoneessa|vierashuoneen echossa"
        out: "media_player.guest_room_echo_dot"
      - in: "keittiössä|keittiön echossa|keittiön"
        out: "media_player.kitchen_echo_dot"
  spotify_kohteet:
    values:
      - in: "työhuoneessa|työhuoneen echossa|vierashuoneessa|vierashuoneen echossa"
        out: "Guest room echo dot"
      # - out: "Everywhere"
      - in: "keittiössä"
        out: "Kitchen Echo Dot"

#

Obviously I could do two different sentences: 1) play release radar. 2) set source to xxx. That would work but would be two separate commands.

#

I did read about condensed sentences (but I don't know if those work yet?) - in that case i could combine the two commands to one -> play release radar AND change the source to whatever