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.
Drafted with AI assistance, fact-checked and approved by RackedPrice.
- Plug the VEML7700 light sensor into your Pi, near a window.
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-qwiicSend the light level to Home Assistant over MQTT.
Use the script from the room sensor how-to. Send
illuminancewith the unitlxand the device classilluminance.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.
Ready for a bigger build?
Our project guides walk through a whole build, with a parts list priced by our tracker.
What you'll need
- Ambient light sensor VEML7700 (Qwiic)Check price at SparkFun
- Qwiic Cable KitCheck price at SparkFun
SparkFun doesn't share prices with us, so check the price on its page.
More make and tinker how-tos
Set up your first Raspberry Pi
A tiny computer for learning, projects and small home servers.
30 minutesPlug sensors into a Pi (no soldering)
SparkFun's Qwiic cables click in one way only. No soldering, no wiring mistakes.
20 minutesMake a room temperature sensor
See a room's temperature and humidity in Home Assistant, from a sensor you put together.
1 hour