Skip to content

Bot sending SigFox alerts on Discord for beehive monitoring

Notifications You must be signed in to change notification settings

tprigent/beebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beebot

Bot that sends SigFox messages to a Discord server.

In particular, it allows beehive owner to be alerted if suspicious activity is detected.

Capture d’écran 2023-08-15 à 16 16 25

Table of Contents

  1. How to use it?
    1. Prerequesites
    2. Installation
      1. Discord bot
      2. SigFox API
      3. Install server
  2. References

How to use it?

Prerequisites

On your server, make sure that npm and nodejs are installed:

sudo apt install nodejs npm

Installation

Copy the config_sample.js file under the name config.js.

Creating the Discord bot

Login at the Discord developer portal and create a new app.

  1. In the "bot" section, choose a name and an avatar for your bot.
  2. Copy the bot token in the config.js file.
  3. In the "OAuth2" section, go to URL generator, check bot and the permissions you want for your bot.
  4. Copy the generated URL and paste it in your browser, you will be able to choose in which server you want to add it.

Create the SigFox API access

Login at the SigFox backend.

  1. Under the "Device type" section, select the group to which your SigFox module is linked.
  2. In the left bar menu, choose "API access".
  3. Create a new one, and choose the DEVICE_MANAGER [R] option.
  4. Copy login and password in the config.js file.

Install the server

Clone the project in an adequate folder, then cd in it and run:

npm install

This will install the Node.js server.

To make it run continuously and at server startup, check the following steps:

  1. Install PM2 (process manager for npm)
sudo npm install pm2@latest -g
  1. Start using PM2 for your service
pm2 start beebot/beebot.js
  1. Type the following line to create startup script
pm2 startup systemd
  1. Copy-paste the suggested command line to enable PM2 on boot
  2. Save the PM2 process list with pm2 save
  3. Start the PM2 service and replace usr by your username
sudo systemctl start pm2-usr

NB: You can manage PM2 with the commands pm2 list, pm2 monit, pm2 stop [service-id], pm2 restart [service-id]...

References

This bot was inspired by the Insanotedur project, a bot that alerts students of new grades on their digital portal.

About

Bot sending SigFox alerts on Discord for beehive monitoring

Topics

Resources

Stars

Watchers

Forks