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
Support to measure more than 54612 Lux with the BH1750 #148
Comments
Actually the source code already exists and is licensed under LGPL Code can be found here: https://github.com/hexenmeister/AS_BH1750 It does also include a 'auto power down' beside supporting the measurement range from 0,11 to 100.000 lux. |
Hey @OttoWinter sorry to interrupt but as I'm seeing you getting ready for the 1.14 release I wonder how hard this one here is to implement. I'm driving my whole water and water-heating (solar) system with esphome and I'm just hardly lacking the feature to measure the radiated lux on the solar panel. The sensor is already in place but maxes out on 54612 lux. |
It would actually be the opposite - shorter measurement times allow for a higher range. |
Could their be something tested with the new code already @OttoWinter ? I have a couple of esp's with bh1750 including one towards the sky and would be happy to contribute with testing. esphome-dev is setup and ready but I don't know if I need to add any setting to the bh1750 component in the yaml to get shorter measurement times for higher range or if it is done automatically? |
You can test it by downloading this folder and placing the files under |
I did compile esphome 1.14.2 with the bh1750 custom component included and flashed it via ota (patching the running 1.13.6) Still it maxes out at 54612.5. I didn't see in the compiling logs that the custom component was used but as a folder Now with the sensor in sun (partly cloudy today) the limit is better visible: My yaml part: sensor:
- platform: bh1750
name: "${upper_devicename} Panel Brightness"
address: 0x23 |
Ah sorry, forgot to mention: you need to supply the new measurement_time via config - the default is still the old one. sensor:
- platform: bh1750
name: "${upper_devicename} Panel Brightness"
address: 0x23
# min: 31, default: 69, max: 254
measurement_time: 31 |
Confirmed working @OttoWinter ! Is their any fixed upper/lower limit when having the Thank's so much! This is a great improvement for this component! 🎉 |
The max value for |
Updated docs: esphome/esphome-docs#440 |
will this go into the normal release? |
It need's to @martin3000! But first the pull request #997 needs to be fixed to pass the tests. |
@rradar how do these automated tests work? |
@martin3000 travis does all the work: He also says what to change to pass the test. In this case it's easy and some spaces in the right place should make the tests pass in the next run: |
* BH1750 Measurement time Fixes esphome/feature-requests#148 * lint * add test Co-authored-by: Otto Winter <otto@otto-winter.com> Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
* BH1750 Measurement time Fixes esphome/feature-requests#148 * lint * add test Co-authored-by: Otto Winter <otto@otto-winter.com> Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
* BH1750 Measurement time Fixes esphome/feature-requests#148 * lint * add test Co-authored-by: Otto Winter <otto@otto-winter.com> Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
* BH1750 Measurement time Fixes esphome/feature-requests#148 * lint * add test Co-authored-by: Otto Winter <otto@otto-winter.com> Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
* BH1750 Measurement time Fixes esphome/feature-requests#148 * lint * add test Co-authored-by: Otto Winter <otto@otto-winter.com> Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
Describe the problem you have/What new integration you would like
The esphome integration of the BH1750 Lux Sensor only allows to measure a maximum of 54612 Lux (in my tests). There is a possability (software wise) to measure more than 100000 Lux with this sensor at the costs of Measurement Time (MTreg) which can go up to a maximum of around 500 ms in this case (which is not bad at all!).
Please describe your use case for this integration and alternatives you've tried:
Like to measure outside with sun 🌞 which easily exceeds 54612 Lux
Additional context
There is a library and a little bit of context on this (German only) website:
http://s6z.de/cms/index.php/homeautomation-homecontrol/infrastruktur/aktorensensoren/offene-standard-systeme/i-c/15-umgebungslichtsensor-bh1750
The text was updated successfully, but these errors were encountered: