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: ''
  trigger:
  - platform: time_pattern
    minutes: '1'
  condition:
  - condition: template
    value_template: ' ''{{ (now().strftime("%a") == "Wed") and (now().strftime("%H:%M") == states.input_datetime.hour_wed.state)}}'' '
  action:
  - service: switch.turn_on
    target:
      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:
  - 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:

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

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