Skip to content

Commit

Permalink
Linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
freol35241 committed Aug 19, 2023
1 parent 35ad10b commit def4074
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def _handler(client, userdata, message): # pylint: disable=unused-argument
LOGGER.info("Starting background mqtt thread...")
mq.loop_start()


def _try_floatify_values(dikt: dict):
for k, v in dikt.items():
try:
Expand All @@ -139,7 +140,9 @@ def _try_floatify_values(dikt: dict):
status = response.parse_payload().split(",")
dikt = {key: status[ix] for ix, key in enumerate(STATUS_PARAMS.keys())}
_try_floatify_values(dikt)
mq.publish(f"{MQTT_BASE_TOPIC}/status", json.dumps(dikt, sort_keys=True))
mq.publish(
f"{MQTT_BASE_TOPIC}/status", json.dumps(dikt, sort_keys=True)
)

else:
LOGGER.error("response was None from query: 'status'")
Expand Down Expand Up @@ -179,7 +182,9 @@ def _try_floatify_values(dikt: dict):
):
dikt = response.parse_payload()
_try_floatify_values(dikt)
mq.publish(f"{MQTT_BASE_TOPIC}/operating", json.dumps(dikt, sort_keys=True))
mq.publish(
f"{MQTT_BASE_TOPIC}/operating", json.dumps(dikt, sort_keys=True)
)

except Exception: # pylint: disable=broad-exception-caught
LOGGER.exception("Function: 'operating', path: '*'")
Expand All @@ -196,7 +201,9 @@ def _try_floatify_values(dikt: dict):
):
dikt = response.parse_payload()
_try_floatify_values(dikt)
mq.publish(f"{MQTT_BASE_TOPIC}/advanced", json.dumps(dikt, sort_keys=True))
mq.publish(
f"{MQTT_BASE_TOPIC}/advanced", json.dumps(dikt, sort_keys=True)
)

except Exception: # pylint: disable=broad-exception-caught
LOGGER.exception("Function: 'advanced', path: ''")
Expand Down

0 comments on commit def4074

Please sign in to comment.