(a) Once you create an Observer
, its date
stays fixed until you reach in manually and change it. So the home.date
you keep checking against sunrise
will never change and thus never actually reach sunrise. You might want to call the PyEphem now()
routine instead, so that your idea of the current time can progress.
(b) You are correct that it is extremely unlikely that you will happen to do your ==
comparison at exactly the millisecond of sunrise so you probably want to compare using an inequality instead.
(c) Until sunrise arrives, your loop would appear to drive the CPU at 100% checking thousands of times a second whether sunrise has arrived yet. You might want to time.sleep(1)
while waiting to keep your Raspberry Pi cooler.