Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Efficiency of indoor grow light timer

by Marshall (Abbot)
on Nov 14, 2017 at 09:05 UTC ( #1203340=note: print w/replies, xml ) Need Help??

in reply to Efficiency of indoor grow light timer

Hi stevieb!
I do figure that you are way over-thinking this.

To handle power-failure restarts, put a call to turn_off_lights(); in the Pi boot routine.

Schedule a chron job to run this code every 10,20 minutes, or even every hour.
Even if the Pi doesn't acquire the correct time, this should prevent the problem of the lights being on too long for multiple days.

#!/usr/bin/perl use strict; use warnings; # time off: 1800 - 0600 6PM to 6AM my $hour = (localtime(time))[2]; if ($hour >= 06 and $hour <= 18) { turn_on_lights(); #day time } else #18:01 to 05:59 avoids the hour 00 discontinuity { turn_off_lights(); #night time }
I think I had the wrong sense between day and night time before. Oops.
Here is one link to ChronTab.

I have a Raspberry PI 3. What version do you have?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1203340]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2020-08-05 01:13 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (35 votes). Check out past polls.