I’m too invested now, I need this to work for you haha. I still think the trend might be helpful here (unless I’m mistaken), or actually a Derivative sensor might be better still, but the concept of trend tracking applies. Lets focus on the logical execution before tackling what exact sensors need to be made.
Okay so, re-reading your posts a couple times, and using some newly defined (hypothetical) variables, are the below logical statements correct?
The offset is tied to your desired room temp. A warmer room temperature will make the offset -ve, and colder room temp will make the offset +ve. Reaching the desired room temp, the offset is 0
let’s assume/create the following HA variables
adjusted_lwt = actual_lwt + offset
actual_lwt_trend is the derivative/trend sensor.
- IF
actual_lwt_trendis decreasing ANDadjusted_lwt < 30; turn off pump (I know, this part was the easy-to-handle part)
- IF
actual_lwt_trendis decreasing ANDoffset > 0(i.e. positive); turn on pump (here we ignore theadjusted_lwtformula as you said there are scenarios where it won’t resolve to >= 30, and instead simply use the presence of a decreasing trend and a +ve offset to turn the pump on) - IF
offset == 0ANDadjusted_lwt < 30, turn off pump - IF
adjusted_lwt >= 30; turn on pump (this blanket addresses any scenario whereactual_lwt + offsetis >= 30 where you want the pump on)
Sorry I don’t seem to understand water heating systems as well as you. As such, the above logical statements are seemingly a gross simplification (maybe even incorrect) of what you may want to achieve. But, my end point is you don’t have to only use the trend/derivative sensor…it just becomes an additional sensor in your arsenal to solve your logic problems (as seen in logic #2)