Hello, can someone help me please?
I want the thermostatic valve to be switched off (for at least 10 minutes) when the flow cools down or the return is only 3 ° colder than the flow. otherwise switch on
Temp(v [2 minutes ago])> temp(v) OR Temp(v)-3<Temp( r )
You will need to create another entity to hold the value of your current temperature that only gets updated periodically via an automation.
you can use a time pattern trigger to update the entity periodically. While the “periodically” might be assumed logically to be every 2 minutes that wouldn’t meet your needs since the sensor value will only ever be at most 2 minutes old, but the value could be only a few seconds old depending on where you are in the update cycle. So you will need something that will hold a history of values that you can pick out the one that as close to 2 minutes as reasonably possible.
then you can create an automation that sets the variable state every, let’s say 30 seconds, and then shift the state to an attribute to act kind of like a shift register.
then since the value of the variable history attribute gets updated every 30 seconds then the value from 2 minutes ago should be history_3 (i think…or maybe history_4).
then use can use that variable attribute in your calculation.
it won’t ever be from exactly 2 minutes ago but it will be from between 1:30 and 2 minutes ago.
you can obviously tighten that down further but you will need to make the list of history_x attributes long enough to catch all of the register shifts. that list could get pretty long the more often you update the variable.
Like I said it’s a bit involved but I don’t know of any other way to do it to capture a historical distinct value.
Sorry that was a copy/paste error on my part but you fixed it.
aside from that do you have any values in the “sensor.shelly1_f4cfa2e47733_temperature_2” when you look at the sensor in your states page?
or any values for “sensor.shelly1_f4cfa2e47733_temperature”?
it’s impossible for me to know exactly which entities to use since I can’t see the real life states in your config so I just used the “_2” sensor as an example.
I suggest you familiarize yourself with the Trend Binary Sensor. It may be useful for your current requirement (or possibly future projects).
It can be configured to report when a sensor’s values are following a certain trend. For example, when a temperature sensor is reporting decreasing temperature (and you can define the rate of decrease).