If the battery is charged (SCO > 98%) and it is more than 6:30 before sunset, and the temperature falls below 60°, it is switched on. Ok, so far
If the temperature falls below 60°C and SOC < 98°, it is not switched on, ok. If SOC rises to > 98% and the temperature is still < 60°C, it is not switched on. Why not?
The following should actually happen
Switch on if Temp <60° and SCO>98% and if it is 6:30 min before sunset.
ok, thanks.
How can I realiaze that e.g. every 5 min it shall be checked?
The solution I think is, I will add a 2nd automation anch change the condition, if temp is below 60° to only is and if SOC > 98 to trigger event. Running both in paralel is an or function and should cover both.
You can also add additional, second entity state trigger to your automation: SOC Battery house > 98.
Thanks to having 2 triggers, your automation will start on ANY following events:
If temperature drops below 60 degrees
If battery level will be above 98%
However, if any of your triggers will execute after 6:30, it won’t start (and it won’t wait till next day), so time_pattern trigger every X minutes seems to be better option for a trigger.
Hello,
thanks for the feedback.
I have 2 questions. One, explicitly about my problem, a general one
When I add the lines of code that Vlad has written, a second condition appears, see picture attached. Question: Is it switched on after 5 minutes or is it checked after 5 minutes whether the conditions are fulfilled and switched on after this check?
General question: If I have two switch-on conditions, condition A and condition B. Are these linked with “AND” or “OR”? So, do both have to occur or one?
Thank you
Haase
In general, time pattern triggers are a kludge. There’s no reason to keep checking on a fixed interval if some set of conditions are true. Instead, you only need to trigger when any of those conditions change. That will make your automation both more responsive and consume fewer resources. A win-win.
When you want multiple things to be true at the same time, the concept which szymon alluded to is often referred to as “matching triggers and conditions”. Meaning, if you want something to happen when 3 things become true, then you should add all three as separate triggers, and also add all three as separate conditions. That way, once any one of the 3 become true, the automation will then check if all the others are already true, and will only execute the actions if they are.
In your case, you want 3 triggers:
SOC rises above 98%
midnight
Temperature drops below 60°
And you want 3 conditions:
SOC > 98%
More than 6:30 before sunset (i.e. between midnight and 6:30 before sunset)
Temperature < 60°
Note that I choose midnight as a trigger because I’m assuming that is the earliest time that you’d consider being “before sunset” instead of “after sunset”
I don’t quite understand the time pattern yet. Below is a BSP. I have the automation, “Heating element down on”. It should switch on when the bottom buffer drops below 35 degrees and only between 6 am and 10.30 pm. So, for example, if the temperature falls below 35 degrees at 4.30 pm, it would not be switched on at 6.30 am. So, the system should check every 5 minutes whether the condition is fulfilled.
Now I have implemented it like this. It looks as if the automation switches on after 5 minutes, no matter what the values/conditions are. Take a look at the pictures in the link. Tem. buffer is 41 degrees, the part switches on, as trigger “time patter”
Please paste the YAML code. From the automation screen, click the three dots top-right. Then Edit as YAML. Then copy/paste the code in here formatted as code using the </> button.
If it looks like this:
alias: Pump restart
trigger:
platform: state
entity_id: switch.aquarium_pump_plug
to: “off”
…try again until it looks like this:
alias: Pump restart
trigger:
- platform: state
entity_id: switch.aquarium_pump_plug
to: "off"
In general, as @mekaneck said above, checking every X minutes is a poor way to run automations, but until we have the code you’re not likely to get better suggestions. Images are not fun to work with.
below the code. Every 5 min the conditions shall be checked. Depending on the result, it shall be switched, but it is switched after 5 min independent from the conditions. Why
THX
When temperature buffer down switch on, but only between 6:00am and 10:00 pm
So, the temperature can also fall below 35°C at 04:30am e.g. Then the part must switch on at 06:00. The triggers and conditions should therefore be checked every 5 minutes and depending on the result of this check it should be switched on.
Hello,
I understand how it works, good idea. Thanks!
Scenario 1: Temp > 35° at 6:00 am: Does not switch
Scenario 2: Temp < 35° at 4:30 am e.g. trigger “<35” would switch but condition “before 6 am” prevents this. At 06:00 am Trigger time=06:00am switches because both conditions are met
Scenario 3: Temp < 35° after 06:00 am. Trigger Tem<35° switches, both conditions are fulfilled.
Yes, we don’t need to check the triggers and conditions every 5 minutes here, but I’m interested in whether this is possible and if so, how.