Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button Code Rewrite #118

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

KasparByrne
Copy link

  • Added using standard mqtt client code (Drivers/lib/mqtt_client.py) instead of creating new mqtt client
  • Added logging
  • Added using ArgumentParser from script
  • Create Button class for reusable button code
  • Added publishing button values & info using JSON
  • Changed to using event listener for button presses & releases over previous loop & check
  • Created new MQTT topic for all buttons: bike/{DEVICE_ID}/button
  • Updated lib/mqtt_client.py to use logging & take port argument
  • Moved button code into driver under directory "button_control"

-Now uses Drivers/lib/mqtt_client.py MQTT client code instead of own.

-Rewrote most code to use event listening for button presses instead of looping & sleeping

-Moved button code into own driver folder: button_control

-Created new MQTT topic - bike/{ID}/button - for button communication.

-Now uses parsed arguments from script with defaulting to environment variables rather than hardcoded values.
-Changed to use report sub-topic instead of control sub-topic as the buttons only "sense"
- turns out there was a much cleaner way to import the mqtt_client from lib.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant