I tried to build a simple temperature and humidity-sensor with an integrated status LED to read out the current humidity-state with a single color.
green: ok
yellow: meh
red: too high
In the beginning I noted that the LED keeps the color it had on bootup, which might be problematic for many reasons. Therefore I added a “bootstate color” to indicate that it is not ready yet and to prevent a “frozen” state which might lead to misunderstandings for example.
My Issue:
In my case it does not change back the color it had before blue, if the value_range is the same before the boot.
It seems to look like my value range does not change and therefore it does not trigger the service calls.
If it suddendly changes the range, the other colors are triggered without a problem.
Is there any way to “reset” the value_range or even force the sensor to retrigger?
You need to add a “below” value if there is a next above, otherwise you have an “open range” and that is valid from the above value till infinity See also: Sensor Component — ESPHome
Thanks for your reply, but the problem is NOT the switching between the colours green (G) yellow (Y) red (R).
I make an example:
I currently have 54% which is GREEN - now i reboot → it becomes BLUE → after boot the sensor needs some time and records 54% again (which is in the “green range”) and it still stays blue.
To verify my “ranges/triggers” are working, I blowed into the sensor to make humidity skyrocket, forcing the sensor to go to the “red range”:
[18:40:35][D][dht:048]: Got Temperature=22.7°C Humidity=66.0%
[18:40:35][D][sensor:126]: 'Multisensor Temperature': Sending state 22.70000 °C with 1 decimals of accuracy
[18:40:35][D][sensor:126]: 'Multisensor Humidity': Sending state 66.00000 % with 0 decimals of accuracy
[18:40:35][D][light:035]: 'RGB LED' Setting:
[18:40:35][D][light:050]: Brightness: 40%
[18:40:35][D][light:057]: Red: 100%, Green: 0%, Blue: 0%
[18:40:35][D][light:084]: Transition length: 1.0s
[18:40:45][D][dht:048]: Got Temperature=24.6°C Humidity=76.0%
[18:40:45][D][sensor:126]: 'Multisensor Temperature': Sending state 24.60000 °C with 1 decimals of accuracy
[18:40:45][D][sensor:126]: 'Multisensor Humidity': Sending state 76.00000 % with 0 decimals of accuracy
[18:40:55][D][dht:048]: Got Temperature=24.5°C Humidity=76.0%
Now I waited a bit and humidity is normalizing:
[18:42:35][D][sensor:126]: 'Multisensor Temperature': Sending state 22.30000 °C with 1 decimals of accuracy
[18:42:35][D][sensor:126]: 'Multisensor Humidity': Sending state 60.00000 % with 0 decimals of accuracy
[18:42:35][D][light:035]: 'RGB LED' Setting:
[18:42:35][D][light:050]: Brightness: 40%
[18:42:35][D][light:057]: Red: 100%, Green: 100%, Blue: 0%
[18:42:35][D][light:084]: Transition length: 1.0s
[18:42:45][D][dht:048]: Got Temperature=22.3°C Humidity=58.0%
[18:42:45][D][sensor:126]: 'Multisensor Temperature': Sending state 22.30000 °C with 1 decimals of accuracy
[18:42:45][D][sensor:126]: 'Multisensor Humidity': Sending state 58.00000 % with 0 decimals of accuracy
Now I waited a bit and humidity is normalizing to green