A TypeScript-based DESCO prepaid electricity balance monitor that sends brutally honest email notifications when your balance gets dangerously low. Because sometimes you need tough love to remember to recharge.
It checks your DESCO prepaid meter balance and fires off angry emails if you're getting close to zero
- Below 150 BDT (configurable) Warning shot "Your Electricity About to Ghost You"
- Below 100 BDT (configurable) DEFCON 1 "You're About to Live in the Stone Age"
- **Self-hosted (free forever) ** just fork this repo, toss your details into GitHub secrets, and the workflow does its thing on a schedule. Zero servers, zero cost. The setup guide below covers this.
- **Hosted (coming soon) ** a Telegram bot that does it all for you no fork, no secrets, just message the bot. Run-out predictions ("~3 days left at this rate"), a web dashboard with balance history charts, multi-meter support and SMS alerts on paid plans.
git clone <your-repo-url>
cd power-roast
bun installCreate a .env file in the project root:
# Required
DESCO_ACCOUNT_NO=your_account_number
DESCO_METER_NO=your_meter_number
EMAIL_TO=recipient@example.com
EMAIL_FROM=sender@example.com
SMTP_HOST=smtp.gmail.com
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
# Optional
SMTP_PORT=587
LOW_THRESHOLD=150
CRITICAL_THRESHOLD=100To make this run automatically via GitHub Actions, just drop these secrets into your repo
- Go to your repo's Settings → Secrets and variables → Actions
- Add the following secrets
**Required **
DESCO_ACCOUNT_NODESCO_METER_NOEMAIL_TOEMAIL_FROMSMTP_HOSTSMTP_USERSMTP_PASS
**Optional **
SMTP_PORT(defaults to 587)LOW_THRESHOLD(defaults to 150)CRITICAL_THRESHOLD(defaults to 100)
bun run check-balanceThe GitHub Actions workflow kicks in every 6 hours on its own. You can also force it to run manually from the Actions tab if you're impatient.
- Enable 2-Factor Authentication on your Google account
- Generate an App Password
- Use the app password as your
SMTP_PASS - Set
SMTP_HOST=smtp.gmail.comandSMTP_PORT=587
Works with any SMTP provider. Common settings
- Outlook
smtp-mail.outlook.com:587 - Yahoo
smtp.mail.yahoo.com:587 - Custom SMTP Use your provider's settings
- Double checks all your environment variables
- Fetches your current balance from DESCO's prepaid API
- Validates the API response
- Compares balance against configurable thresholds
- Blasts out a wildly aggressive email if you're too low
- Logs everything for your viewing pleasure
| Variable | Required | Default | Description |
|---|---|---|---|
DESCO_ACCOUNT_NO |
✅ | - | Your DESCO account number |
DESCO_METER_NO |
✅ | - | Your DESCO meter number |
EMAIL_TO |
✅ | - | Email recipient |
EMAIL_FROM |
✅ | - | Email sender |
SMTP_HOST |
✅ | - | SMTP server hostname |
SMTP_USER |
✅ | - | SMTP username |
SMTP_PASS |
✅ | - | SMTP password |
SMTP_PORT |
❌ | 587 | SMTP port |
LOW_THRESHOLD |
❌ | 150 | Warning threshold (BDT) |
CRITICAL_THRESHOLD |
❌ | 100 | Critical threshold (BDT) |
bun run buildbun run testdocker compose up -d # Postgres + Mockoon (fake Telegram & DESCO APIs)
bun run db:migrate # first time only
bun run devWith the mock-mode block enabled in .env (see .env.example), a scripted mock user
registers a meter and the fake ৳42.50 balance trips a critical alert within a minute -
the whole pipeline runs without a Telegram token or touching DESCO.
docker compose -f docker-compose.test.yml up --buildSpins up the app, a throwaway Postgres, and Mockoon faking both the
Telegram and DESCO APIs. A scripted mock user registers a meter, the fake balance (৳42.50)
trips the critical threshold, and the alert fires - watch the app logs. Clean up with
docker compose -f docker-compose.test.yml down -v.
bun run lint # ESLint with type-aware rules
bun run format # PrettierBoth run in CI on every push and PR, so run them before pushing.
- TypeScript - Type-safe balance checking
- bun - Package management & script running
- node-fetch - API requests
- nodemailer - Email notifications
- GitHub Actions - Automated scheduling
- Jest - Testing
MIT - Use it, modify it, roast yourself with it.
This is just a personal project. You're using the DESCO API at your own risk. Also the emails are intentionally meant to roast you hard feel free to tone them down in src/templates/ if you can't handle it.
- Never commit your
.envfile (it's in.gitignore) - Use GitHub Secrets for CI/CD, never hardcode credentials
- We actually disable SSL verification for DESCO's API because their certificates act up sometimes just keeping you in the loop on that.