Well spotted @AlexTrovato ! Thanks for the correction !
I think with this development you will be able to do what you want @guim31 using 2 scenes. If I understood correctly you want every day at a fixed time to turn the pump on and then turn it off after a calculated time.
First create an MQTT virtual device that will serve as a "timer", it should have a functionality like this:
Be careful don’t forget the "0" in the min/max
Then you can create 2 scenes.
The first will be used to start your pump at a fixed time (I set 9:00 but put whatever you want)
As you see we make a request to an external service to get the time (this is not yet available on Gladys, or at least I don’t know how to do it), the unix version is an integer (the number of seconds since 1970). We set the timer so the end time is (current time + delay in seconds from your calculation)
In the second one that will allow you to turn off your pump, you can do this
It will run every 5 minutes (you can reduce to 1 minute but since there is an API request to get the time I don’t want you to be blocked if they see too many requests).
The first condition prevents the scene from running when your pump is off.
Then you retrieve the current time and the end time saved in your virtual timer device. If the current time is greater than the timer time you can turn off your pump.
I’ve only tested with virtual devices but it should work. Watch closely the first few days to make sure it works as you wanted and don’t hesitate if you need help.


