I’m trying to generate a boolean value that is used to determine when a graph is displayed in a dashboard. The idea is that when the sensor.air_quality_index is above an input_number.aqi_graph_display_threshold, this would make the AQI graph appear in the dashboard.
In my templates.yaml file, I have a few sensors and binary_sensors that work well. But this one just can’t. I thought it might be due to the values changing but the template not re-evaluating, so I added the sensors as triggers, but that didn’t help. I though it might be due to an int not comparing to a float, so I tried forcing them both to float and int, but neither helped.
In today’s case, sensor.air_quality_index is 32, and input_number.aqi_graph_display_threshold is 12. So I would expect aqi_graph_display_threshold_met to evaluate to true. But it’s always false.
This one has me stumped. I’d appreciate any clues.
- trigger:
- platform: numeric_state
entity_id:
- input_number.aqi_graph_display_threshold
- sensor.air_quality_index
above: 10
binary_sensor:
- name: aqi_graph_display_threshold_met
state: "{{ (states('sensor.air_quality_index') | float(0)) > (states('input_number.aqi_graph_display_threshold') | float(0)) }}"