Skip to content

A Discord Bot that runs on an M5Stack Atom and sends a Wake-On-Lan signal to a target device.

License

Notifications You must be signed in to change notification settings

Blocker226/ESP32-Discord-WakeOnCommand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Discord Wake-On-Command Bot

Screenshot 2023-08-02 110951

Send a Discord command or DM, and wake a target device anywhere, anytime!

Description

A self-contained Discord Bot that runs on an M5Stack Atom Lite and sends a Wake-On-Lan signal to a hardcoded target device from a slash command. Built for ESP32 devices using Arduino C++.

Currently the main code makes use of the M5Atom architecture for certain onboard capabilities such as LED and button control. Expanded compatability for other ESP32 devices will come eventually.

Features

  • Simple ping command to poll responsiveness
  • Wake command to send WOL packet to a specific device's MAC address
    • Limited access to specific users
  • Manual WOL packet sending via button press
  • Based on a expandable ESP32 Discord Bot framework (to be published separately)
    • Built-in command registration
  • Cool LED status indicator

Dependencies

Installation

  1. Download the source code and open it in Visual Studio Code.
  2. Use the PlatformIO IDE to setup dependencies and build environments, or do it manually.
  3. Configure Wifi, Discord Bot token, and your own user IDs in privateconfig.template, and rename the file to privateconfig.h.
  4. Plug in the M5Stack Atom to your PC via its USB-C port, then build and upload the code.
  5. Once the LED is green, press and hold the button for 2.5 seconds, the LED will turn purple, releasing it will let the ESP32 register the two global commands. This must be done when changes are made to the command structure.

Usage

Once the status light is green, the bot is online and connected to Discord. Invite it to a server and use the slash command in the server, or DM the bot.

To toggle the bot's connection to Discord, press and hold for 5 seconds until the light turns amber. The blue status light means the bot is no longer connected, and the ESP32 only responds to manual button presses.

Commands

  • /ping - Checks for responsiveness. The bot will reply with "Uplink online."
  • /wake - Sends a WOL packet to the target MAC address specified in privateconfig.h. This only works for the user ids specified in the file, and access will be denied for anyone else attempting to use the command.

LED Status Colours

Colour Status
White Initialising Wi-Fi connection.
Red An error has occurred with the Wi-Fi or Discord connection.
Green Connected to Discord, currently idle.
Blue Disconnected from Discord, currently idle.
Purple Connecting to Discord.
Amber Processing command.

The LED turns purple when receiving commands via Discord, and amber during manual operation.

Troubleshooting

If the LED turns red, it could be for 3 reasons:

  1. Unable to connect to Wi-Fi.
  2. Unable to connect to Discord.
  3. The WOL packet failed to send.

Plug the M5Stack Atom into a PC, reboot and check serial if needed. Using PlatformIO, the m5stack-atom-debug configuration defines an additional debug symbol to allow the bot to print additional debug information.

Contributing

If you've found a reproducible bug or error, or you have a cool feature to suggest, do file an issue! Further contributing guidelines will be made when necessary.

About

A Discord Bot that runs on an M5Stack Atom and sends a Wake-On-Lan signal to a target device.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages