ESPHome - Can I replicate Tasmota PulseTime?

I’m currently moving my garden irrigation system from using to Tasmotized Sonoffs to ESPHome on an ESP32.

One great feature of Tasmota was the ability to set the PulseTime (via an MQTT command) so that the Sonoff itself had a maximum ‘On’ time. The irrigation time was variable but this could be set every time it ran.

This gave a very good safety feature in that even if HA went down or the network communication failed the watering would only happen for at the most, the PulseTime.

I’m new to ESPHome and I was wondering if it has anything similar?

Just some pointers to what I should be looking for in the docs might be enough.

Thanks.

Maybe something like:

switch:
  - platform: gpio  # or any other platform
    id: irrigation_switch
    restore_mode: ALWAYS_OFF
    # ... blah rest of config
    on_turn_on:
    - delay: 900s # or whatever max on time you want
    - switch.turn_off: irrigation_switch

Also look at the restore_mode I included. If your ESP power resets this will cause the switch to turn off.

Other options for this:

RESTORE_DEFAULT_OFF (Default) - Attempt to restore state and default to OFF if not possible to restore.
RESTORE_DEFAULT_ON - Attempt to restore state and default to ON.
ALWAYS_OFF - Always initialize the pin as OFF on bootup.
ALWAYS_ON - Always initialize the pin as ON on bootup.

Thanks that is useful.
I had a feeling the answer might be something along those lines though.
I was hoping there might be something I could set dynamically :thinking:

With Tasmota before it was turned on I could set the PulseTIme to (say) 5 seconds longer than the run time.

My run times might vary from a minute or two for a sprinkler to several tens of minutes (maybe even an hour) for a soaker hose.