A Bluesky bot that posts regular updates comparing the carbon intensity of France's electrical grid with other European countries. The bot fetches data from ElectricityMaps API on a configurable schedule and creates posts showing:
- Carbon intensity (gCO2/kWh) for both countries
- Top 3 power sources and their percentages
- Visual indicators for carbon intensity levels
- Country flags
- Posting time in UTC
- Configurable emojis for different power sources
🇫🇷 FRANCE: 28g CO2/kWh 🟢
⚛️ 73% Nuclear
🌊 12% Hydro
🔥 7% Gas
🇩🇪 GERMANY: 320g CO2/kWh 🔴
💨 40% Wind
🪨 20% Coal
☀️ 16% Solar
Data [Electricity Maps](https://app.electricitymaps.com/) (14:00 UTC)
- Clone the repository
- Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Copy
.env.example
to.env
and fill in your credentials:BLUESKY_HANDLE=your.handle.bsky.social BLUESKY_PASSWORD=your_password ELECTRICITY_MAPS_TOKEN=your_api_token SAVE_POSTS=false
- Customize the list of countries to compare in
config.yaml
The config.yaml
file allows you to configure:
- List of European countries to compare with France
- Posting interval (in hours)
- Logging settings
- Emojis for different power sources
- Thresholds for carbon intensity levels
- Account tag to be mentioned in posts
python src/main.py
The bot will:
- Post updates at the configured interval (default: 6 hours)
- Log activities to bot.log
- Optionally save posts to posts.log if SAVE_POSTS=true
The bot includes comprehensive error handling:
- Automatic retries for failed API requests
- Detailed logging of all activities and errors
- Graceful handling of API rate limits and network issues
Logs are written to bot.log
with configurable log levels and format. The logging configuration can be customized in config.yaml
.
MIT License