Problem with trigger in automation

Hi,

I am having a issue with an automation im trying to create, every step seems to work flawlessly except when its ment to run by itself

im trying to create a sprinkler schedule and have everything working exactly how i want it just the final step with the automation isnt running, i have a sensor that display the start time and am using a template to check when its met. I can trigger it by changing the state on the sensor to match the time and it works but when when start time has been set and the time comes around it doesnt trigger

hopefully this make sense, if you need any more info please let me know

- alias: "Turn on zone based on schedule"
  trigger:
    platform: template
    value_template: '{{states.sensor.starttime_zone_1.state == now().strftime("%H:%M")}}'
  condition:
    - condition: state
      entity_id: switch.zone_1
      state: 'off'
    - condition: template
      value_template: '{{ states.sensor.next_run_zone_1.state == now().strftime("%a, %d-%m-%Y at %H:%M") }}'
  action:
    - service: script.turn_on
      entity_id: script.open_zone_1
    - service: notify.pushbullet
      data:
        message: It's {{states.sensor.next_run_zone_1.state}} and Zone 1 just came on for {{states.sensor.duration_zone_1.state}}

One problem is that because you have a template in your message, it should be a data_template: not data:

Also, I would put quotes around the message, although I have no confidence that this will solve your problem!

I assume you are using the templates page under dev tools on the front end to check your templates’ syntax?

hey,

thanks for the help, that part actually works without the data_template: , how ever i will update as i agree it should be like that . i believe the problem is in the trigger.

ive managed to get it to work by using time_date sensor instead of now().strftime even though it works fine in the template editor

# Automation
- alias: "Turn on zone based on schedule"
  trigger:
    platform: template
    value_template: '{{ states.sensor.starttime_zone_1.state == states.sensor.time.state }}'
  condition:
    - condition: state
      entity_id: switch.zone_1
      state: 'off'
    - condition: template
      value_template: '{{ states.sensor.next_run_zone_1.state == now().strftime("%a, %d-%m-%Y at %H:%M") }}'
  action:
    - service: script.turn_on
      entity_id: script.open_zone_1
    - service: notify.pushbullet
      data_template:
        message: It's {{states.sensor.next_run_zone_1.state}} and Zone 1 just came on for {{states.sensor.duration_zone_1.state}}