Get absolute number/value


Is there anyway this code can be adjusted to get the absolute value/number?

- sensor.template.publish:
            id: oil_level_percentage
            state: !lambda 'return x - 1.05;'

Thanks in advance

lambda is just C++.

            state: !lambda 'return abs(x - 1.05);'

EDIT: Oops you are using a float:

            state: !lambda 'return fabs(x - 1.05);'

@zoogara thank you your first solution worked a treat :+1: