direction = 1 while True: time.sleep(0.5) T1 = tag_egine.read_tag("T1") T1 += direction tag_egine.write_tag("T1", T1) if T1 >= 60: direction *= -1 if T1 <= 5: direction *= -1 app.define_user("Luke", "skywalker", VISITOR_ROLE) app.define_user("rackio", "12345678", "System") if __name__ == "__main__": app.set_db(dbfile="tags.db") app.set_log(file="app.log") app.set_dbtags(["RAND1", "RAND2"], 0.2) app.set_dbtags(["T1", "T2", "T3"], 0.5) app.enable_auth() app.run(8030)
def on_back(self): self.count = 0 def while_state1(self): self.count += 1 logging.warning("{}: {}".format(self.name, self.count)) def while_state2(self): self.count -= 1 logging.warning("{}: {}".format(self.name, self.count)) app = Rackio() machine1 = TwoStep("machine 1") machine2 = TwoStep("machine 2") app.append_machine(machine1, 1, "async") app.append_machine(machine2, 2, "async") if __name__ == "__main__": app.set_log(file="app.log") app.run()