Skip to content

Commit

Permalink
ran black
Browse files Browse the repository at this point in the history
  • Loading branch information
DJDevon3 committed Nov 29, 2023
1 parent 0e15164 commit 358ac9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/minimqtt_multipub_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import socketpool
import adafruit_minimqtt.adafruit_minimqtt as MQTT
from adafruit_minimqtt.adafruit_minimqtt import MMQTTException

# from adafruit_bme280 import basic as adafruit_bme280

# Initialize Web Sockets (This should always be near the top of a script!)
Expand Down Expand Up @@ -41,6 +42,7 @@
# i2c = board.STEMMA_I2C() # uses board.SCL and board.SDA
# bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)


# Converts seconds to minutes/hours/days
# Attribution: Written by DJDevon3 & refined by Elpekenin
def time_calc(input_time):
Expand All @@ -52,6 +54,7 @@ def time_calc(input_time):
return f"{input_time / 60 / 60:.0f} hours"
return f"{input_time / 60 / 60 / 24:.1f} days"


# Define callback methods when events occur
def connect(mqtt_client, userdata, flags, rc):

Check failure on line 59 in examples/minimqtt_multipub_simpletest.py

View workflow job for this annotation

GitHub Actions / test

Redefining name 'mqtt_client' from outer scope (line 75)

Check failure on line 59 in examples/minimqtt_multipub_simpletest.py

View workflow job for this annotation

GitHub Actions / test

Unused argument 'mqtt_client'

Check failure on line 59 in examples/minimqtt_multipub_simpletest.py

View workflow job for this annotation

GitHub Actions / test

Unused argument 'userdata'

Check failure on line 59 in examples/minimqtt_multipub_simpletest.py

View workflow job for this annotation

GitHub Actions / test

Unused argument 'flags'

Check failure on line 59 in examples/minimqtt_multipub_simpletest.py

View workflow job for this annotation

GitHub Actions / test

Unused argument 'rc'
# Method when mqtt_client connected to the broker.
Expand Down Expand Up @@ -123,14 +126,14 @@ def publish(mqtt_client, userdata, topic, pid):
except (ValueError, RuntimeError, OSError) as e:
print("| | ❌ Error:, retrying\n", e)
continue
except (ConnectionError) as e:
except ConnectionError as e:
print("| | ❌ Failed to connect, retrying\n", e)
continue
except (MMQTTException) as e:
except MMQTTException as e:
print("| | ❌ MMQTTException", e)
traceback.print_exception(e, e, e.__traceback__)
break

mqtt_client.disconnect()
print("| ✂️ Disconnected from Wifi")
print("Next Update: ", time_calc(sleep_time))
Expand Down

0 comments on commit 358ac9f

Please sign in to comment.