(OBSOLETE) ESP MQTT JSON Multisensor for Home Assistant. Supported sensors include the TEMT6000 light, AM312 PIR, DHT22 temperature/humidity sensors. RGB led supports flash, fade, and transition. Over-The-Air (OTA) uploading, too!
The maximum analogWrite on the ESP8266 value is not 255 (as in the code) but 1023. Because of that the LED is much less bright than it could theoretically be.
Adapting the map-command results in the following problems:
larger datatype for the real"Color" variables needed (int would be fitting)
the timing concerning fadetimes is different (positive about it: the LED can be dimmed much more smoothly due to more steps)
I tried adapting the code but I failed at the transition-part.
The following piece of code (in the callback-function) should work fine:
realBrightness, realRed, realGreen, realBlue must now be integer-variables.
Now theoretically only the problem with the fade time is left: I tried increasing the number of steps from 1020 to 4090 or so... but then I failed making the whole process faster (more steps @ same time -> the Count-Loop must be processed more oftenly -> the whole loop must be faster)...
By the way you also need to adapt the following if-condition:
// Defensive driving: make sure val stays in the range 0-255
if (val > 1023) {
val = 1023;
}
The maximum analogWrite on the ESP8266 value is not 255 (as in the code) but 1023. Because of that the LED is much less bright than it could theoretically be. Adapting the map-command results in the following problems:
I tried adapting the code but I failed at the transition-part. The following piece of code (in the callback-function) should work fine:
realBrightness, realRed, realGreen, realBlue must now be integer-variables.
Now theoretically only the problem with the fade time is left: I tried increasing the number of steps from 1020 to 4090 or so... but then I failed making the whole process faster (more steps @ same time -> the Count-Loop must be processed more oftenly -> the whole loop must be faster)...
By the way you also need to adapt the following if-condition: // Defensive driving: make sure val stays in the range 0-255 if (val > 1023) { val = 1023; }