Skip to content

Latest commit

Β 

History

60 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

powerctl

A beautiful command-line tool for monitoring your Tibber power consumption and electricity prices.

Latest release Release notes Tests License

Features

  • ⚑ Real-time monitoring - Stream live power consumption from your Tibber Pulse
  • πŸ’° Price tracking - View current, today's, and tomorrow's electricity prices
  • 🏠 Home management - List and manage multiple Tibber homes
  • 🎨 Beautiful output - Colored, formatted CLI output (or JSON/Markdown)
  • πŸš€ Cross-platform - Works on Linux, macOS, and Windows

Installation

Homebrew (macOS & Linux)

brew install kristofferrisa/powerctl/powerctl

Upgrade with brew upgrade powerctl.

Installed the older powerctl-cli formula? Replace it with brew uninstall powerctl-cli && brew install kristofferrisa/powerctl/powerctl.

Download Binary

Download the latest release for your platform from Releases.

Build from Source

git clone https://github.com/kristofferrisa/powerctl-cli.git
cd powerctl-cli
make build
./powerctl --help

Quick Start

  1. Get your API token from developer.tibber.com/settings/access-token

  2. Run setup wizard:

    powerctl config init
  3. View your home:

    powerctl home

Usage

Configuration

Option 1: Environment variable (recommended)

export TIBBER_TOKEN="your-token-here"
powerctl home

Option 2: Config file

powerctl config init  # Interactive setup
# or manually edit ~/.tibber/config.yaml

Option 3: Command flag

powerctl --config /path/to/config.yaml home

Commands

Check Version

powerctl version
powerctl-cli version 0.4.2
Git commit: a1b2c3d
Built: 2026-08-28T15:30:00Z

View Home Information

powerctl home
⚑ My House
──────────

  πŸ“ Address
     123 Main Street
     12345 Oslo, Norway

  🏠 Details
     Size:      150 mΒ²
     Residents: 2
     Main Fuse: 25 A

  ⚑ Pulse
     Status: ● Connected

Check Electricity Prices

powerctl prices
⚑ Electricity Prices
──────────────────────

  NOW  0.45 NOK/kWh  ● Normal

  πŸ“… Today
   β–Ά 14:00 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 0.45 NOK
     15:00 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘ 0.62 NOK
     16:00 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 0.78 NOK

View Consumption History

powerctl consumption --resolution daily --last 7

πŸ“Š Consumption History
────────────────────────

  πŸ“… Period    ⚑ Consumption             πŸ’° Total Cost             πŸ“Š Avg Price
  ──────────────────────────────────────────────────────────────────────────────
  2023-10-01   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 24.50 kWh     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 120.40 NOK    4.90 NOK/kWh
  2023-10-02   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘ 15.00 kWh     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘  60.00 NOK    4.00 NOK/kWh
  ──────────────────────────────────────────────────────────────────────────────
  Totals       39.50 kWh                  180.40 NOK

Stream Live Power Consumption

powerctl live
⚑ Live Power
──────────────

  1,234 W

  πŸ“Š Today
     Consumed: 12.50 kWh
     Cost:     45.30 NOK

  πŸ”Œ Grid
     Voltage: 230 / 231 / 229 V
     Current: 5.2 / 3.1 / 4.5 A

Press Ctrl+C to stop streaming.

Monitor a specific home with --home-id (otherwise the home from your config is used, or the first one on the account):

powerctl live --home-id 96a14971-525a-4420-aae9-e5aefaf46a81

powerctl consumption takes the same flag.

Output Formats

Default output is beautiful colored CLI. Change format with --format:

JSON (for scripting/piping):

powerctl prices --format json | jq '.current.total'

Markdown (for AI/documentation):

powerctl home --format markdown

Configuration File

Location: ~/.tibber/config.yaml

token: "your-api-token"
home_id: "optional-default-home-id"  # Skip home selection
format: "pretty"                      # Options: pretty, json, markdown

View current config:

powerctl config show

Update a value:

powerctl config set format json

Development

Build

make build          # Build ./powerctl
make build-all      # Cross-compile all platforms

Test

make test           # Run all tests
go test ./internal/config -run TestLoad  # Run specific test

Lint & Format

make fmt            # Format code
make lint           # Run linter (requires golangci-lint)

API Information

  • GraphQL endpoint: https://api.tibber.com/v1-beta/gql
  • WebSocket (live): wss://websocket-api.tibber.com/v1-beta/gql/subscriptions
  • Rate limits: 20 WebSocket connections per hour
  • Documentation: developer.tibber.com

Troubleshooting

"No API token found"

  • Set TIBBER_TOKEN environment variable or run powerctl config init

"Pulse not enabled"

  • Ensure your Tibber Pulse is connected and active
  • Check status at tibber.com

"invalid or non-existing home ID"

  • The ID passed to --home-id is not on your account. List valid IDs with powerctl home

Live stream disconnects

  • Rate limit is 20 connections/hour
  • There is no automatic reconnect β€” the command exits with code 1 and the error. Re-run it, or wrap it in a supervisor if you need it to stay up

Contributing

Contributions welcome β€” including AI-assisted ones. Please read CONTRIBUTING.md for the workflow and ARCHITECTURE.md for code structure details.

  1. Open an issue describing the Goal, Plan and Tasks (the task template has the structure)
  2. Fork the repository
  3. Create a feature branch (git checkout -b feat-amazing-feature)
  4. Commit changes (git commit -m 'Add amazing feature')
  5. Push to branch (git push origin feat-amazing-feature)
  6. Open a Pull Request linking back to the issue

Found a security issue? Please report it privately β€” see the security policy.

License

MIT License - see LICENSE for details.

Acknowledgments

  • Built with Cobra CLI framework
  • Uses Tibber's official GraphQL API
  • Inspired by Unix philosophy: do one thing well

Made with ⚑ by Kristoffer Risa

About

A command-line tool for Tibber and Tibber Pulse, providing real-time energy data.

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages