RackedPrice

Disclosure: We earn a commission from some links on this page. Details

Turn lights on when the room gets dark

Sunset times don't know about cloudy days. A light sensor does.

Make and tinker1 hourEasy

Drafted with AI assistance, fact-checked and approved by RackedPrice.

  1. Plug the VEML7700 light sensor into your Pi, near a window.
  2. Install SparkFun's library for it and run the example.

    The hookup guide linked from the sensor's page has the install line. This one installs all of SparkFun's Qwiic Python libraries, if you'd rather not hunt.

    ~/sensors/bin/pip install sparkfun-qwiic
  3. Send the light level to Home Assistant over MQTT.

    Use the script from the room sensor how-to. Send illuminance with the unit lx and the device class illuminance.

  4. Make an automation that turns a lamp on when it drops below a level you pick.

    Trigger: Numeric state, your light sensor, below the level. Watch the reading for a few evenings first to find a good number.

Build guide

Ready for a bigger build?

Our project guides walk through a whole build, with a parts list priced by our tracker.

See the projects

Shopping (optional)

What you'll need

SparkFun doesn't share prices with us, so check the price on its page.

More make and tinker how-tos