Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95495

Why is this condition with template in this automation not working?

$
0
0

@kdw2060 wrote:

Hi, I’ve set up an automation that was working fine as long as the condition wasn’t introduced.
I tested the template that’s used in the condition in /developer-tools/template and it is giving me the desired true/false outcome there.

- alias: kattenbakteller
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d0003cb4f89
    from: 'off'
    to: 'on'
  condition:
    condition: template
    value_template: "{{ (as_timestamp(utcnow()) - as_timestamp(states.binary_sensor.door_window_sensor_158d0003cb4f89.last_changed)) > 900 }}"
  action:
    - service: script.turn_on
      entity_id: script.1573828382796

However when used in the automation the service never gets fired.

I’ve also tried with

{{ as_timestamp(utcnow()) - as_timestamp(states.binary_sensor.door_window_sensor_158d0003cb4f89.last_changed) > 900 }}

which also works in the dev-tools, but that makes no difference.

Thanks for having a look y’all.

Posts: 13

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95495

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>