Automations Headache

If you manually trigger the automation do you get the results you want?

Not entirely. If I run manually the pump does switch on, but when I switch the pump off and run the automation again, the pump switches on again. As I understand it, the template should prevent this from happening as it will only allow the automation to trigger once?

So there are times you are going to manually turn the pump off? How is that executed?

The condition is looking at the last time the automation was ran vs the last time the pump was turned off.

No the idea is to also turn the pump off with an automation, the pump should turn off when the PV Production is too low and the house starts pulling power from the grid or battery.

But this in its own creates an issue, PV Production may fluctuate during the day due to clouds, equipment coming online/offline etc. So the idea is, once the pump switches off, the “On” automation should switch i back on. This risk is due to the fluctuation that the pump will switch off, then on, then off, then on during the day which I want to avoid.

I’ll have to think about this, but I think moving the condition to the last time the pump ran vs the automation may be a better resolution.

What do you mean by moving the condition?

this

It controls the automation.

The entity_id may need to be the pump, not the automation. I still need to wrap my head around the situation. Really late for me

That actually makes more sense. I tested it with an entity that hasn’t ran today yet. Still the template returns a “False”. Shouldn’t it return “True” to trigger the automation and once the entity triggered once for the day only then the Template should return “False” to stop the automation triggering again?

Last trigged isn’t going to work with an entity.

{{ states.switch.your_pump.last_changed | default(today_at(), true) < today_at() }} may work.

BINGO!!! This seems to be working

I’m looking into today_at() vs now()

{{ states.switch.your_pump.last_changed | default(today_at()) < now() }}

Now might be working better, as it will always check against the current time. So if the entity changed before now it will return true?

Yes, that is what I was thinking. If it hasn’t run it’s not greater than now()

Edit…it will always be less than now. I need to edit the logic

I like the idea, I’m gonna try it.

I have a last hypothetical question. One of the conditions is that if the current forecasted/estimated power production is higher than the actual power production it should return true.

This is based of a single PV string facing North. I am thinking of adding a second PV string facing West in the future. This will entail 2 entities, a North and a West. How would I create a condition to add the estimated power productions of both these entities, ie.

IF “current_Power” < (Estimated Power_North + Estimated Power_West) then TRUE

If both are sensors you can create a group in Helpers.

Holy Crap! Thank you. You helped me immensely. I was always wondering what the helpers are for. Where / which channel can I watch on YouTube to teach me all of this? Including the template / Jinja2 languages?

I have never used video, learned/ learning everything from this forum.

Just keep asking questions!!

1 Like

I owe you a beer! Thank you! and to all that answered!!!

I still need to verify the time math so I’ll follow up tomorrow. Bed time for me!

No worries, thank you. Have a good night