24 lines
1.2 KiB
YAML
24 lines
1.2 KiB
YAML
---
|
|
sensor:
|
|
- name: bath_sensor_air_quality_rating
|
|
unit_of_measurement: ppb
|
|
state: "{{ states('sensor.bath_sensor_air_quality_voc') | float(0) }}"
|
|
icon: >
|
|
{% if states.sensor.bath_sensor_air_quality_voc.state is defined %}
|
|
{% if not is_state('sensor.bath_sensor_air_quality_voc', ['unknown', 'unavailable']) %}
|
|
{% if float(states('sensor.bath_sensor_air_quality_voc')) < 150 %}
|
|
mdi:star-circle
|
|
{% elif float(states('sensor.bath_sensor_air_quality_voc')) >= 150 and float(states('sensor.bath_sensor_air_quality_voc')) < 400 %}
|
|
mdi:star-circle-outline
|
|
{% elif float(states('sensor.bath_sensor_air_quality_voc')) >= 400 and float(states('sensor.bath_sensor_air_quality_voc')) < 1300 %}
|
|
mdi:check-circle-outline
|
|
{% elif float(states('sensor.bath_sensor_air_quality_voc')) >= 1300 and float(states('sensor.bath_sensor_air_quality_voc')) < 4000 %}
|
|
mdi:alert-circle-outline
|
|
{% elif float(states('sensor.bath_sensor_air_quality_voc')) >= 4000 %}
|
|
mdi:radioactive-circle-outline
|
|
{% endif %}
|
|
{% else %}
|
|
mdi:circle-off-outline
|
|
{% endif %}
|
|
{% endif %}
|