I have a solar energy (Fronius). And I have a heat patrone for my warm water.
I can switch on/off 3 steps of this heat patrone via KNX (1 to 3 kw).
I built the following logic:
Calculate the mean solar overflow (within 10 minutes).
Then i have the following ON rules:
Heat1: When solar overflow is > 1000w switch on heat1.
Heat2: When solar overflow is > 1000w AND heat1 is ON switch on heat2.
Heat3: When solar overflow is > 1000w AND heat2 is ON switch on heat3.
For OFF i have the following rules:
Heat3: When solar overflow is < 100w switch off heat3.
Heat2: When solar overflow is < 100w AND heat3 is OFF switch off heat2.
Heat1: When solar overflow is < 100w AND heat2 is OFF switch off heat1.
Now i have the following problem: My trigger is always, when the solar overflow (mean) entity gets bigger or lower my set value.
But now it can happen that there is solar overflow < 100w. Now Heat3 switches off.
If now the solar overflow will not gets bigger than 100w for a small time, then the rule for heat 2 and heat1 won´t trigger again, and this 2 heating stay online.
I hope you understand my problem, how can i solve this? I think i need another trigger?
You can use a delay to add waiting time after one of these steps just ran.
Additionally your hysteresis is negative. I’d use more. If your heat1 uses 1000W and you turn on at overflow 1000 → your overflow is 0 now. Your turn-off rule immediately applies.
Fronius inverters have quite nice internal logics for these kind of stuff. I use a KNX binary sensor to read the IOs of my inverters and trigger some KNX switch actuators based on that (KNX to transport the signal through the house). That makes it independent of HA, but still supervisable through KNX.
Thanks a lot for your answer. The delay won´t fix my problem.
Since I use the mean solar overflow over 10 minutes, it can happen that Heat3 switches off, and the solar overflow won´t get over the 100w again, and then the other 2 stays on, because automation is only triggered when the overflow gets below 100w.
Ah, I see what you mean. You can change the trigger to not use numeric_state with below (if you use this now), but only state. This will not only trigger when the value is crossed, but on every change. You can then evaluate if it is below or above a value in the action part.
If you need real periodic evaluation you could just use a time trigger (maybe additionally). But I think its very unlikely that that value stays exactly the same for a longer time period.
Or consider not using a calculated mean value, but a more often updated one. You can’t look in the future anyway
I use this in my solar automation (thermal, not photovoltaic).
Using a mean value is always a look in the past. You can’t predict if anyone will start cooking a meal just when your automation starts anyway.
Id use some leeway in the turn on power - like when it uses 1000W - start at ~1200W and turn off at 0W.
A delay helps to not switch too often - to not wear out the Relais or heater.
Okay, so using the leeway. And additional a delay?
If there more than 1200w wait 5 minutes and then turn on?
What happens if another trigger happens in this time? Can the delay lead to problems?
Like we are over 1200w, he waits 5 minutes and switches on. But in the meantime we are already below 1200w, and the off switch triggers?
One last question: “Wait 5 minutes before evaluating next trigger” - isn´t that exactly the delay?
Like when the automation1 switches on the first heating, and aftert this i set the delay?
Or how do i say, after heating1 is on, wait 5 minutes till evaluating next rule?
Sure. With some choose: or if: then: you can probably do this in one. See my example above - you can add a and condition to evaluate if heat_1 or heat_2 already runs. Or you use templates.
Not sure if it gets easier to read though
Another way would be to activate / deactivate the upper level automation from a lower level one. So if heat_1 is ON, delay (or not) and then activate heat_2 automation. Same for heat_3 from heat_2. You’d have to make sure that it is always turned off when an automation gets deactivated then
I’d probably do ON and OFF in the same automation in any way.
trigger:
- platform: state
entity_id:
- sensor.solar_uberschuss_3
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.solar_uberschuss_3
above: 800
sequence:
# your on sequence here
- conditions:
- condition: numeric_state
entity_id: sensor.solar_uberschuss_3
below: 20
sequence:
# your off sequence here
with templates this can be done even more compact / complex
Eg. set a variable to “on” or “off” depending on the state of sensor.solar_uberschuss_3 or use a variable for which switch should be switched.
Have a look here for some examples Best Practices for ON/OFF within the same Automation