hassio-conf/templates/office.yaml

23 lines
1.2 KiB
YAML
Raw Normal View History

2024-10-17 19:45:45 +00:00
- sensor:
- name: office_sensor_air_quality_rating
unit_of_measurement: ppb
state: "{{ states('sensor.office_sensor_air_quality_voc') | float(0) }}"
icon: >
{% if states.sensor.office_sensor_air_quality_voc.state is defined %}
{% if not is_state('sensor.office_sensor_air_quality_voc', ['unknown', 'unavailable']) %}
{% if float(states('sensor.office_sensor_air_quality_voc')) < 150 %}
mdi:star-circle
{% elif float(states('sensor.office_sensor_air_quality_voc')) >= 150 and float(states('sensor.office_sensor_air_quality_voc')) < 400 %}
mdi:star-circle-outline
{% elif float(states('sensor.office_sensor_air_quality_voc')) >= 400 and float(states('sensor.office_sensor_air_quality_voc')) < 1300 %}
mdi:check-circle-outline
{% elif float(states('sensor.office_sensor_air_quality_voc')) >= 1300 and float(states('sensor.office_sensor_air_quality_voc')) < 4000 %}
mdi:alert-circle-outline
{% elif float(states('sensor.office_sensor_air_quality_voc')) >= 4000 %}
mdi:radioactive-circle-outline
{% endif %}
{% else %}
mdi:circle-off-outline
{% endif %}
{% endif %}