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 (https://github.com/dbader/schedule). 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 (http://www.powerswitchtail.com/Pages/default.aspx). It is interfaced as follows:

Raspberry Pi Zero interfaced ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.