Automation condition absolute value

I’d like to automate a condition when a the absolute value of a sensor (which is negative) becomes greater than another sensor value (which is positive). I am working in the visual editor and can workin yaml but don’t know the coding required for the absolute value of a sensor value. TYVM!

You’re going to need templating for that.

{{ states('sensor.whale')|abs > states('sensor.petunia') }}

You’re comparing strings Tinkerer.

{{ states('sensor.whale')|float(42)|abs > states('sensor.petunia')|float(42) }}
1 Like

That sounds more like a trigger to me.

Thanks for the replies. This indeed was an easy fix using templating in configuration.yaml. I actually needed the sign reversed rather than absolute value so I multiplied by -1 to get the value I needed.