Conditional switch off

  • Hello,

    In the script library, there is "Router Watchdog". This is really nice especially when the shelly plus controls something through an automation that requires network connection to close it.

    Example: Automation to control an irrigation system through Home Assistant using shelly plus to control the solenoid valve.

    The issue i am trying to solve is the following fail scenario:

    Automation started and send a command to Shelly to open the valve that it controls. The time that the Shelly as a switch will remain on, is not fixed, and it is related to other sensors of the home assistant implementation. During that time, if the shelly loses network, i want to finish the job and closed itself without the need to get the command from the automation. it is a fail-safe scenario that i think it can be done from the shelly itself. (obviously if there is a power cut-off, the valve closes itself so no need to have a fail-safe there)

    Any ideas about the script? is there anyone that can help me out?

    Thank you in advance