Die on error

This commit is contained in:
Lynn Ochs 2022-11-24 17:23:16 +01:00
parent 9358dfc74b
commit 4b275b0f43

View File

@ -8,6 +8,8 @@ from .. import mqtt
from .constants import state_names, state from .constants import state_names, state
from . import constants from . import constants
import sys
class Control(util.Loggable): class Control(util.Loggable):
def __init__(self, config, mqtt_client=None): def __init__(self, config, mqtt_client=None):
super().__init__("door") super().__init__("door")
@ -156,7 +158,8 @@ class Control(util.Loggable):
self._comm.cmd_restart() self._comm.cmd_restart()
sleep(5) sleep(5)
self._comm.cmd_close() self._comm.cmd_close()
self.target(state.CLOSE) sleep(1)
sys.exit(1)
else: else:
self._logger().debug("Reached wrong state") self._logger().debug("Reached wrong state")
if timeouts < 3: if timeouts < 3: