Momentary Switch aka Toggle to Button conversion

This blueprint allows for converting a standard switch entity in Home Assistant into a momentary switch. When activated, the switch will automatically turn off after a specified duration, simulating the behavior of a momentary switch.

Default: 1000 milliseconds (1 second).
Range: 0 to 60000 milliseconds (0 seconds to 60 seconds).
Step: Increments of 100 milliseconds.
Unit: Milliseconds (ms).

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Toggle to Momentary Switch
  domain: automation
  input:
    switch_entity:
      name: Switch Entity
      description: The switch entity to convert to a momentary switch.
      selector:
        entity:
          domain: switch
    toggle_duration:
      name: Toggle Duration
      description: Duration to toggle the switch (in milliseconds).
      default: 1000
      selector:
        number:
          min: 0
          max: 60000
          step: 100
          unit_of_measurement: ms

trigger:
  platform: state
  entity_id: !input switch_entity
  to: 'on'

action:
  - service: switch.turn_on
    target:
      entity_id: !input switch_entity
  - delay:
      milliseconds: !input toggle_duration
  - service: switch.turn_off
    target:
      entity_id: !input switch_entity
1 Like