scheduler issue with sunset,sunrise,dark etc

Issue #6 new
Stephen Burning repo owner created an issue

It runs fine the first time,but when it goes to reschedule the event for the next one it ends up scheduling it for the same time due to the calculation returning the current time for the next event trigger. Need to figure out how to get it to bump to the next day when looking for an event based schedule.

Comments (11)

  1. tom enos

    I think I know why, I'm still trying to figure out ephem but it looks like you did not set the variable sunrise in scheduler_class.py

    I made a note in the pylint refactor I am doing

               # (E) scheduler_class.Scheduler.get_values [95]: Undefined variable 'sunrise'
                # What is sunrise, I added this to avoid error
                sunrise = self.myloc.next_rising(ephem.Sun())
                return ephem.localtime(self.myloc.next_transit(ephem.Sun(), start=sunrise))
    
  2. Stephen Burning reporter

    it does work the way it is. its just when it goes to reschedule it for the next day that it doesnt work. if that makes sense. It looks like your code change would only effect the noon setting.

  3. tom enos

    Okay, like I said I'm still working out how ephem and the scheduler work. If I find the problem I'll let you know.

  4. Stephen Burning reporter

    i think we need to take this line

    ephem.Date(datetime.utcnow()) #set the date before doing any calculations

    and adjust it with an optional variable to represent adding 1 day for the reschedule

  5. Stephen Burning reporter

    maybe something like if addDay==True: ephem.Date(datetime.utcnow()+ datetime.timedelta(days=1))

  6. Stephen Burning reporter

    I did some updating and I am testing it now. I will let it run through tomorrow and see if it fires correctly.It might only need a few hours added it to it, just to get it ahead of its current value to recalculate correctly.

  7. tom enos

    I see what you are saying. It was adding the task with out rearguard for the task being the next day.

    For testing why not set back the date on your RPI then add the task, then reset the date to now.

  8. tom enos

    I got the email, but it shows nothing when I click the link

    let me try sending you one and see what happens

  9. Stephen Burning reporter

    you can use the hangout app on an android or go to gmail.com or hangouts.google.com, just need to sign in with your google+ account.

  10. Log in to comment