From 86e45969bde16bf221f012e1209b57db62ba2c2b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 2 Sep 2022 13:13:47 +0200 Subject: [PATCH] Support for DFRobot SEN0390 V30B ambient light sensor Add support for DFRobot SEN0390 V30B ambient light sensor (#16105) --- BUILDS.md | 329 +++++++++--------- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/include/tasmota_configurations.h | 1 + .../include/tasmota_configurations_ESP32.h | 2 + tasmota/my_user_config.h | 1 + tasmota/tasmota_support/support_features.ino | 4 +- .../tasmota_xsns_sensor/xsns_99_luxv30b.ino | 212 +++++++++++ tools/decode-status.py | 2 +- 9 files changed, 387 insertions(+), 166 deletions(-) create mode 100644 tasmota/tasmota_xsns_sensor/xsns_99_luxv30b.ino diff --git a/BUILDS.md b/BUILDS.md index 0850b2a2f..579d82d83 100644 --- a/BUILDS.md +++ b/BUILDS.md @@ -6,176 +6,177 @@ l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display Note: `minimal` variant is not listed as it shouldn't be used outside of the [upgrading](https://tasmota.github.io/docs/Upgrading/) process. -| Feature or Sensor | l | t | k | s | i | d | Remarks -|-----------------------|---|-------|---|---|---|---|-------- -| MY_LANGUAGE en_GB | x | x / x | x | x | x | x | -| USE_IMPROV | x | x / x | x | x | x | x | -| USE_UFILESYS | - | - / x | - | - | - | - | -| USE_ARDUINO_OTA | - | - / - | - | - | - | - | -| USE_DOMOTICZ | - | x / x | x | x | x | - | -| USE_HOME_ASSISTANT | - | - / - | - | - | - | - | -| USE_TASMOTA_DISCOVERY | x | x / x | x | x | x | x | -| USE_MQTT_TLS* | - | - / x | - | - | - | - | -| USE_MQTT_AWS_IOT | - | - / - | - | - | - | - | -| USE_4K_RSA | - | - / - | - | - | - | - | -| USE_TELEGRAM | - | - / - | - | - | - | - | -| USE_KNX | - | - / x | x | - | - | - | -| USE_WEBSERVER | x | x / x | x | x | x | x | -| USE_WEBSEND_RESPONSE | - | - / - | - | - | - | - | -| USE_EMULATION_HUE | x | x / x | - | x | - | - | -| USE_EMULATION_WEMO | x | x / x | - | x | - | - | -| USE_DISCOVERY | - | - / - | - | - | - | - | -| WEBSERVER_ADVERTISE | - | x / - | x | - | - | x | -| MQTT_HOST_DISCOVERY | - | - / - | - | - | - | - | -| USE_TIMERS | x | x / x | x | x | x | x | -| USE_TIMERS_WEB | x | x / x | x | x | x | x | -| USE_SUNRISE | x | x / x | x | x | x | x | -| USE_RULES | x | x / x | x | x | x | x | -| USE_SCRIPT | - | - / - | - | - | - | - | -| USE_EXPRESSION | - | - / - | - | - | - | - | -| SUPPORT_IF_STATEMENT | - | - / - | - | - | - | - | -| USE_HOTPLUG | - | - / - | - | - | - | - | -| USE_PROMETHEUS | - | - / - | - | - | - | - | -| USE_PING | - | - / - | - | - | - | - | -| | | | | | | | -| Feature or Sensor | l | t | k | s | i | d | Remarks -| ROTARY_V1 | - | x / x | - | x | - | - | -| USE_SONOFF_RF | - | x / - | x | x | - | - | -| USE_RF_FLASH | - | x / - | x | x | - | - | -| USE_SONOFF_SC | - | x / - | x | x | - | - | -| USE_TUYA_MCU | x | x / - | x | x | - | x | -| USE_ARMTRONIX_DIMMERS | - | x / - | x | - | - | - | -| USE_PS_16_DZ | - | x / - | x | - | - | - | -| USE_SONOFF_IFAN | - | x / - | x | - | - | - | -| USE_BUZZER | - | x / x | x | x | - | - | -| USE_ARILUX_RF | - | x / - | x | - | - | - | -| USE_SHUTTER | - | x / x | x | - | - | - | -| USE_DEEPSLEEP | - | x / x | - | x | - | - | -| USE_EXS_DIMMER | - | x / - | x | - | - | - | -| USE_DEVICE_GROUPS | - | x / x | - | - | - | - | -| USE_PWM_DIMMER | - | x / - | x | - | - | - | -| USE_KEELOQ | - | - / - | - | - | - | - | -| USE_SONOFF_D1 | - | x / - | x | - | - | - | -| USE_SHELLY_DIMMER | - | x / - | - | - | - | - | -| USE_AC_ZERO_CROSS_DIMMER | - | x / x | x | x | x | x | -| | | | | | | | -| Feature or Sensor | l | t | k | s | i | d | Remarks -| USE_LIGHT | x | x / x | x | x | x | x | -| USE_WS2812 | - | x / x | x | x | - | x | -| USE_WS2812_DMA | - | - / - | - | - | - | - | -| USE_MY92X1 | - | x / - | x | x | - | x | -| USE_SM16716 | - | x / - | x | x | - | x | -| USE_SM2135 | - | x / - | x | x | - | x | -| USE_SM2335 | - | x / - | x | x | - | x | -| USE_BP5758D | - | x / - | x | x | - | x | -| USE_SONOFF_L1 | - | x / - | x | x | - | x | -| USE_ELECTRIQ_MOODL | - | x / - | x | x | - | x | -| | | | | | | | -| USE_ENERGY_SENSOR | x | x / x | x | x | - | - | -| USE_ENERGY_DUMMY | x | x / x | x | x | - | - | -| USE_PZEM004T | - | x / x | x | x | - | - | -| USE_PZEM_AC | - | x / x | x | x | - | - | -| USE_PZEM_DC | - | x / x | x | x | - | - | -| USE_MCP39F501 | x | x / - | x | x | - | - | -| USE_SDM72 | - | - / x | - | x | - | - | -| USE_SDM120 | - | - / x | - | x | - | - | -| USE_SDM230 | - | - / x | - | - | - | - | -| USE_SDM630 | - | - / x | - | x | - | - | -| USE_DDS2382 | - | - / x | - | x | - | - | -| USE_DDSU666 | - | - / x | - | x | - | - | -| USE_SOLAX_X1 | - | - / - | - | - | - | - | -| USE_LE01MR | - | - / - | - | - | - | - | -| USE_BL09XX | x | x / x | x | x | - | - | -| USE_TELEINFO | - | - / - | - | - | - | - | -| USE_IEM3000 | - | - / - | - | - | - | - | -| USE_WE517 | - | - / - | - | - | - | - | -| | | | | | | | -| USE_ADC_VCC | x | - / - | - | - | x | - | -| USE_COUNTER | - | x / x | x | x | - | x | -| USE_DS18x20 | - | x / x | x | x | - | x | -| USE_DHT | - | x / x | x | x | - | x | -| USE_MAX31855 | - | - / x | - | x | - | - | -| USE_MAX31865 | - | - / - | - | - | - | - | -| USE_THERMOSTAT | - | - / - | - | - | - | - | -| USE_LMT01 | - | - / x | - | x | - | - | -| | | | | | | | -| Feature or Sensor | l | t | k | s | i | d | Remarks -| USE_I2C | - | x / x | x | x | - | x | -| USE_SHT | - | - / x | - | x | - | - | -| USE_HTU | - | - / x | - | x | - | - | -| USE_BMP | - | - / x | - | x | - | - | -| USE_BME68X | - | - / x | - | x | - | - | -| USE_BH1750 | - | - / x | - | x | - | - | -| USE_VEML6070 | - | - / x | - | x | - | - | -| USE_ADS1115 | - | - / x | - | x | - | - | -| USE_INA219 | - | - / x | - | x | - | - | -| USE_INA226 | - | - / - | - | - | - | - | -| USE_SHT3X | - | - / x | - | x | - | - | -| USE_TSL2561 | - | - / - | - | - | - | - | -| USE_TSL2591 | - | - / - | - | - | - | - | -| USE_MGS | - | - / x | - | x | - | - | -| USE_SGP30 | - | - / x | - | x | - | - | -| USE_SGP40 | - | - / x | - | x | - | - | -| USE_SI1145 | - | - / - | - | - | - | - | -| USE_LM75AD | - | - / x | - | x | - | - | -| USE_APDS9960 | - | - / - | - | - | - | - | -| USE_MCP230xx | - | - / - | - | - | - | - | -| USE_PCA9685 | - | - / - | - | - | - | - | -| USE_MPR121 | - | - / - | - | - | - | - | -| USE_CCS811 | - | - / - | - | x | - | - | -| USE_CCS811_V2 | - | - / x | - | - | - | - | -| USE_MPU6050 | - | - / - | - | - | - | - | -| USE_DS3231 | - | - / - | - | - | - | - | -| USE_MGC3130 | - | - / - | - | - | - | - | -| USE_MAX44009 | - | - / - | - | - | - | - | -| USE_SCD30 | - | - / x | - | x | - | - | -| USE_SCD40 | - | - / x | - | - | - | - | -| USE_SPS30 | - | - / - | - | - | - | - | -| USE_ADE7880 | - | - / - | - | - | - | - | -| USE_ADE7953 | - | x / x | x | x | - | x | -| USE_VL53L0X | - | - / x | - | x | - | - | -| USE_VL53L1X | - | - / - | - | - | - | - | -| USE_MLX90614 | - | - / - | - | - | - | - | -| USE_CHIRP | - | - / - | - | - | - | - | -| USE_PAJ7620 | - | - / - | - | - | - | - | -| USE_PCF8574 | - | - / - | - | - | - | - | -| | | | | | | | -| Feature or Sensor | l | t | k | s | i | d | Remarks -| USE_HIH6 | - | - / x | - | x | - | - | -| USE_DHT12 | - | - / x | - | x | - | - | -| USE_DS1624 | - | - / x | - | x | - | - | -| USE_AHT1x | - | - / - | - | - | - | - | -| USE_HDC1080 | - | - / - | - | - | - | - | -| USE_WEMOS_MOTOR_V1 | - | - / x | - | x | - | - | -| USE_IAQ | - | - / x | - | x | - | - | -| USE_AS3935 | - | - / x | - | x | - | - | -| USE_VEML6075 | - | - / - | - | - | - | - | -| USE_VEML7700 | - | - / - | - | - | - | - | -| USE_MCP9808 | - | - / - | - | - | - | - | -| USE_MLX90640 | - | - / - | - | - | - | - | -| USE_HP303B | - | - / - | - | - | - | - | -| USE_EZOCO2 | - | - / - | - | - | - | - | -| USE_EZODO | - | - / - | - | - | - | - | -| USE_EZOEC | - | - / - | - | - | - | - | -| USE_EZOFLO | - | - / - | - | - | - | - | -| USE_EZOHUM | - | - / - | - | - | - | - | -| USE_EZOO2 | - | - / - | - | - | - | - | -| USE_EZOORP | - | - / - | - | - | - | - | -| USE_EZOPH | - | - / - | - | - | - | - | -| USE_EZOPMP | - | - / - | - | - | - | - | -| USE_EZOPRS | - | - / - | - | - | - | - | -| USE_EZORGB | - | - / - | - | - | - | - | -| USE_EZORTD | - | - / - | - | - | - | - | -| USE_SEESAW_SOIL | - | - / - | - | - | - | - | -| USE_TOF10120 | - | - / - | - | - | - | - | -| USE_BM8563 | - | - / - | - | - | - | - | -| USE_AM2320 | - | - / - | - | - | - | - | +| Feature or Sensor | l | t | k | s | i | d | Remarks +|---------------------------|---|-------|---|---|---|---|-------- +| MY_LANGUAGE en_GB | x | x / x | x | x | x | x | +| USE_IMPROV | x | x / x | x | x | x | x | +| USE_UFILESYS | - | - / x | - | - | - | - | +| USE_ARDUINO_OTA | - | - / - | - | - | - | - | +| USE_DOMOTICZ | - | x / x | x | x | x | - | +| USE_HOME_ASSISTANT | - | - / - | - | - | - | - | +| USE_TASMOTA_DISCOVERY | x | x / x | x | x | x | x | +| USE_MQTT_TLS* | - | - / x | - | - | - | - | +| USE_MQTT_AWS_IOT | - | - / - | - | - | - | - | +| USE_4K_RSA | - | - / - | - | - | - | - | +| USE_TELEGRAM | - | - / - | - | - | - | - | +| USE_KNX | - | - / x | x | - | - | - | +| USE_WEBSERVER | x | x / x | x | x | x | x | +| USE_WEBSEND_RESPONSE | - | - / - | - | - | - | - | +| USE_EMULATION_HUE | x | x / x | - | x | - | - | +| USE_EMULATION_WEMO | x | x / x | - | x | - | - | +| USE_DISCOVERY | - | - / - | - | - | - | - | +| WEBSERVER_ADVERTISE | - | x / - | x | - | - | x | +| MQTT_HOST_DISCOVERY | - | - / - | - | - | - | - | +| USE_TIMERS | x | x / x | x | x | x | x | +| USE_TIMERS_WEB | x | x / x | x | x | x | x | +| USE_SUNRISE | x | x / x | x | x | x | x | +| USE_RULES | x | x / x | x | x | x | x | +| USE_SCRIPT | - | - / - | - | - | - | - | +| USE_EXPRESSION | - | - / - | - | - | - | - | +| SUPPORT_IF_STATEMENT | - | - / - | - | - | - | - | +| USE_HOTPLUG | - | - / - | - | - | - | - | +| USE_PROMETHEUS | - | - / - | - | - | - | - | +| USE_PING | - | - / - | - | - | - | - | +| | | | | | | | +| Feature or Sensor | l | t | k | s | i | d | Remarks +| ROTARY_V1 | - | x / x | - | x | - | - | +| USE_SONOFF_RF | - | x / - | x | x | - | - | +| USE_RF_FLASH | - | x / - | x | x | - | - | +| USE_SONOFF_SC | - | x / - | x | x | - | - | +| USE_TUYA_MCU | x | x / - | x | x | - | x | +| USE_ARMTRONIX_DIMMERS | - | x / - | x | - | - | - | +| USE_PS_16_DZ | - | x / - | x | - | - | - | +| USE_SONOFF_IFAN | - | x / - | x | - | - | - | +| USE_BUZZER | - | x / x | x | x | - | - | +| USE_ARILUX_RF | - | x / - | x | - | - | - | +| USE_SHUTTER | - | x / x | x | - | - | - | +| USE_DEEPSLEEP | - | x / x | - | x | - | - | +| USE_EXS_DIMMER | - | x / - | x | - | - | - | +| USE_DEVICE_GROUPS | - | x / x | - | - | - | - | +| USE_PWM_DIMMER | - | x / - | x | - | - | - | +| USE_KEELOQ | - | - / - | - | - | - | - | +| USE_SONOFF_D1 | - | x / - | x | - | - | - | +| USE_SHELLY_DIMMER | - | x / - | - | - | - | - | +| USE_AC_ZERO_CROSS_DIMMER | - | x / x | x | x | x | x | +| | | | | | | | +| Feature or Sensor | l | t | k | s | i | d | Remarks +| USE_LIGHT | x | x / x | x | x | x | x | +| USE_WS2812 | - | x / x | x | x | - | x | +| USE_WS2812_DMA | - | - / - | - | - | - | - | +| USE_MY92X1 | - | x / - | x | x | - | x | +| USE_SM16716 | - | x / - | x | x | - | x | +| USE_SM2135 | - | x / - | x | x | - | x | +| USE_SM2335 | - | x / - | x | x | - | x | +| USE_BP5758D | - | x / - | x | x | - | x | +| USE_SONOFF_L1 | - | x / - | x | x | - | x | +| USE_ELECTRIQ_MOODL | - | x / - | x | x | - | x | +| | | | | | | | +| USE_ENERGY_SENSOR | x | x / x | x | x | - | - | +| USE_ENERGY_DUMMY | x | x / x | x | x | - | - | +| USE_PZEM004T | - | x / x | x | x | - | - | +| USE_PZEM_AC | - | x / x | x | x | - | - | +| USE_PZEM_DC | - | x / x | x | x | - | - | +| USE_MCP39F501 | x | x / - | x | x | - | - | +| USE_SDM72 | - | - / x | - | x | - | - | +| USE_SDM120 | - | - / x | - | x | - | - | +| USE_SDM230 | - | - / x | - | - | - | - | +| USE_SDM630 | - | - / x | - | x | - | - | +| USE_DDS2382 | - | - / x | - | x | - | - | +| USE_DDSU666 | - | - / x | - | x | - | - | +| USE_SOLAX_X1 | - | - / - | - | - | - | - | +| USE_LE01MR | - | - / - | - | - | - | - | +| USE_BL09XX | x | x / x | x | x | - | - | +| USE_TELEINFO | - | - / - | - | - | - | - | +| USE_IEM3000 | - | - / - | - | - | - | - | +| USE_WE517 | - | - / - | - | - | - | - | +| | | | | | | | +| USE_ADC_VCC | x | - / - | - | - | x | - | +| USE_COUNTER | - | x / x | x | x | - | x | +| USE_DS18x20 | - | x / x | x | x | - | x | +| USE_DHT | - | x / x | x | x | - | x | +| USE_MAX31855 | - | - / x | - | x | - | - | +| USE_MAX31865 | - | - / - | - | - | - | - | +| USE_THERMOSTAT | - | - / - | - | - | - | - | +| USE_LMT01 | - | - / x | - | x | - | - | +| | | | | | | | +| Feature or Sensor | l | t | k | s | i | d | Remarks +| USE_I2C | - | x / x | x | x | - | x | +| USE_SHT | - | - / x | - | x | - | - | +| USE_HTU | - | - / x | - | x | - | - | +| USE_BMP | - | - / x | - | x | - | - | +| USE_BME68X | - | - / x | - | x | - | - | +| USE_BH1750 | - | - / x | - | x | - | - | +| USE_VEML6070 | - | - / x | - | x | - | - | +| USE_ADS1115 | - | - / x | - | x | - | - | +| USE_INA219 | - | - / x | - | x | - | - | +| USE_INA226 | - | - / - | - | - | - | - | +| USE_SHT3X | - | - / x | - | x | - | - | +| USE_TSL2561 | - | - / - | - | - | - | - | +| USE_TSL2591 | - | - / - | - | - | - | - | +| USE_MGS | - | - / x | - | x | - | - | +| USE_SGP30 | - | - / x | - | x | - | - | +| USE_SGP40 | - | - / x | - | x | - | - | +| USE_SI1145 | - | - / - | - | - | - | - | +| USE_LM75AD | - | - / x | - | x | - | - | +| USE_APDS9960 | - | - / - | - | - | - | - | +| USE_MCP230xx | - | - / - | - | - | - | - | +| USE_PCA9685 | - | - / - | - | - | - | - | +| USE_MPR121 | - | - / - | - | - | - | - | +| USE_CCS811 | - | - / - | - | x | - | - | +| USE_CCS811_V2 | - | - / x | - | - | - | - | +| USE_MPU6050 | - | - / - | - | - | - | - | +| USE_DS3231 | - | - / - | - | - | - | - | +| USE_MGC3130 | - | - / - | - | - | - | - | +| USE_MAX44009 | - | - / - | - | - | - | - | +| USE_SCD30 | - | - / x | - | x | - | - | +| USE_SCD40 | - | - / x | - | - | - | - | +| USE_SPS30 | - | - / - | - | - | - | - | +| USE_ADE7880 | - | - / - | - | - | - | - | +| USE_ADE7953 | - | x / x | x | x | - | x | +| USE_VL53L0X | - | - / x | - | x | - | - | +| USE_VL53L1X | - | - / - | - | - | - | - | +| USE_MLX90614 | - | - / - | - | - | - | - | +| USE_CHIRP | - | - / - | - | - | - | - | +| USE_PAJ7620 | - | - / - | - | - | - | - | +| USE_PCF8574 | - | - / - | - | - | - | - | +| | | | | | | | +| Feature or Sensor | l | t | k | s | i | d | Remarks +| USE_HIH6 | - | - / x | - | x | - | - | +| USE_DHT12 | - | - / x | - | x | - | - | +| USE_DS1624 | - | - / x | - | x | - | - | +| USE_AHT1x | - | - / - | - | - | - | - | +| USE_HDC1080 | - | - / - | - | - | - | - | +| USE_WEMOS_MOTOR_V1 | - | - / x | - | x | - | - | +| USE_IAQ | - | - / x | - | x | - | - | +| USE_AS3935 | - | - / x | - | x | - | - | +| USE_VEML6075 | - | - / - | - | - | - | - | +| USE_VEML7700 | - | - / - | - | - | - | - | +| USE_MCP9808 | - | - / - | - | - | - | - | +| USE_MLX90640 | - | - / - | - | - | - | - | +| USE_HP303B | - | - / - | - | - | - | - | +| USE_EZOCO2 | - | - / - | - | - | - | - | +| USE_EZODO | - | - / - | - | - | - | - | +| USE_EZOEC | - | - / - | - | - | - | - | +| USE_EZOFLO | - | - / - | - | - | - | - | +| USE_EZOHUM | - | - / - | - | - | - | - | +| USE_EZOO2 | - | - / - | - | - | - | - | +| USE_EZOORP | - | - / - | - | - | - | - | +| USE_EZOPH | - | - / - | - | - | - | - | +| USE_EZOPMP | - | - / - | - | - | - | - | +| USE_EZOPRS | - | - / - | - | - | - | - | +| USE_EZORGB | - | - / - | - | - | - | - | +| USE_EZORTD | - | - / - | - | - | - | - | +| USE_SEESAW_SOIL | - | - / - | - | - | - | - | +| USE_TOF10120 | - | - / - | - | - | - | - | +| USE_BM8563 | - | - / - | - | - | - | - | +| USE_AM2320 | - | - / - | - | - | - | - | | USE_T67XX | - | - / - | - | - | - | - | | USE_HM330X | - | - / - | - | - | - | - | | USE_HDC2010 | - | - / - | - | - | - | - | | USE_PCF85363 | - | - / - | - | - | - | - | | USE_DS3502 | - | - / - | - | - | - | - | | USE_HYT | - | - / - | - | - | - | - | +| USE_LUXV30B | - | - / - | - | - | - | - | | | | | | | | | | Feature or Sensor | l | t | k | s | i | d | Remarks | USE_SPI | - | - / - | - | - | - | x | diff --git a/CHANGELOG.md b/CHANGELOG.md index ae972b3c4..b18d77223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - Flowrate meter flow amount/duration, show values in table format (#16385) - Zigbee prepare for Green Power support (#16407) - Command ``SetOption146 1`` to enable display of ESP32 internal temperature +- Support for DFRobot SEN0390 V30B ambient light sensor (#16105) ### Changed - TasmotaModbus library from v3.5.0 to v3.6.0 (#16351) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index efcc3a1c2..a578efce2 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -113,6 +113,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - Command ``StatusRetain`` [#11109](https://github.com/arendst/Tasmota/issues/11109) - Support for SGP40 gas and air quality sensor [#16341](https://github.com/arendst/Tasmota/issues/16341) - Support for Modbus writing using ModbusBridge by JeroenSt [#16351](https://github.com/arendst/Tasmota/issues/16351) +- Support for DFRobot SEN0390 V30B ambient light sensor [#16105](https://github.com/arendst/Tasmota/issues/16105) - Zigbee device plugin mechanism with commands ``ZbLoad``, ``ZbUnload`` and ``ZbLoadDump`` [#16252](https://github.com/arendst/Tasmota/issues/16252) - Zigbee prepare for Green Power support [#16407](https://github.com/arendst/Tasmota/issues/16407) - Flowrate meter flow amount/duration, show values in table format [#16385](https://github.com/arendst/Tasmota/issues/16385) diff --git a/tasmota/include/tasmota_configurations.h b/tasmota/include/tasmota_configurations.h index 5da4fddb7..5fbf62f63 100644 --- a/tasmota/include/tasmota_configurations.h +++ b/tasmota/include/tasmota_configurations.h @@ -153,6 +153,7 @@ //#define USE_HDC2010 // [I2cDriver64] Enable HDC2010 temperature/humidity sensor (I2C address 0x40) (+1k5 code) //#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code) //#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code) +//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code) //#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one // #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code) diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index 4544f7da6..34db4eff8 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -410,6 +410,7 @@ //#define USE_T67XX // [I2cDriver61] Enable Telaire T67XX CO2 sensor (I2C address 0x15) (+1k3 code) //#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code) //#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code) +//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code) //#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one // #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code) @@ -617,6 +618,7 @@ //#define USE_SEESAW_SOIL // [I2cDriver56] Enable Capacitice Soil Moisture & Temperature Sensor (I2C addresses 0x36 - 0x39) (+1k3 code) //#define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code) //#define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code) +//#define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code) //#define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one // #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index e29a81bc7..90fbf28a3 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -681,6 +681,7 @@ // #define USE_HDC2010 // [I2cDriver64] Enable HDC2010 temperature/humidity sensor (I2C address 0x40) (+1k5 code) // #define USE_DS3502 // [I2CDriver67] Enable DS3502 digital potentiometer (I2C address 0x28 - 0x2B) (+0k4 code) // #define USE_HYT // [I2CDriver68] Enable HYTxxx temperature and humidity sensor (I2C address 0x28) (+0k5 code) +// #define USE_LUXV30B // [I2CDriver70] Enable RFRobot SEN0390 LuxV30b ambient light sensor (I2C address 0x4A) (+0k5 code) // #define USE_RTC_CHIPS // Enable RTC chip support and NTP server - Select only one // #define USE_DS3231 // [I2cDriver26] Enable DS3231 RTC (I2C address 0x68) (+1k2 code) diff --git a/tasmota/tasmota_support/support_features.ino b/tasmota/tasmota_support/support_features.ino index 5341e07f3..73ecc03d7 100644 --- a/tasmota/tasmota_support/support_features.ino +++ b/tasmota/tasmota_support/support_features.ino @@ -828,7 +828,9 @@ void ResponseAppendFeatures(void) #if defined(USE_I2C) && defined(USE_SGP40) feature9 |= 0x00000001; // xsns_98_sgp40.ino #endif -// feature9 |= 0x00000002; +#if defined(USE_I2C) && defined(USE_LUXV30B) + feature9 |= 0x00000002; +#endif // feature9 |= 0x00000004; // feature9 |= 0x00000008; diff --git a/tasmota/tasmota_xsns_sensor/xsns_99_luxv30b.ino b/tasmota/tasmota_xsns_sensor/xsns_99_luxv30b.ino new file mode 100644 index 000000000..b833a5c07 --- /dev/null +++ b/tasmota/tasmota_xsns_sensor/xsns_99_luxv30b.ino @@ -0,0 +1,212 @@ +/* + xsns_99_luxv30b.ino - Driver for DFRobot V30B lux sensor + + Copyright (C) 2022 Marius Bezuidenhout + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#ifdef USE_I2C +#ifdef USE_LUXV30B +/************************************************************************************************** + * DFRobot SEN0390 V30B ambient light sensor + * + * https://wiki.dfrobot.com/Ambient_Light_Sensor_0_200klx_SKU_SEN0390 + * https://github.com/DFRobot/DFRobot_B_LUX_V30B/ + * + * I2C Address: 0x4A + * ================================================================================================ + * This driver use the I2C mode. Uses address 0x94 and 0x95. Its address cannot be changed. + * + * Supply Voltage: 2.7-6V + * Operating Current: 0.7mA + * Detection Range: 0-200klx + * Accuracy: 0.054lx + * Operating Temperature Range: -40°C~+85°C + * I2C Address: 0x4A + * + * Pin assignments: + * + * ------------------------------------------ + * | Num | Label | Description | + * 1 VCC 2.7-6V + + * 2 SCL I2C Serial Clock Line + * 3 SDA I2C Serial Data + * 4 GND Ground + * 5 EN Sensor Chip-select Enable/Disable port, High to enable, Low to disable sensor + * + * + * You can write the desired configuration to the configuration register(address:0x04), setting + * different acquisition accuracy. + * You can read the light intensity data from the data register(address:0x00~0x03). + * ------------------------------------------------------------------------------------------ + * | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | + * ------------------------------------------------------------------------------------------ + * | 0 | MANUAL | 0 | 0 | CDR | TIM | + * ------------------------------------------------------------------------------------------ + * MANUAL :Manual configuration register. + * 0 represents the default automatic mode.In this mode ,CDR and TIM are automatically assigned. + * 1 represents the configuration of manual mode.In this mode,CDR and TIM can be set by the user. + * CDR :Shunt ratio register. + * 0 represents the default of not dividing,all the current of the photodiode into the ADC + * 1 represents the division of 8,as long as 1/8 of the current of the photodiode changes to ADC. + * This mode is used in high brightness situations. + * TIM[2:0]:Acquisition time. + * ------------------------------------------------------------------------------------------------ + * TIM[2:0] | TIME(ms) | Introduction | + * ------------------------------------------------------------------------------------------------ + * 000 | 800 | Preferred mode in low light environment | + * ------------------------------------------------------------------------------------------------ + * 001 | 400 | --- | + * ------------------------------------------------------------------------------------------------ + * 010 | 200 | --- | + * ------------------------------------------------------------------------------------------------ + * 011 | 100 | In the strong light environment, select the mode preferentially | + * ------------------------------------------------------------------------------------------------ + * 100 | 50 | Manual mode only | + * ------------------------------------------------------------------------------------------------ + * 101 | 250 | Manual mode only | + * ------------------------------------------------------------------------------------------------ + * 110 | 12.5 | Manual mode only | + * ------------------------------------------------------------------------------------------------ + * 111 | 6.25 | Manual mode only | + * ------------------------------------------------------------------------------------------------ + * Accuracy that can be set in manual mode: + * ------------------------------------------------------------------------------------------------------------- + * | Light conditions | | TIM & CDR | + * ------------------------------------------------------------------------------------------------------------- + * | Minimum accuracy | Maximum accuracy | Maximum | Acquisition time(ms) | TIM | CDR | + * —------------------------------------------------------------------------------------------------------------ + * 0.054 11.52 2938 800 000 0 + * 0.09 23.04 5875 400 001 0 + * 0.18 46.08 11750 200 010 0 + * 0.36 92.16 23501 100 011 0 + * 0.36 92.16 23501 800 000 1 + * 0.72 184.32 47002 50 100 0 + * 0.72 184.32 47002 400 001 1 + * 1.44 368.64 94003 25 101 0 + * 1.44 368.64 94003 200 010 1 + * 2.88 737.28 200000 12.5 110 0 + * 2.88 737.28 200000 100 011 1 + * 5.76 737.28 200000 6.25 111 0 + * 5.76 737.28 200000 50 100 1 + * 11.52 737.28 200000 25 101 1 + * 23.04 737.28 200000 12.5 110 1 + * 46.08 737.28 200000 6.25 111 1 + * —------------------------------------------------------------------------------------------------------------ + * *************************************************************************************************/ + +#define XSNS_99 99 +#define XI2C_70 70 // See I2CDEVICES.md + +#define LUXV30B_ADDR 0x4A // Two wire library uses 7-bit addresses throughout +#define LUXV30B_DATAREG 0x00 // Address of the data register +#define LUXV30B_CONFREG 0x04 // Address of the configuration register + +class LuxV30b { + public: + LuxV30b(); + void Detect(); + bool Found(); + void Read(); + void Show(uint8_t function); + private: + float Lux(); + bool _found; + uint32_t _lux; +}; + +LuxV30b::LuxV30b() { + _found = false; + _lux = 0; +} + +void LuxV30b::Detect() { + if (!I2cSetDevice(LUXV30B_ADDR)) { return; } + + _found = true; + I2cSetActiveFound(LUXV30B_ADDR, "LUXV30B"); +} + +bool LuxV30b::Found() { + return _found; +} + +void LuxV30b::Read() { + _lux = I2cRead8(LUXV30B_ADDR, 0); + delay(8); + _lux |= I2cRead8(LUXV30B_ADDR, 1) << 8; + delay(8); + _lux |= I2cRead8(LUXV30B_ADDR, 2) << 16; + delay(8); + _lux |= I2cRead8(LUXV30B_ADDR, 3) << 24; +} + +float LuxV30b::Lux() { + return ((float)_lux * 1.4) / 1000; +} + +void LuxV30b::Show(uint8_t function) { +// if (0 < Lux()) { + if (_lux) { + char lux[FLOATSZ]; + dtostrfd(Lux(), 2, lux); + if (FUNC_JSON_APPEND == function) { + ResponseAppend_P(PSTR(",\"LUXV30B\":{\"" D_JSON_ILLUMINANCE "\":%s}"), lux); +#ifdef USE_DOMOTICZ +// Instead of below code use a rule like 'on tele-luxv30b#illuminance do dzsend1 9988,%value% endon' +// where 9988 is the domoticz sensor Idx +// if (0 == TasmotaGlobal.tele_period) { DomoticzSensor(DZ_ILLUMINANCE, lux); } +#endif // USE_DOMOTICZ +#ifdef USE_WEBSERVER + } else { + WSContentSend_PD(PSTR("{s}LUXV30B " D_ILLUMINANCE "{m}%s " D_UNIT_LUX "{e}"), lux); +#endif // USE_WEBSERVER + } + } +} + +LuxV30b Luxv30b; + +/*********************************************************************************************\ + * Interface +\*********************************************************************************************/ + +bool Xsns99(uint8_t function) { + if (!I2cEnabled(XI2C_70)) { return false; } + + bool result = false; + + if (FUNC_INIT == function) { + Luxv30b.Detect(); + } + else if (Luxv30b.Found()) { + switch (function) { + case FUNC_EVERY_SECOND: + Luxv30b.Read(); + break; + case FUNC_JSON_APPEND: +#ifdef USE_WEBSERVER + case FUNC_WEB_SENSOR: +#endif // USE_WEBSERVER + Luxv30b.Show(function); + break; + } + } + return result; +} + +#endif // USE_LUXV30B +#endif // USE_I2C \ No newline at end of file diff --git a/tools/decode-status.py b/tools/decode-status.py index 92de04297..465bd4712 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -285,7 +285,7 @@ a_features = [[ "USE_PCF85363","USE_DS3502","USE_IMPROV","USE_FLOWRATEMETER", "USE_BP5758D","USE_HYT","USE_SM2335","USE_DISPLAY_TM1621_SONOFF" ],[ - "USE_SGP40","","","", + "USE_SGP40","USE_LUXV30B","","", "","","","", "","","","", "","","","",