Use multi-byte commands to enable position reporting

This commit is contained in:
Lynn Ochs 2021-08-15 17:48:31 +02:00
parent eccf936f6c
commit 69c823ec52

View File

@ -160,7 +160,7 @@ class DoorControl:
"""Opens the serial port controlling the door opener. config must have a serial_port member.""" """Opens the serial port controlling the door opener. config must have a serial_port member."""
try: try:
self.serial_port = serial.Serial(config.serial_port, timeout=2) self.serial_port = serial.Serial(config.serial_port, timeout=2)
self._send_door_cmd(b'r') self._send_door_cmd(b'>r1\n')
except: except:
self.serial_port = None self.serial_port = None
return self.serial_port return self.serial_port
@ -224,7 +224,7 @@ class DoorControl:
def _check_reporting(self, current: int): def _check_reporting(self, current: int):
if current == 0: if current == 0:
self.logger.info("Turning position reporting on") self.logger.info("Turning position reporting on")
self._send_door_cmd(b'r') self._send_door_cmd(b'>r1\n')
else: else:
self.logger.info("Position reporting is on") self.logger.info("Position reporting is on")