def query_for_heating_periods(self):
    account = Core.get_account()
    schedule = account.schedule()
    calendar = schedule.get_calendar(calendar_name=conf['CALENDAR_NAME'])
    if (calendar is None):
        logging.error("Calendar with name '%s' does not exist!", conf['CALENDAR_NAME'])
        exit(1)
    q = calendar.new_query('start').greater_equal(dt.now())
    q.chain('and').on_attribute('end').less_equal((dt.now() + timedelta(minutes=5)))
    return list(calendar.get_events(query=q))
def query_for_heating_periods(self):
    account = Core.get_account()
    schedule = account.schedule()
    calendar = schedule.get_calendar(calendar_name=conf['CALENDAR_NAME'])
    if (calendar is None):
        logging.error("Calendar with name '%s' does not exist!", conf['CALENDAR_NAME'])
        exit(1)
    q = calendar.new_query('start').greater_equal(dt.now())
    q.chain('and').on_attribute('end').less_equal((dt.now() + timedelta(minutes=5)))
    return list(calendar.get_events(query=q))