Skip to content

Commit

Permalink
Whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
meowmeowahr committed Feb 19, 2024
1 parent 9b0f3e5 commit 072e26a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mqtt_animator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
logging.critical("YAML Parsing Error, %s", exc)
sys.exit(0)

# logging config
logging_config: dict = configuration.get("logging", {})
logging_level: int = logging_config.get("level", 20)
logging.basicConfig(level=logging_level)

# mqtt config
mqtt_config: dict = configuration.get("mqtt", {})
mqtt_topics: dict = mqtt_config.get("topics", {})
mqtt_reconnection: dict = mqtt_config.get("reconnection", {})
Expand All @@ -51,7 +53,7 @@

num_pixels: int = driver_config.get("num_pixels", 100) # strip length
pixel_pin = getattr(board, driver_config.get("pin", "D18")) # rpi gpio pin
pixel_order = getattr(board, driver_config.get("order", "RGB")) # Color order
pixel_order = driver_config.get("order", "RGB") # Color order

animation_args = animator.AnimationArgs()
animation_args.single_color.color = [0, 255, 0]
Expand Down Expand Up @@ -121,6 +123,7 @@ def on_message(cli, userdata, msg):


if __name__ == "__main__":
# connect to mqtt server
client = mqtt_client.Client(client_id)
client.on_connect = on_connect
client.on_disconnect = on_disconnect
Expand All @@ -131,6 +134,7 @@ def on_message(cli, userdata, msg):
client.subscribe(animation_topic)
client.subscribe(args_topic)

# run mqtt background tasks in thread
threading.Thread(
target=client.loop_forever, name="MQTT_Updater", daemon=True
).start()
Expand Down

0 comments on commit 072e26a

Please sign in to comment.