Giter Club home page Giter Club logo

m5stack-slack-status-updater's Introduction

m5stack-slack-status-updater

When I walk away from my desk for lunch, I always forget to update my Slack status. I could use my phone, but then I have to unlock it, open Slack, pick an emoji, etc... Too many buttons, too much work.

If only some piece of hardware existed to allow me to update my Slack status with a pre-programmed button... 🤔

The M5Stack Core2 has three touch buttons and a magnet in the back, so it will live on the side of my fridge. Each button makes a Slack API call with a pre-programmed status, with the option to "reset" my status on the last button.

booting.mp4
status.mp4

Disclaimer

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

  • This is literally my first time writing C-type code and will be the sloppiest thing you see today.
  • Your Slack API token is basically your username and password in one. Please take that into consideration before using it here.
  • Please don't commit the arduino_secrets.h file to source control!

Hardware you need to purchase

You need an M5Stack Core2. I believe an M5Stack Core would work as well (I haven't tested this), but some hardware-specific functions (e.g., brightness, vibration) won't work.

If you don't want to purchase from M5Stack's website (because of the long shipping times), you can try:

Why not UI Flow or PlatformIO?

Both UIFlow and PlatformIO would work for this project, and I even believe UIFlow offers more features than the Arduino library. However, Arduino is the gold-standard and is the easiest to setup from scratch.

Setup the Arduino IDE

  1. Install the Arduino IDE. There are step-by-step instructions for Windows, Mac, and Linux here. Once installed, open the Arduino IDE.

  2. Add support for ESP32 boards by going to File-->Preferences-->Additional Board Manager URLs and then paste in the URL below. If you have a URL in the box already, separate them with a comma.

https://dl.espressif.com/dl/package_esp32_index.json

  1. Go to Tools-->Board-->Boards Manager, search for esp32 and install.

  2. Go to Tools-->Manage Libraries, search for m5core2 and install (be sure to install the entry by M5Stack).

  3. Go to Tools-->Manage Libraries, search for Arduino_JSON and install (be sure to install the entry by Arduino).

  4. Go to Tools-->Board and select M5Stack-Core2.

  5. I also had to make the following changes:

  • Change Tools-->Upload Speed from 921600 to 115200
  • Change Tools-->Port to /dev/ttyACM0
  • Install the pyserial package on my distrubtion

Obtain Slack API token

The easiest way to create a Slack API token is to create a single-use app for yourself, then get an API token for that app.

  1. Click here, then choose to create an app from an app manifest.

  2. Sign into the workspace that you want this app to access. This will be the workspace that you want the M5Stack to access.

  3. Copy/paste this YAML code into the box. This is the app manifest with the minimum permissions needed to update your user's status.

  4. Click Create.

  5. Click Install to Workspace.

  6. Navigate to OAuth & Permissions, then copy the User OAuth Token. It will begin with xoxp-. This token will be needed later.

Flash ESP32

  1. Clone this repo.
git clone https://github.com/loganmarchione/m5stack-slack-status-updater.git
cd m5stack-slack-status-updater/M5StackSlackStatusUpdater
  1. Rename the arduino_secrets_sample.h file to arduino_secrets.h
mv arduino_secrets_sample.h arduino_secrets.h
  1. Update the arduino_secrets.h file to include your variables.
  • WiFi SSID
  • WiFi Password
  • Slack API token
  1. Update the variables section of the 5StackSlackStatusUpdater.ino file. This is where you will set your three Slack statuses and their corresponding emojis.

  2. Click Upload in the IDE and wait for the program to compile and upload.

TODO

  • Do some printing to the serial console with more detailed info
  • Maybe switch to UIFlow since the Arduino library seems to be crippled?
  • Do some error handling with API call
  • Add buttons that can be combinations (e.g., ButtonA+ButtonB)
  • Add ability to change presence (e.g., available, away)

m5stack-slack-status-updater's People

Contributors

loganmarchione avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.