Off-on-off trigger

I want to make automatisation, with triggered whan i turn relay off-on-off during short time (3 sec)
How can i make it?

Just utilizing HA directly you probably can’t. HA’s smallest time increment is one second. This could be easily done with esphome. Utilizing an 8266 and some onboard YAML coding you could monitor the relay for that pattern and then send a trigger to HA.

he is a script i use

    - service: switch.turn_on
      entity_id: switch.garage_door
    - delay:
        seconds: 1
    - service: switch.turn_off
      entity_id: switch.garage_door

and the action part of a automation

  - data:
      entity_id: script.reset_garage_door
    service: script.turn_on

off top of head think you can use


If you are using a relay with tasmota (sonoff or other esp8266-based relay), you can use pulsetime. Switches the relay on for a short time and then off again. I use this to switch my teleruptors/contacters/impuls relays (don’t know the correct English term)

PulseTime Display the amount of PulseTime remaining on the corresponding Relay (enumerated)
<value> Set the duration to keep the corresponding Relay ON when Power<x> ON command is issued. After this amount of time, the relay will be turned OFF .
0 / OFF = disable use of PulseTime for the corresponding Relay
1..111 = set PulseTime for the corresponding Relay in 0.1 second increments
112..64900 = set PulseTime for the corresponding Relay, offset by 100, in 1 second increments. Add 100 to desired interval in seconds, e.g., PulseTime 113 = 13 seconds and PulseTime 460 = 6 minutes (i.e., 360 seconds)

Perhaps use a timer. For inspiration:

You also have Backlog available for Tasmota. Simply by publishing to MQTT:

Topic: “cmnd/xxxx/backlog
Payload: “power3 off; delay 1; power3 on; delay 1; power3 off

This is another way to skin the proverbial cat.

1 Like