def resume(self): """ Resume execution of PW """ if self.paused: # Release lock, power.add_task will continue PowerSocketServer.sem.release() log.info('Resume PW') self.paused = False config.put('paused', False) self.ws.send(build_message(200, state={'paused': 0}))
def pause(self): """ Pause execution of PW """ if not self.paused: # Acquire lock, power.add_task won't run anymore PowerSocketServer.sem.acquire() log.info('Pause PW') self.paused = True config.put('paused', True) self.ws.send(build_message(200, state={'paused': 1}))