Skip to content

Commit

Permalink
Merge pull request #10 from paulianttila/dev
Browse files Browse the repository at this point in the history
Fixed command sending
  • Loading branch information
paulianttila authored Jul 10, 2023
2 parents 0ffa612 + 9127ee5 commit 307c9d0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def init(self, callbacks: Callbacks) -> None:
)

def get_version(self) -> str:
return "2.2.1"
return "2.2.2"

def stop(self) -> None:
self.logger.debug("Exit")
Expand Down Expand Up @@ -259,17 +259,25 @@ def handle_command(self, message: str) -> None:
data = json.loads(message)
sn = data["deviceLabel"]
command = data["command"]
req = None

match command:
case "enableAutolock":
self.verisure.set_autolock_enabled(
req = self.verisure.set_autolock_enabled(
device_label=sn, auto_lock_enabled=True, giid=self.giid
)
case "disableAutolock":
self.verisure.set_autolock_enabled(
req = self.verisure.set_autolock_enabled(
device_label=sn, auto_lock_enabled=False, giid=self.giid
)

if req is not None:
self.logger.debug(f"Sending request: {req}")
res = self.verisure.request(req)
self.logger.debug(f"Received response to request: {res}")
else:
self.logger.error(f"No request to send for '{message}'")

def update_data_to_mqtt(self, overview: dict) -> None:
self.publish_broadband(overview)
self.publish_locks(overview)
Expand Down

0 comments on commit 307c9d0

Please sign in to comment.