This is an IoT button in the shape of the Grafana mascot Grot that can trigger webhook requests when pressed.
Really the easiest way is to install it as a vscode extension. Even if you don't use vscode as your editor, it is so much easier with the extension.
- 3D printed parts (get them from printables
- ESP32-C3 Super Mini (Get it from Aliexpress. Usually less than 2€)
- Cherry MX switch or clone. (You can find clones in Aliexpress for as little as 10 units for 2€.)
- Soldering supplies
- One jumper wire or any other soft wire (0.35 mm² or 22 AWG)
- Super glue or instant glue (Cyanoacrylate-based glue e.g. loctite)
I recommend you to burn the firmware before you assemble the button so you can test your chip is not defective before you solder anything.
- Clone this repository
- Open it with PlatformIO
- Connect the chip to your computer via USB-C
- Upload the firmware. In the command palette:
PlatformIO: Upload
or press the Upload button (usually top right corner) - Wait for the upload to finish without errors
- Insert the switch inside the grot bottom part
-
Cut two small jumper wire pieces of approximately 3cm each, and strip the insulation from the ends (about 5mm from each end)
-
Solder one wire to each leg of the switch (DO NOT solder to the chip yet)
-
Glue the housing to the bottom grot part. Pass the wires through the holes in the housing.
After this step you will have two wires sticking out of the housing
-
Solder the wires to the ESP32 chip. (Keep an eye on the chip orientation. The USB port should point to the housing USB hole)
- One wire to the G pin (ground)
- The other wire to the 2 pin (button pin)
-
NOTE: It doesn't matter which wire connects to which pin
-
Adjust the chip so its usb port is in the housing usb hole
-
Glue the housing lid to the housing (Do not glue the housing to the chip, glue the 3D printed parts)
-
Fix the Grot Top Part to the switch by applying pressure onto the switch until it is pressed and stays in place.
Once your button is assembled and the firmware is uploaded, you can connect it to any usb c power source (you probably already have it connected to your computer!)
On first boot, the button will start an access point (AP) with the name GrotBot-<random number>
and no password. Connect to it with your phone or computer.
Once connected (tell your laptop/smartphone to stay connected even if there's no internet), you should get a captive portal to "Sign in". If not, open the web interface at http://192.168.4.1
Once you are in the web interface, you can configure the button with your WiFi credentials and webhook URL. (Maybe try with this webhook-test website?)
Upon saving the configuration, the button will reboot and try to connect to your WiFi network.
If it fails to connect to your WiFi network, it will retry for the next 30 seconds. If all attempts fail, it will go back to AP mode and wait for you to configure it again.
If it successfully connects, you should be able to press the button and see it calls your webhook URL (GET request)
The button will go to sleep after 60 seconds of inactivity to save power. It'll wake up as soon as you press the button.
Pressing the button several times will trigger the webhook for each press.
To change the webhook URL or wifi credentials:
- Unplug the button
- Keep the button pressed while you plug it back
- Make sure to keep the button pressed for at least 5 seconds while it boots up
- The button will start in AP mode and you can configure it again by connecting to it with your phone or computer
You can set headers in the configuration form. If your endpoint requires authentication you can add a header for it. e.g: (for username:password)
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Caution
All form information is stored in plain text. Someone with physical access to your button could read it.
- Make sure the wifi credentials are correct
- Did you set
USE_LOWER_WIFI_POWER
to 0? If so, try setting it to 1 - Is your wifi signal too weak? Try setting
USE_LOWER_WIFI_POWER
to 0 (if you have the "good" chip) - The esp32 c3 super mini is a very small chip. If your wifi signal is too weak it might just not connect to it at all.
- Make sure the webhook URL is correct
- Try first with a GET request only
- Maybe try a webhook-test website such as: webhook-test.com
- You might get the "sign in" notification on your phone or computer. Try tapping it.
- If it doesn't work, try opening the web interface at
http://192.168.4.1
(in any browser) - Check if your phone is actually connected to the AP. Some phones will automatically disconnect from a wifi network if there's no internet.
- Register an account in https://webhook-test.com/
- Get a webhook URL from the "Webhooks" tab and set it in your button's configuration
- Configure the infinity datasource in your grafana instance to read from your webhook-test.com account
- Plot away!
- Use a POST request and connect it to Grafana incidents?