Trying to automate based on two datetime input helpers

Hello,

I am trying to automate my shades so they would open on a set time partially and than after an offset period they would open completly.

I made a helper to set the initial time. This gives no problem. But its when I try to combine both helpers the initial time and the offset, I run into trouble.

I used the template editor to test the result and it gives me the correct hour (08:05:00) but the automation doesn’t accept it… I get Message malformed: Expected HH:MM, HH:MM:SS or Entity ID with domain ‘input_datetime’ or ‘sensor’ @ data[‘at’][0]

the YAML I am trying is the following

at: "{{ (state_attr('input_datetime.initial_time', 'timestamp') + state_attr('input_datetime.offset_time', 'timestamp')) | timestamp_custom('%H:%M:%S', False) }}"

Is it not possible what I am trying to do, or is there a an error in my template?

Why not two simple automations? One triggered by the set time and the other by the shades having been partially open for the offset period. Much easier to maintain.

Make a template sensor and use that as the at:. Currently, you cannot template the at: field.

template:
- sensor:
  - name: Shades Time
    unique_id: Shades Time
    device_class: timestamp
    state: >
      {{ states('input_datetime.initial_time') | today_at + states('input_datetime.offset_time') | as_timedelta }}

then

trigger:
- platform: time
  at: sensor.shades_time