#CODE HELP ~ Identifying wyoming-satellite device name code placement into announcement.

1 messages · Page 1 of 1 (latest)

toxic nexus
#

I'm looking for some assistance in having the announcement and notification to my mobile device to include which wyoming-satellite the announcement came from.
I've tried multiple variations without success.
In the code below I need this code to pull the "wyoming-satellite name" {{ trigger.satellite }}

description: ""
triggers:
  - trigger: conversation
    command:
      - announcement {words}
conditions: []
actions:
  - target:
      entity_id:
        - media_player.office
    data:
      announce: true
      media_content_type: music
      media_content_id: /media/announce.mp3
      extra:
        volume: 60
    action: media_player.play_media
    enabled: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
  - target:
      entity_id:
        - media_player.officesatellite
    data:
      announce: true
      media_content_id: >-
        media-source://tts/tts.home_assistant_cloud?message="Announcement from
        {{ trigger.satellite }}: {{ trigger.slots.words }}"
      media_content_type: music
      extra:
        volume: 70
    action: media_player.play_media
  - data:
      message: "{{ trigger.slots.words }}"
      title: Announcement from {{ trigger.satellite }}
      data:
        subtitle: null
    action: notify.mobile_app_rcmp_surveillance_van
mode: single```
spiral nimbus
#

you have device_id in slots

#

Hi from Canada 🙂

toxic nexus
spiral nimbus
#

Search in traces of your automation exact field. I believe it's trigger.context.device_id something like that. Then use {{ device_name(trigger.context.device_id) }} to get name.

toxic nexus
#

Got it figured out thanks for trying to help.

description: ""
triggers:
  - trigger: conversation
    command:
      - announce {words}
conditions: []
actions:
  - target:
      entity_id:
        - media_player.all_satellites
    data:
      announce: true
      media_content_type: music
      media_content_id: /media/announce.mp3
      extra:
        volume: 60
    action: media_player.play_media
    enabled: false
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
  - target:
      entity_id:
        - media_player.all_satellites
    data:
      announce: true
      media_content_id: >-
        media-source://tts/tts.home_assistant_cloud?message=Announcement from {{
        device_name }} "{{ trigger.slots.words }}"
      media_content_type: music
      extra:
        volume: 60
    action: media_player.play_media
  - action: notify.mobile_app_rcmp_surveillance_van
    data:
      title: Announcement {{ device_name }}
      message: "{{ trigger.slots.words }}"
variables:
  device_name: >-
    {% set device = device_attr(trigger.device_id, 'name') %} {{ device if
    device else trigger.device_id }}
mode: single```