@sirfalo wrote:
Hi
I have small problem which I can’t find out how to solve.
I made template sensor to recalculate PM2.5 value to have as percentage.
sensor.air_quality_pm25 is my sensorSo I made this:
- platform: template sensors: in_pollution_perc: value_template: "{{(((states.sensor.air_quality_pm25.state|round)/25)*100)|round|int}}" friendly_name: "In PM2.5 %" unit_of_measurement: "%"
And it’s working, but out come is something like 32.0% or 40.0000000000001%, but when I was testing SAME template value
{{(((states.sensor.air_quality_pm25.state|round)/25)*100)|round|int}}
, then it was just INTEGER (32% or 40%).
Any ideas?
Posts: 11
Participants: 5