Luminescence sensor

I would like a luminescence sensor whose output is lux, or something similar, to quantify the light level by the kitchen sink. I would like this sensor to be DC-powered, have Wifi output, and hopefully have some sample code showing how to integrate it with HA. I have done some on-line searching, but have not found anything useful. Please direct me – thanks!

You should look into a esphome with lux sensor

I use this and it works great.

3 Likes

I’ll be doing a write up of a BH1750 ESPHome Lux sensor next month when parts arrive. It’s pretty simple.

Thanks. I found this, but:

  • The picture above does not match the one on the AdaFruit website
  • I don’t see any mention of WiFi - am I missing something?
  • No idea what “The I²C bus is required to be set up in your configuration” means. Is this hardware, software, or a combination of the two?

Tom_l - I look forward to your write-up

Lots of people make breakout boards for the BH1750. They all have the same connections though. For example I’m going to use this one:

https://www.aliexpress.com/item/1005001636541540.html

The ESPHome project uses ESP32 or ESP8266 processor boards that have built in wifi. This is a component you have to set up in ESPHome:

There are some good recommendations for which ESP32 boards to order here: https://community.home-assistant.io/t/whats-your-favourite-esp32-board-best-good-cheap-quality-reliable/380023/

It’s a communications protocol the sensor uses to talk to the ESP board. So you have to set up that component too. See:

Okay - a bunch of reading to do. In a nutshell, I think you are saying to a) buy a BH1750 sensor, b) buy a EPS32 board, c) connect the sensor to the board using the I²C bus, and d) configure the device in HA. About correct?

Yep. And step (d) is very simple due to discovery.

I’m surprised there aren’t more off-the-shelf cheap battery operated sensors for lux.

Some of the Xiaomi/Aqara motion sensors “almost” do it…

I saw this one pop up a while back and thought it was filling a decent market gap, but it looks like it may have been discontinued.

I find I often want lux sensors located where wired power isn’t that practical.

I think a BLE solution which could be bridged by ESPHome would be nice.

[AU$17.11 53% OFF]Xiaomi Mijia 0~83000 lux Zigbee 3.0 Smart Home Light Sensor Monitor Alarm Work with Xiaomi Multimode ZigBee 3.0 Gateway Smart Home from Consumer Electronics on banggood

I even got one of these a while back to tinker with, but didn’t get too far.

AU $20.40 15%OFF | NRF51802 Bluetooth 4.0 BLE SOC Temperature Atmospheric Pressure Acceleration Sensor Module Gyroscope Light Sensor MPU6050 AP3216

As a battery powered device the Xiaomi sensor may not update update fast enough for continuous lighting control, but it is supposed to be a good sensor from what I’ve heard.

By “Continuous” I mean LUX → some equation → brightness level for lights. Not just a night / day set point. It would be fine for that.

1 Like

If you go down the ESPHOME route (which is a very good option), the other thing you should ask yourself is “what other sensors should I tack on to the esp while I’m doing this?”.

Marginal cost/effort of throwing on temp, humidity, motion, proximity, buttons, you-name-it is quite small…

Maybe add some ble presence detection.

The world is your oyster;)

Search for “ESPHOME multisensor” or similar…

1 Like

Hate to admit this, but I need some more hand-holding… I now have both a BH1750 and a HiLetgo NodeMCU. Connecting to each other seems simple, see ESP8266 NodeMCU with BH1750 Ambient Light Sensor | Random Nerd Tutorials. However, I am not sure what I need to do to the NodeMCU so that it can be detected by my current HA system as a device. Please point to to the appropriate write-up, thanks!

My parts have arrived in the country so unless customs drag their feet I should be writing this up next weekend.

1 Like

Did you ever get around to the write-up?

Have not yet done a write because the project is not yet done. I got the thing working with AC power, but ran into a challenge with the battery I ordered. I suspect it is simply a connectivity issue and I need to get back to it.

Parts List

ESPHome YAML code:

esphome:
  name: ambientlight
  platform: ESP8266
  board: d1_mini
  
wifi:
  networks:
  - ssid: !secret
    password: !secret
  power_save_mode: NONE
  reboot_timeout: 5min
  
i2c:
  sda: D2
  scl: D1
  scan: True
  
sensor:
  - platform: bh1750
    name: "BH1750 luminance"
    address: 0x23
    update_interval: 30s
    accuracy_decimals: 0
    
logger:
  level: INFO
  
api:
  password: !secret
  reboot_timeout: 5min
  port: 6053
  
ota:
  password: !secret

1 Like
2 Likes