The temperature agent is a Fetch.ai-based agent that periodically computes the temperature status for users based on their location and temperature thresholds.
Description · Features · Key functionality · Running locally ·
This project is a temperature agent that periodically computes the temperature status for users based on their location and temperature thresholds. It uses the Fetch.ai framework to define an agent that connects to a Redis database to store user data, and uses the OpenWeatherMap API to fetch temperature data for each user's location. The temperature status is computed based on the user's temperature thresholds, and the updated user data is stored back in the Redis database. The agent also sends a message to a Discord channel to notify the user of their temperature status. The agent is deployed on Docker and can be run locally or on a server.
Link to add the discord bot to your server: bot
Available commands
Alert Command
Disable Alerts
Get weather updates
- Fetch.ai for agent development
- Redis for storing user data
- OpenWeatherMap for fetching temperature data
- Docker for containerization
- Discord.py for creating the discord bot
- Ability to set max & min temperature thresholds for each user.
- Ability to get weather updates for any given location.
- Ability to disable active alerts for a given user.
- Notifies users periodically if the temperature for a given location exceeds or enters the threshold.
You will need to have the necessary environment variables setup in your .env
file.
This includes your Discord bot token, redis-db url.
DISCORD_BOT_TOKEN =
REDIS_URL =
Note: You should not commit your
.env
file or it will expose secrets that will allow others to control access to your authentication provider accounts.
- Activate Virtual Environment:
conda activate hack-ai
- Make a new
.env
file. - Populate the
.env
file with the necessary environment variables.
pip install -r requirements.txt
python src/main.py
Your bot should be active and running.
docker login
docker pull korebhaumik/temperature-agent-hack-ai
docker pull korebhaumik/amd-redis-db
docker network create my-network
docker run -it -d -p 6379:6379 --network my-network --name amd-redis-db korebhaumik/amd-redis-db
docker run -it -d -v ./:/app -e DISCORD_BOT_TOKEN="" -e REDIS_URL="" --network my-network --name hack-ai korebhaumik/temperature-agent-hack-ai
Note: If the docker image is not available (repo is privated), you can build it locally by running
docker build -t temperature-agent-hack-ai .
in the root directory of the project.