Light control daemon

Let's review another example where we implement a simple daemon using OOP that turns on/off lights at specified times of the day. In order to be able to perform tasks at scheduled times, we will make use of the schedule library ( It could be installed as follows:

    sudo pip3 install schedule

Let's call our class, LightScheduler. It should be capable of accepting start and top times to turn on/off lights at given times. It should also provide override capabilities to let the user turn on/off lights as necessary. Let's assume that the light is controlled using PowerSwitch Tail II ( It is interfaced as follows:

Raspberry Pi Zero interfaced ...

Get Python Programming with Raspberry Pi now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.