Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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?

In reply to Re: Efficiency of indoor grow light timer by Marshall
in thread Efficiency of indoor grow light timer by stevieb

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2019-07-23 00:39 GMT
    Find Nodes?
      Voting Booth?
      If you were the first to set foot on the Moon, what would be your epigram?

      Results (22 votes). Check out past polls.