Set value if a sensor value is greater than

Hi.

I’m struggeling with setting a value when calling a service.

I have a temprature sensor that ranges from 20 to 70, I need to use that value to call a service. This part i get to work, the problem is that if the temprature sensor is greater that 50 to service that receives the value fail.

In my automation I pass

{{ states('sensor.nibe_76959_40071') }}

Is there a way to calculate the vaule, so that if it is greater than 50, I want to pass an actual vaule of 50.

{{ [states('sensor.nibe_76959_40071') | int, 50] | min }}

This takes the minimum value between the sensor and 50.

1 Like