rogro82 / hass-variables

Home Assistant variables component
236 stars 59 forks source link

Problem using variable in trigger. #49

Open joseecm-github opened 3 years ago

joseecm-github commented 3 years ago

Hello!

I am trying to use a variable in an automation trigger. This is my automation:

- alias: 'Envio de videos de la terraza por Telegram'
  trigger:
    platform: state
    entity_id: variable.incoming_terraza_video
    to: 'true'
  action:
    - service: telegram_bot.send_video
      data_template:
        file: "{{ trigger.event.data.path }}"
        caption: "{{now().strftime('%d/%m/%Y  %H:%M')}}"
    - service: variable.set_variable
      data:
        variable: variable.incoming_terraza_video
        value: 'false'

But I am getting the following error:

_Envio de videos de la terraza por Telegram: Error executing script. Unexpected error for callservice at pos 2: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

What am I doing wrong?

joseecm-github commented 3 years ago

Sorry, the problem was not about the using of variable in trigger.