Closed martin-at-schorsch closed 3 years ago
You should be able to add that via configuration: take a look at the template sensor. You can specify a lambda that takes the current state of the iaq accuracy text sensor and converts it to a numeric value.
As @wifwucite suggests a lambda would work nicely, but since the changes to support an optional numeric sensor are pretty small I'll add that option too as it's a little bit neater :)
Yup, i'd like a numeric sensor aswell.
Would a 0-100% scale make sense in terms of Air Quality Index or would it "just" be an int ranging from 0 to 500? Maybe there's another scale that would be more meaningful, but my guess is that an Air Quality of >= 50% should alarm any Person.
Update: For now i did this with mini-graph-card
type: 'custom:mini-graph-card'
name: Air Quality
icon: 'mdi:air-filter'
hours_to_show: 2
points_per_hour: 6
lower_bound: 0
upper_bound: ~100
lower_bound_secondary: 0
upper_bound_secondary: 1
show:
name: true
icon: true
labels: false
labels_secondary: false
entities:
- entity: sensor.bme680_iaq
- entity: binary_sensor.bedroom_windows
smoothing: false
show_line: false
show_points: false
show_legend: false
color: white
y_axis: secondary
state_map:
- value: 'off'
label: closed
- value: 'on'
label: open
color_thresholds:
- value: 0
color: '#00E400'
- value: 51
color: '#FFFF00'
- value: 101
color: '#FF7E00'
- value: 151
color: '#FF0000'
- value: 201
color: '#99004C'
- value: 301
color: '#7E0023'
Thresholds / Colors from https://en.wikipedia.org/wiki/Air_quality_index
@itsyoshio The IAQ is available as a numeric sensor already which outputs in the range 0 to 500. This issue is about exposing the accuracy as a numeric sensor in addition to the existing text sensor. Your graph setup looks like it works well.
Thx for adding the feature!
Nice work, thx!
When storing values in a database like influxdb, iaq accuracy as numeric sensor value in addition to text would be nice.