Not able to pass trigger.entity_id(devide that trigger) and trigger.for to telegram and tts.google_say

I am not able to pass trigger.entity_id(devide that trigger) and trigger.for to telegram and tts.google_say

This is my code

alias: Sensors Not Available
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.chest_frezer_temperature_2
      - cover.garage_door
      - sensor.temt6000_illuminance
      - binary_sensor.refrigerator_door
      - light.garage_lights
      - light.bedroom_lights
    to: unavailable
    for:
      hours: 99
      minutes: 0
      seconds: 1
  - platform: state
    entity_id:
      - sensor.chest_frezer_temperature_2
      - cover.garage_door
      - sensor.temt6000_illuminance
      - binary_sensor.refrigerator_door
      - light.garage_lights
      - light.bedroom_lights
    to: unavailable
    for:
      hours: 99
      minutes: 0
      seconds: 10
 
condition:
  - condition: sun
    before: sunset
    after: sunrise

action:
  - service: telegram_bot.send_message
    data:
      message: sensors {{ trigger.entity_id }} not available for {{ trigger.for }}
  - service: tts.google_say
    data:
      entity_id: all
      message: sensors {{ trigger.entity_id }} not available for {{ trigger.for }}
mode: single

How are you testing?

Also quote your single line templates.

message: "sensors {{ trigger.entity_id }} not available for {{ trigger.for }}"

I’m testing with disconnecting the device

Quoting is not necessary, but you were waiting for 99 (!) hours? Did you test only with seconds?

Since when?

https://www.home-assistant.io/docs/configuration/templating/#important-template-rules

1 Like

Since ever? I don’t know. The message starts with a string, so you don’t need quotes. Same when you use

service: light.turn_{{ < some code> }}

Try it out.

There is no guarantee this will continue to work in future updates. Follow the documented template rules.

1 Like