diff --git a/tasmota/tasmota_xsns_sensor/xsns_11_veml6070.ino b/tasmota/tasmota_xsns_sensor/xsns_11_veml6070.ino index 343ff4852..3ff8dcb2a 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_11_veml6070.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_11_veml6070.ino @@ -30,6 +30,8 @@ -------------------------------------------------------------------------------------------- Version Date Action Description -------------------------------------------------------------------------------------------- + 1.0.0.4 20250521 fixed - in Veml6070Detect check for the presence of both addresses in + the bus to avoid misdetection with ATH20/21 1.0.0.3 20181006 fixed - missing "" around the UV Index text - thanks to Lisa she had tested it on here mqtt system. @@ -128,7 +130,9 @@ char str_uvrisk_text[10]; void Veml6070Detect(void) { - if (!I2cSetDevice(VEML6070_ADDR_L)) { return; } + // check for presence of both addresses do avoid misdetection + if (!I2cSetDevice(VEML6070_ADDR_L) + || !I2cSetDevice(VEML6070_ADDR_H)) { return; } // init the UV sensor Wire.beginTransmission(VEML6070_ADDR_L); diff --git a/tasmota/tasmota_xsns_sensor/xsns_16_tsl2561.ino b/tasmota/tasmota_xsns_sensor/xsns_16_tsl2561.ino index 357522cfb..151d73938 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_16_tsl2561.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_16_tsl2561.ino @@ -73,6 +73,9 @@ void Tsl2561Detect(void) uint8_t id; Tsl.begin(); if (!Tsl.id(id)) return; + // check the correct ID was returned + // datasheet says reg 0xA (ID) returns 0x1r (r = nibble revision) + if ((id & 0xF0) != 0x10) return; if (Tsl.on()) { tsl2561_type = 1; I2cSetActiveFound(Tsl.address(), tsl2561_types); diff --git a/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino b/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino index 37f456bea..5578c7121 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_57_tsl2591.ino @@ -38,6 +38,8 @@ Adafruit_TSL2591 tsl = Adafruit_TSL2591(); uint8_t tsl2591_type = 0; uint8_t tsl2591_valid = 0; float tsl2591_lux = 0; +uint16_t tsl2591_lux_bb = 0; +uint16_t tsl2591_lux_ir = 0; tsl2591Gain_t gain_enum_array[4] = {TSL2591_GAIN_LOW,TSL2591_GAIN_MED,TSL2591_GAIN_HIGH,TSL2591_GAIN_MAX}; tsl2591IntegrationTime_t int_enum_array[6] = {TSL2591_INTEGRATIONTIME_100MS,TSL2591_INTEGRATIONTIME_200MS,TSL2591_INTEGRATIONTIME_300MS,TSL2591_INTEGRATIONTIME_400MS,TSL2591_INTEGRATIONTIME_500MS,TSL2591_INTEGRATIONTIME_600MS}; @@ -62,6 +64,8 @@ void Tsl2591Read(void) ir = lum >> 16; full = lum & 0xFFFF; tsl2591_lux = tsl.calculateLux(full, ir); + tsl2591_lux_bb = full; + tsl2591_lux_ir = ir; tsl2591_valid = 1; } @@ -81,7 +85,8 @@ void Tsl2591Show(bool json) char lux_str[10]; dtostrf(tsl2591_lux, sizeof(lux_str)-1, 3, lux_str); if (json) { - ResponseAppend_P(PSTR(",\"TSL2591\":{\"" D_JSON_ILLUMINANCE "\":%s}"), lux_str); + ResponseAppend_P(PSTR(",\"TSL2591\":{\"" D_JSON_ILLUMINANCE "\":%s,\"IR\":%u,\"Broadband\":%u}"), + lux_str,tsl2591_lux_ir,tsl2591_lux_bb); #ifdef USE_DOMOTICZ if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, tsl2591_lux); } #endif // USE_DOMOTICZ