Google Calendar events to operate switches

I currently have my google calendar setup in HA, along with the required automations and timers until the next event.

HA is reading the google calendar fine and the count down timers are working as they should.

The timers count down until the next work event for both my wife and myself. When either of these reach 90 (90 minutes before the work event from the google calendar) then the HA automation switches on my sonoff switch which controls my hot water tank heater. There is then a 30 minute delay and the automation switches off the switch.

Both automations that check each count down timer are running in single mode.

This all works well with the exception of today (a Tuesday) when both my wife and myself both start work at 3pm.

HA is triggering the automation at 1:30pm for both the count down timers which is quickly turning the switch on and then off again a few seconds later.

Any help as to have the automations not “collide?” with each other would he helpful.

It is easier to propose fixes if we can see the automation(s) in question… That said, the fact that the switch is being turned on and off points to the possibility that you are using a switch.toggle service call. Instead, you should use a switch.turn_on, that way you will not have the issue of the switch being turned off.

This is the automation i’m using once each count down timer reach’s 90 minutes.

  alias: My Work Hot Water
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.time_until_me_work
    to: '90'
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: switch.sonoff_1000e27b59_1
      state: 'off'
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.sonoff_1000e27b59_1
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.sonoff_1000e27b59_1
  mode: single