Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSL2591 Ambient Light Sensor Auto Gain Mode Reporting #4031

Closed
0x90ChuckTessela opened this issue Jan 12, 2023 · 1 comment · Fixed by esphome/esphome#4291
Closed

TSL2591 Ambient Light Sensor Auto Gain Mode Reporting #4031

0x90ChuckTessela opened this issue Jan 12, 2023 · 1 comment · Fixed by esphome/esphome#4291

Comments

@0x90ChuckTessela
Copy link

0x90ChuckTessela commented Jan 12, 2023

The problem

The TSL2591 Ambient Light Sensor component (https://esphome.io/components/sensor/tsl2591.html) does not currently expose its actual gain value when in "auto" gain mode.

When in "auto" gain mode, it properly adjusts the gain value and reports relative values across full spectrum, infrared, visible, and an estimated/calculated lux. However, it does not provide any indication via sensor value publishing of the actual gain used for those readings. When transitioning between extremes (very dark, to very bright or vice-versa) the auto gain mode appears to function correctly; however, without a "gain" readout for what is being used to determine the raw values/lux, it can create a misleading situation where low and high light values spanning an auto adjustment may be perceived as inverted.

This can lead to incorrect conclusions for automation and users where a room may be perceived as darker than before even though it is now brighter (or vice versa).

I believe the correct route would be to publish the actual gain value being used when in "auto" mode, as well as other modes, probably as a numeric value (e.g. 1x, 25x, 400x, 9500x). This seems like it might be a feature request, but I can also see the case for filing it as a bug since it provides values that are potentially misleading relative to one another.

Which version of ESPHome has the issue?

2022.12.3

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.1.2

What platform are you using?

ESP32

Board

No response

Component causing the issue

tsl2591

Example YAML snippet

sensor:
  - platform: tsl2591
    name: "${node_name} Light Sensor"
    id: "${node_id}_Light_Sensor"
    address: 0x29
    update_interval: 1s
    device_factor: 53
    gain: auto
    glass_attenuation_factor: 14.4
    integration_time: 500ms
    visible:
      name: "${node_name} TSL2591 Visible Light"
      id: "${node_id}_Visible_Light"
    infrared:
      name: "${node_name} TSL2591 Infrared Light"
      id: "${node_id}_Infrared_Light"
    full_spectrum:
      name: "${node_name} TSL2591 Full Spectrum Light"
      id: "${node_id}_Full_Spectrum_Light"
    calculated_lux:
      name: "${node_name} TSL2591 Lux"
      id: "${node_id}_i_lux"

Anything in the logs that might be useful for us?

No response

Additional information

The issue appears to be consistent across any version supporting the component. It appears, based on esphome/feature-requests#267 that this is a hold-over from the addition of "auto" mode.

@0x90ChuckTessela 0x90ChuckTessela changed the title TSL2591 Ambient Light Sensor TSL2591 Ambient Light Sensor Auto Gain Mode Reporting Jan 12, 2023
@z3liff
Copy link

z3liff commented Jan 13, 2023

I'll go ahead and make a PR for this

jesserockz pushed a commit to esphome/esphome that referenced this issue Jan 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants