I am just starting out with addressable LED-lights. I got a 12-LED-Ringlight and set it up with ESPHome (on a ESP8266, platform: neopixelbus). It shows up in HA and I can control the whole light via HA already.
I want to connect it to my CO2 sensor so that if CO2 levels are at 400ppm all LEDs are green and when CO2-level is rising, each of the LEDs turns red one by one until the room reaches 1000ppm and all LEDs are red. Like a progress bar so to speak
The problem is that I have no clue how to go about this problem. I know there are light effects pre-programmable effects with ESPHome, but how do I write an automation for this specific conditional lighting?
I searched already to the best of my knowledge, but came up empty. Does anybody have an idea?
You will want to put a condition on the sensor value, so that for a given range the light is turned on to a different colour - I believe something like the following should work (untested).
Does this code assume that both the light and sensor is on the same controller? Because I have mine on different. Or can I just add this to my sensor code, and it will work regardless of different devices?
I see in the terminal that the device is getting the values from HA, but the lights do not turn on. Theoretically, all LEDs should be red. What did I wrong?