This works fine except it sends any change even less than 1 degree. I would like to prevent this and have it only trigger the action only when the temperature change is at least 1 degree or more. How can I do this?
You lost me here I’m afraid I don’t understand how this equates to a 1 degree temp change.
I am assuming that trigger.from_state.state is not what is really placed under the condition but changed to some numeric vale just dont understand what that change would look like
Can you clarify what it is you are trying to get out of your sensor? If you simply want to know if the sensor’s state value increase more than 1 degree during a single update you could do that using a template condition as in the example below.
Also, you should limit your trigger to the attribute you are interested in. By not declaring a to:, from:, or attribute: variables you have created a trigger that will fire on every change of climate.sunroom's state as well as any change of any of its attributes.
However, this is not a great method because it relies on a large temp change between reporting cycles. Better options are the Trend and Threshold/Derivative sensor platforms.
Oops. My mistake on not being clear enough. It is any change amount greater than (-/+)1 degree whether the temperature is rising or going down. (i.e from 22 to 23.1 or from 23.1 to 22. Either case should trigger the action)
I thought maybe it was the abs but I tried different combinations (i.e float) with only a 0.1 change to make it trigger when I knew the temperature was rising/declining. Nothing I tried worked.
The log confirmed that the above automation works (albeit every 0.1 degeer change) but once the condition is enabled nothing shows up in this log.
My gut feeling is that it is related to the trigger.to_state.state and trigger.from_state.state. Correct me if I am wrong but does the from state value not change as soon as there is a temperature change. For example:
From = 24.1
A change occurs and
To = 24.2
Another change occurs and
To = 24.3
At this point does From not equal 24.2??
If that is correct then value_template: "{{ (trigger.to_state.state - trigger.from_state.state)|abs > 1 }} will never occur
The answer to your question is totally dependent on how your temperature sensor’s reporting works. Some sensor report every change, some report at a specific time interval, others do a combination… for example I tried the automation with a Xiaomi sensor warmed up to 85F and allowed it to drop to 65F and only had two executions of the action.
Which is why I included the following in my original comment:
Yeah, the sensor in question reports every 0.1 change and I am trying to avoid sending such small change to the remote device. I think I’ll look at my shell_command and change it to send these frequent changes to my local server, process it there and send only when it meets my criteria.