def display_weather(self):
if not self._scheduled:
# Start a fresh thread for weather updates
cg.send('Starting update_weather()')
self.update_weather()
self._checkSchedule = True
self._scheduled = True
schedule.every(5).minutes.do(self.update_weather)
cg.thread(self.run_sched) # Start a separate thread
elif self._checkSchedule:
cg.send('Error: update_weather() is already running')
elif not self._checkSchedule:
# Allow the weather updates to continue
cg.send('Toggling weather updates back on')
self._checkSchedule = True
cg.thread(self.run_sched) # Start a separate thread
else:
cg.send('No appropriate display_weather() action...')
评论列表
文章目录