def run(self):
    con = Core.get_con_obj()
    if (not con.token_backend.check_token()):
        logging.error('You have to generate your token file with python -m radiator_fritz_o365_sync.gen_token first!')
        exit(1)
    con.refresh_token()
    heating = self.query_for_heating_periods()
    if (len(heating) == 0):
        logging.debug('No heating entry in calendar found. Cooling down all thermostats if they are heating. ')
        self.cool_down_all()
    subjects = []
    for heat in heating:
        logging.info('Found entry "%s"', heat.subject)
        self.heat_up(heat.subject)
        subjects.append(heat.subject)
    self.cool_down_unless(subjects)
    if (len(heating) == 0):
        self.auto_reset()
    if (dt.now().time().strftime('%H:%M') == '00:00'):
        con.refresh_token()
def run(self):
    con = Core.get_con_obj()
    if (not con.token_backend.check_token()):
        logging.error('You have to generate your token file with python -m radiator_fritz_o365_sync.gen_token first!')
        exit(1)
    con.refresh_token()
    heating = self.query_for_heating_periods()
    if (len(heating) == 0):
        logging.debug('No heating entry in calendar found. Cooling down all thermostats if they are heating. ')
        self.cool_down_all()
    subjects = []
    for heat in heating:
        logging.info('Found entry "%s"', heat.subject)
        self.heat_up(heat.subject)
        subjects.append(heat.subject)
    self.cool_down_unless(subjects)
    if (len(heating) == 0):
        self.auto_reset()
    if (dt.now().time().strftime('%H:%M') == '00:00'):
        con.refresh_token()