Why does my automation not work?

Hi everybody, i’m new to Homeassistant and struggling with my first automation.

I want to turn the light in bedroom on when it’s time for wakeup (well, toggling the light while testing). I’m setting the time on my smarthome where the companion app is installed. The time show up in my dashboard and after a few days reading and trying, i was able to set a datetime helper with an automation script.
But the automation script for turnng the light on is not triggered by the datetime help and i don’t know why.
Please, can someone help me?!


configuration.yaml
default_config:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'

python_script:
example state: sensor.mi_9_nachster_wecker
Local Time: 'Sat Oct 24 19:56:00 GMT+02:00 2020'
Package: com.vp.alarmClockPlusDock
Time in Milliseconds: 1603562110000
friendly_name: MI 9 Nächster Wecker
icon: 'mdi:alarm'
device_class: timestamp
automation: set datetime helper
alias: Weckzeit einstellen
description: ''
trigger:
  - platform: state
    entity_id: sensor.mi_9_nachster_wecker
condition: []
action:
  - service: input_datetime.set_datetime
    entity_id: input_datetime.wecker
    data:
      datetime: >-
        {{ strptime(state_attr('sensor.mi_9_nachster_wecker', 'Local Time'), '%a
        %b %d %H:%M:%S %Z%z %Y') }}
mode: single
automation: toggle light
alias: Licht schalten
description: ''
trigger:
  - platform: time
    at: input_datetime.wecker
condition: []
action:
  - type: toggle
    device_id: 9a932a9b0b315310b1155884b2c7e3af
    entity_id: switch.shelly_sz_licht_relais
    domain: switch
mode: single

What value does input_datetime.wecker have in it? You can go to Developer Tools --> Templates to check this.

For example:
{{ states("input_datetime.kid_bedtime") }} shows a value of 21:00:00 for me.

I then use that datetime helper in an automation like this:

- id: GetReadyForBedKids
  alias: Get Ready for Bed - Kids
  description: ''
  trigger:
  - platform: time
    at: input_datetime.kid_bedtime
  condition: []
  action:
  - data:
      brightness_pct: 100
    entity_id:
    - light.kid_light_1
    - light.kid_light_2
    service: light.turn_on
  mode: single

There’s more to the acutal automation, but you can get the idea. I’m using an entity-based action and you’re using a device-based action, but your action look similar to places where I use device actions successfully.

You also have some extra indentation after the trigger and action sections.

Does your automation work if you change the trigger to just an absolute time vs. a helper? If so, then I’d say something is getting garbled when you translate your alarm clock into the datetime helper.