i’m trying to create a kind of alerting rule and doing some calculation based on statitstics deltas of my total_increasing entities.
Specifically i want to set up a rule for water loss detection. Something like if during the night hours the value never goes down to 10L every 5 minutes or if it goes over a threshold. I already have a statistics graph like this for water consumption:
Then what i want to do is to create a fake entity measuring the returned energy from my PV plant. I already have a multimeter measuring the total (total_increasing) consumed energy (including the PV) and the PV production (another total_increasing) from my inverters.
What is the easiest way to subtract each delta to have the eventually returned energy?
So you are suggesting setting up an automation. Maybe the condition checking just the sun is not enough as it should check only “sleep hours”.
I also don’t think the trigger is going to work as it is because i have a total_increasing counter that obv is always above 10L.
I don’t think i understand the process. What should i create as a template? The subtraction between the 2 total increasing counters? That way the stats should have the correct value?
This is what i’ve done so far with the power (i don’t know it’s the most efficient way):
Still haven’t found a way to get the statistics from a total_increasing sensor as a value to use for widget visibility in dashboard or alerting.
Probably a workaround can be creating for example an utility meter with reset every 15m and use that value as a threshold.
Problem is that it doesn’t considere “last 15m” but bucket of 15m each and at the 16th minute it will always be 0.
And i was also trying to avoid creating entities over entities and make my system more complex.
I’ll share what I’ve done so far since it seems it is a very niche need.
I had to create a couple of entities even if i wasn’t really happy about it.
I created a statistic helper on my total_increasing sensor wiht “Absolute distance” to get the consumption from the latest hour.
Then i created another statistic helper with the lowest value of the latest 10 days (with 240h as max age time).
This way i can directly use this value for “alert” visibility on the home assistant dashboard or even for automation.
I can for example use it to detect if there’s a water leak if the lowest hourly value in latest days is strangely high.
Still haven’t found an optimal solution for calculated returned energy without creating too much entities…