Templating: Switch on $thing 10' before next alarm

Hi all

How does your $thing know your’re in your home office or at work? Usually you have travel times so your alarm clocks are set different at different days. Maybe you go hiking on a Weekend, maybe you’re on vacation and can sleep a little longer.
This automation switches on my coffee machine based on my next Android Alarm

  - alias: Switch on Coffee Machine
    initial_state: true
    trigger:
     - platform: template
       value_template: '{{states.sensor.time.state == ((states.sensor.jarvis_app_next_alarm.attributes["Time in Milliseconds"] / 1000 ) - 600 ) | int |  timestamp_custom("%H:%M", true)}}'
     - platform: template
       value_template: '{{states.sensor.time.state == ((states.sensor.viki_app_next_alarm.attributes["Time in Milliseconds"] / 1000 ) - 600 ) | int |  timestamp_custom("%H:%M", true)}}'
    condition:
      condition: and
      conditions:
       - condition: state
         entity_id: group.all_humans
         state: 'home'
       - condition: time
         after: '5:00:00'
         before: '12:00:00'
    action:
      - service: switch.turn_on
        entity_id: switch.coffee_machine_plug

Maybe it’s not the best project ever, but a wanted this so bad, I even started to develop a custom app.

Cheers, LukasQ