February 2022
Intermediate to advanced
182 pages
4h 25m
English
With the smart bulb and light and motion sensor programmatically confirmed working, we can combine these together to turn the light on in low-light situations whenever motion is detected.
We’ll alter the Hue smart plug code from the previous Hue project and swap out the temperature code with our motion test code. But unlike the Hue Fan project, we shouldn’t immediately turn off the light when motion is no longer detected; otherwise our light will just flicker on briefly and turn off seconds later.
We’ll do so in our script by keeping the light on for five minutes. And we’ll only turn on the smart bulb when there isn’t already enough light illuminating the room:
| | from phue import Bridge |
| |
Read now
Unlock full access