I want to run my pool pump for a certain amount of time each day.
I want to create a script that says:
if i’m EXPORTING >1kW power (from solar) AND the pump has run <2 hours today AND pump off
Turn the pump ON
then
If pump is ON AND power is IMPORTING> 0.1kW OR Pump has run >2 hours
Turn Pump OFF
I should be able to do the majority of it, and will have to handle hysteresis and probably some delay timers to ensure that there is no chettering. but my first hurdle is the total run time
you mean that the switch it self remembers how long it has been on for? that seems a little silly since HASS knows when it was turned on and off, and is storing the information in a database.
i am using orvibo switches, which have feedback for when they are on/off. Forgive me if i have mis-understood.
The misunderstanding was mine.
I fairly certain you can get most of this information out of HA.
I would start by using the dev tools and checking out each of your entities that you want to involve to se what they are exposing.
Most likely your going to be using a lot of templating and most likely you’ll need to have a look at the trigger.for part.