Hi
I have a air quality monitor with 3 coloured LED to show the status: red poor, yellow, medium, green good. But I cannot get the light to light up. I have resistors and the direction of the LED is correct, but I cannot seem to drive them. I have an output block in yaml:
output:
- id: light_RED
platform: gpio
pin: GPIO27
- id: light_YELLOW
platform: gpio
pin: GPIO9
- id: light_GREEN
platform: gpio
pin: GPIO10
and a couple of commands to set the value of the light:
text_sensor:
- platform: template
name: "Livingroom IAQ"
icon: "mdi:air-filter"
lambda: |-
id(iaq_index) = 5;
.../...
/*
* Transform IAQ index to human readable text according to Indoor Air Quality UK:
* http://www.iaquk.org.uk/
*/
ESP_LOGD("main", "Current IAQ index %d", id(iaq_index));
if (id(iaq_index) <= 6) {
id(light_RED).turn
.../...
else if (id(iaq_index) <= 14) {
id(light_RED).turn_off();
id(light_YELLOW).turn_on();
id(light_GREEN).turn_on();
return {"Good"};
}
else if (id(iaq_index) > 14) {
id(light_RED).turn_off();
id(light_YELLOW).turn_off();
id(light_GREEN).turn_on();
return {"Excellent"};
}
return {};
update_interval: 2min
Is there anything obviously wrong in this code?
The return value of Good, Excellent etc, I do see in HA.
– Paul