Force Reset stat sensor triggering in automations (if bellow a value even if it have been bellow that value for some time and have triggered already)

Hi all!

Try to resolve a issue that I think it may be easy, but I’m blocked…
I need to reset the “for” statistic of a sensor that I need to use for a trigger…

Will try to explain better:

I have an automation that runs upon my EV conectes to the Wallbox and that automation, if my home power is beneath 0 W for at least 3 minutes (I have solar and because of that have many times -1.000 W or something like that) turns on the Wallbox.

I then have other automations that, if my power in beneath -250 W for 3 minutes, increases 1 Amp my Wallbox current (and other that reduce 1 Amp if the power ir above 250 W for 3 minutes).

My problem is that, many times, when I arrive home, I have about -2.000 W for more that 3 minutes and when i connect my Wallbox and it begins charging, it stats with 6 A, so it uses about 1.400 W of the grid and I will still have -600 W on the grid sensor.

The -250 W trigger don’t goes off because it have been, earlier, for more than 3 minutes, when the power was -2000 W, beneath the -250 W and that trigger condition still remains valid, so it won’t trigger again.

I need something to reset that trigger when the Wallbox start working, like a HA restart (but I don’t want that). In other words, I want the increase current automation to work (increasing 1 Amp at a time) if I have -250 W for 3 minutes… I will even have to run it more than once, in a 3 minutes interval, if I have, let’s say -750 W… First time it triggers the -250 W I will still have -500 W… then again, 3 minutes later and I will have -250 W and only on the third time I will get 0 W from grid (or something like that).

It feel difficult to explain this… Hope someone gets my problem… Resuming, I need a trigger to analyze conditions again, or reset the analysis of a condition.

Don’t focus on the thing that was already true, but on the thing that changes. Afaik all you need is a trigger when you come home, and check if the conditions are right to start charging and at what speed.

Triggers are for what happens, conditions are for what already is the case. In this case coming home (or rather plugging in) is what changes and not the -250W, because that already is the case.

If you want the gradual changes after plugging in, then triggering on x mins after pluggin in would be the triggers. But I do not see the point of the steps if at the start the production is already not what you wanted.

Personally, I have one template sensor for charging speed (depending on solar production and when I need my car to be charged) and another for when to start and stop charging (based on solar production forecast and when I need my car to be charged). Those work independently. For both I do have protection so I’m not changing the wallbox in short succession to protect the hardware.

That’s not as simply as it may seem… When I arrive home the previous condition change. I may turn on the TV, audio system and computer and the “spare” power will reduce much more that the one I had 3 minutes before I came home.
I need the system to start analyzing the “3 minutes before stats” after I came home, resetting what was happening before I get home.
This is because the automation to start the charge on Solar only starts if i’m sure I will not consume anything from the grid (otherwise I charge only at night ant the off-peak hours). So I don’t even have a couple of minutes of energy consumption if the solar it’s not enough to charge the car plus the things I will turn on at home.
I use the 3 minutes analysis because I have a 15 minutes settlement with my electric energy supplier. The in and out energy it accounted in 15 minutes blocks. This way I can check the average 5 times each 15 minutes and even If I get over it, I can recover from it and pay 0 € / 0 kWh of energy in that slot. It’s like having a 15 minutes battery in my home…
I need to have a very tight control on power if I want to pay 0 € of energy during the day.

Hello Leandro,

Well, I cannot follow your requirements.
That doesn’t mean you are doing something wrong, it’s just very complicated.
It seem you have a good handle on what is happening.
My suggestion is draw some flowcharts and block diagrams for yourself to look at the big picture. This will help you follow the logic and find the issue you are having.
And following Edwin’s advice to trigger on the changes and condition on the current state of other things is the way to go here. You just have to determine what is what.

I am not saying that a flowchart will help us, I think you need this for yourself to focus your thoughts and maybe find the logic flaw.

Love this community! Don’t yet got it to work, but love the way we all think! Thank you for your reply. I also do a “mind reset”, try to build some diagrams and try to reach my goal from that.
I have done so… I want to work with changed, but the problem is that the changes have already happen in the past and because of that they do not trigger the automation again.
Trying to simplify even more:

  • Have an automation to start charging the car if I plug-it and I’m sending more than 1.400 W to the Grid;
  • The automation start when I arraive home and connect the car (because I was sendit 2.400 W to the Grid when I connected the car);
  • Have an automation to increase charging power if I have more that 250 W delivered to the Grid;
  • I’m sending 600 W to the grid but this last automation don’t trigger (increase chager) because it already had when I was sendig 2.000 W to the grid and was not yet charging (the automation trigger will only work again when I stop sendig more that 250 W to the grid… at that time it reset and will work when I send again more than 250 W do the grid).

The problem is that the trigger stays connected to the “sensor” stat independently of the other automations that started.

Even If I only activate the increase (or decrease) automation after the car start charing, because it already passed the 250 W of delivery to the grid, it will only fire again when that condition/trigger goes the other way and triggers again.

Imagine this: you create an automation to turn off a light when the ambience clarity is above 300 lux. It will run once the clarity is above 300 lux but will trigger again only after the clarity goes beneath 300 lux and then above 300 lux again. This is great for the automation don’t be triggering all the time with some minor difference in the above 300 lux value… But what if you what to fire that trigger again when you are already above the 300 lux? I only know a way: reseting Home Assistant and start the sensor statistics again…

I need to do this, to reser that sensor statistic without reseting Home Assistant because I want to be leatening to “bellow 250 W power sending to grid” only after I begin charging my car, even it it had spend all morning with 250 W power being sent to the grid.

Triggers only happen once. They only happen again when the limit chante. If I have a trigger to 200 lux, it will trigger once the 200 lux ir passed and again only the day after, when we passed bellow 200 lux and only after that it will “listening” to that variable again, firiging when it passed 200 lux again. How can I force a “above 200 lux” trigger when I’m already at 500 lux for the laste couple or ours? How can I activate a automation and make that trigger goes off even if that variable is already above the trigger configuration event?