stm32-fmt-code/access_control_python/access_control_mqtt.py

20 lines
558 B
Python

from espmega_mqtt import ESPMegaMQTT
from time import sleep
class access_control:
def __init__(self):
self.plc = ESPMegaMQTT()
pass
def light_on(self):
self.plc.write_pwm(0,1,4095)
def light_off(self):
self.plc.write_pwm(0,0,4095)
def get_door_state(self) -> bool:
return self.plc.read_digital(0)
def get_scan_state(self) -> bool:
return self.plc.read_digital(1)
def lock_door(self):
self.plc.write_pwm(1,1,4095)
def unlock_door(self):
self.plc.write_pwm(1,0,4095)