Selectable time as Automation trigger

Hi all,

I´m having trouble creating this automation. What I want is to run this automation only when it´s Wednesday and adjusting manually the hour from the frontend. This is the script I have rn:

- id: '1621967683697'
  alias: Check hour and day
  description: ''
  - platform: time_pattern
    minutes: '1'
  - condition: template
    value_template: ' ''{{ (now().strftime("%a") == "Wed") and (now().strftime("%H:%M") == states.input_datetime.hour_wed.state)}}'' '
  - service: switch.turn_on
      entity_id: switch.relay_1
  mode: single

Even it seems fine to me the automation won´t trigger.

Any clue?

The quotes (’ ‘’) in your template seems to be wrong. Also the input_datetime should be something like “19:20:00” with seconds.

Something like that could work. You can also check the template in the developer tools to make sure everything is correct.

  - condition: template
    value_template: "{{ (now().strftime('%a') == 'Wed') and (now().strftime('%H:%M:00') == states('input_datetime.hour_wed') ) }}"

You could also use the template as a trigger for the automation. There is no need to check every minute if the automation can trigger.

adjusting manually the hour from the frontend
When you only want to change the hour you chould use a input_number instead the the input_datetime

@maverick-66 Your trigger and condition can be as simple as this:

  - platform: time
    at: input_datetime.hour_wed
  - condition: time
      - wed

Checking every minute is very rarely the right way to set up a trigger.