Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95309

Template sensor differs from Template in DeVTools

$
0
0

@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 sensor

So 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

Read full topic


Viewing all articles
Browse latest Browse all 95309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>