Hi there,
i wrote an automation wich should if-sun goes down and temperature of my solar pool heater goes below pool water temperature → turn off my pump, but it doesnt work as expected.
My code:
What you have described is not exactly what your automation configuration does.
Your automation is more accurately described as follows:
When the sun elevation changes from above 10 to below 10,
if temperature_3_2is already below temperature_2_2,
then turn off the pump.
The trigger will only fire once in the evening, but if the temperature_3_2 is above the temperature_2_2at that moment the pump will keep running. A change in temperature_3_2 after the trigger will have no effect.
My setup in these situations where the order of events can be either way, is to set both conditions as triggers and conditions. So either the sun setting or the temp dropping can trigger the automation but both things have to be true for it to fire the action.
If you are not sure with the tempate, go to Developer Tools → Templates and paste
‘{{ state_attr(“sun.sun”, “rising”) == false }}’
or
‘{{ state_attr(“sun.sun”, “elevation”) < 10 }}’
there. You will see the result.
Your code looks good to me, but i am a newbie