Conditional time trigger not working

Hi there.

I am attempting the following:

  • On the dashboard is a toggle switch and an input datetime card.
  • If the toggle switch is ON, at the set time, a light group will automatically turn on.
  • If the toggle switch is OFF, nothing happens.

46CFAA05-F908-4EDB-A462-462C1009AE35

The first part works, but somehow when I switch the toggle to OFF, the automation still runs at the specified time. My code is like this:

- id: '1654766877467'
  alias: 'Light group on at specific time'
  description: ''
  trigger:
  - platform: time
    at: input_datetime.xxxxx_wakeup
  condition:
  - condition: state
    entity_id: input_boolean.xxxxx_wakeup_toggle
    state: 'on'
  action:
  - type: turn_on
    device_id: 9dddvc2915202b8e7ea77ea3e18ba1556cb
    entity_id: light.group.bedroom
    domain: light
  mode: single

Obvisously I am overlooking something, but for the life of me I can’t figure it out.
Any help is much appreciated.

Use the automation trace to see what is happening:

Ok, I found the problem, in short: I am an idiot! :rofl:

I did a testrun without the condition to see if it worked. I then duplicated the automation and added the condition. I did not however deactivate the test automation, which will fire without the condition, so it seemed like the automation was misbehaving. After deactivating the test automation, all is fine now!
All I would like now is as soon as the automation fires to toggle the switch to OFF, so it won’t fire the next time the time condition is met. I don’t know how to wrap that in an additional action.

@tom_l Thanks for that link, I did not know that, so I learned something in the process.