Fortunately, the developers of HA built in the necessary function to resolve the issue (off_delay, starting in version 0.81) making AD a Rube Golberg. What surprises me though is that the original question that was asked in August of '18 never got that answer. The OP had to go to a different group to the get the answer. Just glad we have an elegant and simple solution to the problem now.
I needed to recreate a push button, I did as below not elegant but it works. instead of switch you can put your binary_sensor
automation:
- id: Apri cancello 12
initial_state: 'on'
alias: Apri cancello 12
trigger:
platform: state
entity_id: switch.cancello12
from: 'off'
to: 'on'
action:
- delay:
milliseconds: 800
- service: homeassistant.turn_off
entity_id: switch.cancello12
If a device has tasmota on it the rules allow for automations based on sunrise/sunset, you can use timers, you can set variables and increment or decrease numbers you set, turn on/off rules as desired based on (essentially) if/then/else statements… but it’s still an art form, apparently, because I’m having a hard time with complex rules. I’d rather have the automation be local so if my HA is down or not available my dining room light still works as intended.
Glad to have recently learned about the off_delay tag for binary sensors, though - will help for single code sensors
This idea may be useful: