Control two things depend on how many times I flip the smart switch?

I have a smart switch installed and I setup it up with home assistant. The smart switch is not physically connected to anything.

I currently have an automation setup that turning on the switch will turn on the smart plug that my garage opener is plugged into, then HA wait 30 seconds, then it opens the garage door (MyQ).

I was wondering if it was possible to set it up so that if I flip the smart switch on and off once, it would only turn on the smart plug.
But if I flip the smart switch on and off twice, then it would turn on the smart plug plus will wait the 30 seconds and then open the garage door.


id: ‘1642124608703’
alias: Open Garage Door Automation
description: ‘’

  • platform: device
    type: turned_on
    device_id: 1fd7aac21e9555e26c097a9d043424d7
    entity_id: switch.garage_door_automations_switch
    domain: switch
    condition: []
  • type: turn_on
    device_id: e853149129f98113c377cef733a4c5cf
    entity_id: light.garage_door_plug
    domain: light
  • delay:
    hours: 0
    minutes: 0
    seconds: 30
    milliseconds: 0
  • device_id: 231228fb225669dc20eb810929cd27eb
    domain: cover
    entity_id: cover.garage_door
    type: open
    mode: single