Lux measurement with sonoff basic?

Is it possible to connect a light sensor to a sonoff basic?
To measure lux and switch lights if it gets dark?
Cant find a good solution!

1 Like

Iā€™m using the BH1750 (Link anchor doesnā€™t work, scroll down a bit) sensor.

Hereā€™s my config on Sonoff Basic


You need only SCL and SDA.

So you only connect two wires at the sonoff?
Does it send the lux with the sonoff mqqt?
Do you have picture of your setup?

The sensor needs 3.3V, ground and the 2 wires for the i2c bus. = 4 wires

Yes

No, not at the moment. But i used the RX/TX pins for SCL/SDA

Nice i will order one to test!

So tx is scl and Rx is Sda?

Does it send lux levels continue? Or in few minutes?

Not sure, i have to open the device in the evening.
But itā€™s no problem to change them, nothing getā€™s broken if they are wrong.

That depends on the TelePeriod Parameter on the Sonoff.
Minimal is 10 seconds, i think.

Good enough to turn on light when gets dark.
I ordered it today so tomorrow i can test it.
Hope works good!

Hereā€™s an issue, but also some good instruction about it.

I connected it and the lux level show in the sonoff menu.
How do i get the lux value in home assistant?
I thought it appears automaticly

You need a sensor.

sensor:
  - platform: mqtt
    name: "Sonoff01 Light"
    state_topic: "tele/sonoff01/SENSOR"
    value_template: "{{ value_json['BH1750'].Illuminance }}"
    unit_of_measurement: "lx"

The state_topic ā€˜tele/xxxxxx/SENSORā€™ depends on what you have configured in mqtt on the sonoff.

1 Like

It worked!
Changed the TelePeriod to lower value and now it shows the actual lux!
thanx for your help!

1 Like

Hi there,

This one doesnā€™t work for me for whatever reason.
I have this config:

  - platform: mqtt
   name: D1mini illuminance
   state_topic: ā€œtele/D1mini_illuminance/SENSORā€
   value_template: ā€œ{{ value_json[ 'BH1750' ].Illuminance }}ā€
   unit_of_measurement: "lx"

I run hass v0.88.0

Noob question! :slight_smile:

Will this work, if i connect the sensor to my sonoff as described, without changing to tasmota firmware?

As it is now, all my sonoff devices run via ewelink with standard firmware, i have different versions (with power sensors, temperature sensors, etc.), and my Hassio setup automatically detect the devices and their sensors, as soon as they have been added to Ewelink.

I know this might be a somewhat stupid presumption, but i know next to nothing about fiddling with this stuffā€¦ My thought is that the current firmware might recognize the sensor or maybe the sensor sends understandable data to the sonoff deviceā€¦

I donā€™t think so.
Or is it possible to configure pins, i2c, ā€¦ in Ewelink?

No, there are no options for configuration at all in Ewelink.

Will update to Tasmota instead! :slight_smile:

remember to get the ā€œtasmota-sensors.binā€ file, as this will not work with regular versions, or at least not the ones i tried at firstā€¦ :wink: