def post_command(self, cmd: Command, priority=2): cmd.device_id = self.device_id self._queue.put(cmd, priority) if not self._is_queue_check_running: t = Thread(target=self._queue_new_item) t.start()
def _post_command(self, cmd: Command, priority=0): cmd.device_id = self.device_id job = Job(task=self._execute_command, args=[cmd]) self.scheduler.schedule_job(job)