# How to calculate ON-time and make actions based on how many hours a device is on?

Hello! I have a pool pump that i want to activate if there is sun shining (so a amount of lux being reported by my lux sensors), but the pool pump also has to circulate the pool either way, so i want to program the plug to also turn on for at least say 3 hours per day, even if the sun is not shining for a day. Is there a way to do so?

What is the criteria for turning on the second pump? Specific time of day?

In Routines, you can Auto turn off a device after turning it on. The range is from 1 sec up to 24 hours.

Alternatively, there is also the vEdge Utility Device which features the ability to track accumulated time and take actions on it.

1 Like

I would set up several separate routines for this:

1. Turn on at 9am
2. Between 12-5pm, if lux < X, turn off
3. Turn off at 5pm

If itâ€™s a cloudy day, itâ€™ll turn off at 12 (or the first time the lux updates after 12pm) - thereâ€™s 3 hours of run time.
If itâ€™s a sunny day and turns cloudy, itâ€™ll turn off later.
If itâ€™s sunny all day, itâ€™ll run all day and turn off at 5pm.

1 Like

Not a second pump, a single pump that have to run when it is daylight, so it makes the pool warm by flowing water through solar mats. But, if no daylight is shining, it also has to activate 3 hours per day regardless. Activating by daylight is not hard to program. Activating 3 hours regardless(but not if the sun was shining all day because it already ran a lot that day then.

Because it also turns off if there are clouds, i cannot rely on the â€śif pump plug is on for x amount of hoursâ€ť as it is a uninterrupted value. It resets when the plug is turned off.

The Routines suggested by @MarkTr (or some variation thereof) would do what you want. You could also change the first one to turn on when it gets daylight vs a specific time. The same could be done for when to shut off the pump. So you get:

1. Turn on when daylight is detected (lux > X)
2. Between 12-5pm, if lux < X, turn off
3. Turn off when evening is detected (lux < X)

thanks for the suggestion. unfortunately this edge switch/tool resets the hour counter when turned off, so i dont see a use case with this. With the pump there will be multiple times during a day with clouds it will turn on and off. i need a way to count the total time.

Do you refer to the Edge Counter Utility V1?
This can be paused when switched on and off but continue timing until your final limit

1 Like

oh, the linked post says it resets upon power off! I guess it was updated, super, thats the thing i exactly needed! i will give it a go tommorow, thanks!

2 Likes