Skip to content

Latest commit

 

History

History
126 lines (116 loc) · 4.22 KB

examples_google_home_resume.md

File metadata and controls

126 lines (116 loc) · 4.22 KB

Examples

Basic example

This example will play an mp3 on 2 targets, without additional data

alias: "Play sound when there is someone at the door"
service: script.google_home_resume
data:
  action:
    - service: media_player.play_media
      target:
        area_id: 'living_room'
        entity_id:
          - media_player.bedroom
          - media_player.guestroom
      data:
        media_content_type: music
        media_content_id: "media-source://media_source/local/dingdong.mp3"

No target provided in the service call, required to provide target in script call

In this example a script is started instead of a service call directly to the entities. Therefor is is required to provide the target so the script will know which entities should be resumed/restored.

alias: "Play sound when there is someone at the door via script"
service: script.google_home_resume
data:
  target:
    area_id: 'living_room'
    entity_id:
      - media_player.bedroom
      - media_player.guestroom
  action:
    - service: script.play_sound
      data:
        file: "media-source://media_source/local/dingdong.mp3"

Send TTS and apply volume for the TTS message

Enter the data for the TTS service call, and provide the volume under extra

- alias: "Send TTS using Google Home Resume script"
  service: script.turn_on
  target:
    entity_id: script.google_home_resume
  data:
    variables:
      action:
        - alias: "Send TTS message"
          service: tts.google_cloud_say
          target:
            entity_id: media_player.living_mini
          data:
            message: "Ding Dong! There is someone at the door!"
          extra:
            volume: 0.5

Send TTS with picture and text for a player with a screen

Enter the data for the TTS service call, and provide the details inscreen_tts under extra. Can be combined with volume. Based on the targets provided, and the variable players_screen for the script settings, the script will determine if it should be sent as normal TTS, or one with extra data. For this the script uses the helper script script.google_home_resume_tts_screen The picture_url should be a full url (starting with http:// or https://, not a HA internal url) it can be an url within your network.

- alias: "Send TTS with picture and "
  service: script.turn_on
  target:
    entity_id: script.google_home_resume
  data:
    variables:
      action:
        - alias: "Send TTS message"
          service: tts.google_cloud_say
          target:
            entity_id: 
              - media_player.living_mini
              - media_player.office_hub
          data:
            message: "Ding Dong! There is someone at the door!"
          extra:
            screen_tts:
              large_text: DING DONG
              small_text: There is someone at the door
              picture_url: http://10.0.0.5:8123/media/camera_front_door/snapshot.jpg
            volume: 0.5

Multiple actions to the same target, which need to wait for each other.

In case you send multiple actions to the same target, which need to wait for each other, enter wait: true under extra

- alias: "Send multiple TTS to the same target"
  service: script.turn_on
  target:
    entity_id: script.google_home_resume
  data:
    variables:
      action:
        - alias: "First TTS message"
          service: tts.google_cloud_say
          target:
            entity_id: media_player.living_mini
          data:
            message: "I'm the first!"
          extra:
            wait: true
        - alias: "Second message"
          service: tts.google_cloud_say
          target:
            entity_id: media_player.living_mini
          data:
            message: "I'm second!"
          extra:
            wait: true
        - alias: "Third and last message"
          service: tts.google_cloud_say
          target:
            entity_id: media_player.living_mini
          data:
            message: "I'm third.. and last.."