From 0deb3eb8f655684d962c2f2b6939026148a92057 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:06:07 -0600 Subject: [PATCH] generic action handler --- apps/cubes/cube.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/cubes/cube.py b/apps/cubes/cube.py index 31e4b87..cb44f6a 100644 --- a/apps/cubes/cube.py +++ b/apps/cubes/cube.py @@ -20,10 +20,15 @@ class AqaraCube(Mqtt): if action == '': return elif (handler := getattr(self, f'handle_{action}', None)): + if (arg := self.args.get(action, None)) is not None: + self.action_handler(action_description=arg) handler(payload) else: self.log(f'Unhandled cube action: {action}') + def action_handler(self, action_description): + self.log(f'{self.args["cube"]}: generic action handler: {action_description}') + def handle_rotate_right(self, payload): self.log(f'{self.args["cube"]}: Rotate right')