Send picture and text to display on Google Nest Hub while sending TTS

Thanks!
the entity camera.ingresso_person has been renamed image.ingresso_person

Well, that would explain it :slight_smile:

1 Like

Starting from today another problem.

This is the automation YML

alias: Alert from Frigate Ingresso
description: Light and Video Alert from Frigate Ingresso
trigger:
  - platform: state
    entity_id:
      - binary_sensor.zone_2_person_occupancy
    from: "off"
    to: "on"
condition: []
action:
  - service: tts.cloud_say
    data:
      cache: false
      entity_id: media_player.cucina
      message: >-
        Attenzione, un intruso all ingresso. Ripeto, un intruso è stato
        avvistato all ingresso
  - wait_template: "{{ is_state('media_player.cucina','idle') }}"
    continue_on_timeout: true
  - service: media_player.volume_set
    data:
      volume_level: 0.7
    target:
      entity_id: media_player.cucina
  - service: media_player.play_media
    data:
      media_content_id: >
        {{ "http://192.168.1.13:8123" + state_attr("image.ingresso_person",
        "entity_picture") }}
      media_content_type: image/jpeg
    target:
      entity_id: media_player.cucina
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - wait_template: "{{ is_state('media_player.cucina','idle') }}"
    continue_on_timeout: true
  - service: media_player.turn_off
    data: {}
    target:
      entity_id: media_player.cucina
  - service: tts.clear_cache
    data: {}
mode: single

Visually, the image (image.ingresso_person) remains fixed on my google home screen.
Is like the the remain part of the automation is not working well.

  - wait_template: "{{ is_state('media_player.cucina','idle') }}"
    continue_on_timeout: true
  - service: media_player.turn_off
    data: {}
    target:
      entity_id: media_player.cucina
  - service: tts.clear_cache
    data: {}
mode: single

Best to check the automation trace and see if it stops somewhere or errors

Thank you for the wonderful scripts you created!
I made some changes to the dinner_ready script in order to make it more generic and also simplify the way you call it.

It takes as input an image or a camera entity, a target of type cast and it uses TTS for the title input.
It will start playing the input text with the image and when it finishes playing, it will show the image in full screen for as long as the timeout input is set.

Here is the modified script which can be added using the GUI. The only change that’s needed is to write the correct url variable.

alias: TTS with picture
description: ""
icon: mdi:image-check-outline
mode: restart
fields:
  image:
    selector:
      entity:
        filter:
          domain:
            - camera
            - image
    name: Image
    required: true
  target_media:
    selector:
      entity:
        filter:
          integration: cast
    name: Target Media
    required: true
  title:
    selector:
      text: null
    name: Title
    required: true
  description:
    selector:
      text:
        multiline: false
    name: Description
  timeout:
    selector:
      number:
        min: 1
        max: 100
    name: Timeout
    default: 10
    required: true
sequence:
  - variables:
      url: >-
        https://mydomain.duckdns.org{{ state_attr(image, 'entity_picture')
        }}&timestamp={{ now().timestamp() | int }}
  - alias: Call the script with the additional data as script variables
    service: script.turn_on
    target:
      entity_id: script.google_home_send_tts_with_picture_and_information
    data:
      variables:
        dummy_player: media_player.vlc_telnet
        target: "{{ target_media }}"
        large_text: "{{ title }}"
        small_text: "{{ description }}"
        picture_url: "{{ url }}"
  - alias: Send the TTS service call to the dummy player
    service: tts.google_say
    data:
      cache: false
      message: "{{ title }}"
      entity_id: media_player.vlc_telnet
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - wait_template: "{{ states(target_media) == \"playing\" }}"
    continue_on_timeout: true
    timeout: "10"
  - wait_template: "{{ states(target_media) == \"idle\" }}"
    continue_on_timeout: true
    timeout: "10"
  - service: media_player.play_media
    metadata: {}
    data:
      media_content_type: image/jpg
      media_content_id: "{{ url }}"
    target:
      entity_id: "{{ target_media }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: "{{ timeout }}"
      milliseconds: 0
  - service: media_player.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: "{{ target_media }}"
1 Like

Nice update!
A lot of this wasn’t possible 2 years ago, so nice to see an updated version including these new options.

I found a way to remove the need for the google_home_tts_screen script, and vlc addon which should make this script more reliable and easy to use.

alias: TTS with picture
description: ""
icon: mdi:image-check-outline
mode: parallel
max: 10
fields:
  image:
    selector:
      entity:
        filter:
          domain:
            - camera
            - image
    name: Image
    required: true
  target_media:
    selector:
      entity:
        filter:
          integration: cast
    name: Target Media
    required: true
  title:
    selector:
      text: null
    name: Title
    required: true
  description:
    selector:
      text:
        multiline: false
    name: Description
  timeout:
    selector:
      number:
        min: 1
        max: 100
    name: Timeout
    default: 10
    required: true
sequence:
  - variables:
      picture_url: >-
        https://mydomain.duckdns.org{{ state_attr(image, 'entity_picture')
        }}&timestamp={{ now().timestamp() | int }}
  - service: media_player.play_media
    target:
      entity_id: "{{ target_media }}"
    data:
      media_content_id: media-source://tts/tts.google_en_com?message={{ title }}}&cache=true
      media_content_type: music
      extra:
        metadata:
          metadataType: 3
          title: "{{ title }}"
          artist: "{{ description }}"
          images:
            - url: "{{ picture_url }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - wait_template: "{{ states(target_media) == \"playing\" }}"
    continue_on_timeout: true
    timeout: "10"
  - wait_template: "{{ states(target_media) == \"idle\" }}"
    continue_on_timeout: true
    timeout: "10"
  - service: media_player.play_media
    metadata: {}
    data:
      media_content_type: image/jpg
      media_content_id: "{{ picture_url }}"
    target:
      entity_id: "{{ target_media }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: "{{ timeout }}"
      milliseconds: 0
  - service: media_player.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: "{{ target_media }}"
1 Like