From 9f3ce78f26b031581b906103013b95fdcaffa0f4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:57:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- HCDevice.py | 8 ++------ hc2mqtt | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/HCDevice.py b/HCDevice.py index 4945042..523aa3b 100755 --- a/HCDevice.py +++ b/HCDevice.py @@ -97,11 +97,8 @@ class HCDevice: if "program" not in data: raise TypeError("Message data invalid, no program specified.") - - if isinstance(data["program"],int) is False: - raise TypeError( - f"Message data invalid, UID in 'program' must be an integer." - ) + if isinstance(data["program"], int) is False: + raise TypeError(f"Message data invalid, UID in 'program' must be an integer.") # devices.json stores UID as string uid = str(data["program"]) @@ -240,7 +237,6 @@ class HCDevice: # Raises exception on failure self.test_program_data(data) - msg["data"] = [data] try: diff --git a/hc2mqtt b/hc2mqtt index 9886921..dd1237c 100755 --- a/hc2mqtt +++ b/hc2mqtt @@ -91,7 +91,7 @@ def client_connect(client, device, mqtt_topic): mqtt_state = msg.payload.decode() mqtt_topic = msg.topic.split("/") print(now(), f"{msg.topic} received mqtt message {mqtt_state}") - + try: if len(mqtt_topic) >= 2: device_name = mqtt_topic[-2]