- Heater of humidiy sensor only on when humidity is above 96% (was 80%). When heater is on temperature sensor also heats up, so use temperature sensor of BMP280 when heater is on.
There is a bug in the Si7021 chip: when the sensor is exposed to extreme environmental conditions for a longer period (very high or very low humidity), the humidity register will wrap around and give wrong values. (https://community.silabs.com/s/question/0D51M00007xeOo9SAE/si7021-relative-humidity-reading-underflowing-?language=en_US).
Workaround: let's assume the humidity will never go below 15%. In the Netherlands a humidity below 20% is rare, but can occur and the minimum value ever measured in De Bilt was 6% (on 1 april 1965). At several other sites in the Netherlands the humidity went as low as 10%. But as this was a one time event and the measurements are doubtful, this event was not registered in the original database. (https://nl.wikipedia.org/wiki/Relatieve_luchtvochtigheid)
In rare cases, the humidity value could creep up above 15% (when the actual humidity is 100%) and still give wrong values.
- Main temperature and backup temperature registers switched: the sensor on the HYT221 heats up by the circuitry and is therefore about 1.5 degrees above ambient temperature. The BMP280 does not heat up.
### Added
- Debug messages can be switched on and off with the _DEBUG_ variable
The first hour, the ModBus register SensorRainIreg is instable. This is because in setup(), the variable RainPerHourCounter is set to the current millis() value. The RainPerHourCounter is the index for the array RainPerHour, which can hold 24 values. But the index is set to the millis() value, which can have a value abouve 23. This causes a buffer overflow. After the first hour, the index is reset and from thereon the register SensorRainIreg holds the proper rainfall value. The solution is that the variable HourTimer should be set to the current millis() value in setup().
```
-- ts = millis();
-- RainPerHourCounter = ts;
++ ts = millis();
++ HourTimer = ts;
```
Buffer roll over luminosity sensor. This happened because the raw value was mutiplied by 100. But that was wrong: copied this section of the code from the temperature sensor code, which uses this mutiply by 100 to gain precision.