Automation doesn't trigger / manual triggering works

That’s an elegant solution, looks great! Thanks! :+1::+1::+1: I just put it in, first tests show promising results. I’ll let it run tomorrow morning. And as an added bonus, I’ll put my espresso machine in it as well, so if it doesn’t work, I won’t get any coffee… :worried::worried::worried: :rofl:

Thanks again, this question, or better your answers, have taken me way farer, than hours of reading in the documentation. I’ll let you know!

I made a correction (see my original post above). I removed the leading if from:
if states('input_boolean.alarm_clock_ha_on')

Be sure to remove it from your template, otherwise tomorrow’s coffee is in jeopardy.


EDIT

Here’s another version that takes advantage of three different types of condition:

  • state
  • time
  • template

I think this version is more legible than the other one I offered.

condition:
  - condition: state
    entity_id: input_boolean.alarm_clock_ha_on
    state: 'on'
  - condition: state
    entity_id: input_boolean.night_mode
    state: 'on'
  - condition: time
    after: '22:30:00'
    before: '12:30:00'
  - condition: template
    value_template: >
      {% set pat = state_attr('input_datetime.alarm_clock_pat_time', 'timestamp') %}
      {% set steffi = state_attr('input_datetime.alarm_clock_steffi_time', 'timestamp') %}
      {{ (((pat - 300) if pat <= steffi else (steffi - 300)) | timestamp_custom('%H:%M', false) == states('sensor.time')) }}

Sorry for the late reply, but I can tell, coffee works great! In both your versions, @123.

I luckily noticed the if in the expression before pasting the code into the automation. I can only say thanks again, you are doing a great job in explaining and your answers are very detailed! :+1:

For now I changed to your last version, but I’ll keep the more “nerdy” version close by, I’m sure it willl explain a lot of things later and comes in handy. :smile:

1 Like