diff --git a/src/main.cpp b/src/main.cpp index eac9bf9..ff2c9e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -182,8 +182,7 @@ struct sensordata struct sensordata dataTCS34725_colortemp; uint16_t value_colortemp, value_tcs_lux, value_tcs_r,value_tcs_g,value_tcs_b,value_tcs_c; unsigned long lastread_tcs34725=0; - - + #define TCS34725_MINLUXFORCT 30 //send only colortemperature values if lux is at least this high #endif #ifdef SENSOR_ANEMOMETER @@ -912,7 +911,11 @@ void loop_TCS34725_colortemp() checkESPStatus(); Homie.getLogger() << "colortemp tcs " << ": " << value_colortemp << endl; - sensorNode.setProperty("colortemp").send(String(value_colortemp)); + if (tcs.lux>=TCS34725_MINLUXFORCT) { + sensorNode.setProperty("colortemp").send(String(value_colortemp)); + }else{ + Homie.getLogger() << "didn't send tcs because light too low: " << tcs.lux << "lux" << endl; + } d.lastsentvalue=value_colortemp;