Automation with Next Alarm Sensor not working

I’m unable to get an automation to run that relies on the HA Android native app Next Alarm Sensor.

It’s based on the one in this post. However, the automation never triggers and I can’t evaluate why.

Notes

  • Alarm sensor state reports as localtime-1, ie alarm sensor will say 2020-10-24T08:00:00.000Z. Whereas local time will report as Sat Oct 24 09:00:00 GMT+01:00 2020

Automation

- alias: " breakfast" 
  trigger:
    - platform: time_pattern
      minutes: /1
      seconds: 0
  condition:
    - condition: template
      value_template: '{{ (((as_timestamp(now()) | int) - 3600) | timestamp_custom("%Y-%m-%d %H:%M:00")) == states.sensor.sm_g960f_ha_androidnative_next_alarm.state }}'
    - condition: state
      entity_id: binary_sensor.workday
      state: "on"
    - condition: time
      after: "06:30:00"
      before: "08:50:00"
  action:
    - delay: "00:03:00"
    - service: "{% if is_state('sun.sun', 'below_horizon') %}script.turn_on{% endif %}"
      data_template: 
        entity_id: scene.default_lights_lounge
        transition: 3
    - delay: "00:02:00"
    - service: homeassistant.turn_on
      entity_id: script.morning_breakfast