Skip to content
On this page

๐Ÿ“ Scripting and Custom Automation โ€‹

CoolerControl exposes a full REST API that the Desktop and Web UI use to communicate with the daemon. You can use the same API (or the official CLI) to build automations, integrate with other tools, or script routine tasks.

Options at a glance โ€‹

  • The official CLI/TUI: cctv
    • Great for shell scripts, cron/systemd timers, hooks, and quick terminal control.
    • Try cctv --help to see available commands and flags.
  • The HTTP API: OpenAPI Explorer
    • Browse endpoints and schemas, and try requests directly from the browser.
    • Copy ready-made curl or client snippets from the explorer for your language of choice.

TIP

For scripts and automations, use an Access Token rather than the admin password. Tokens are stateless, can have expiry dates, and can be revoked individually without changing your password. For remote access, see Headless Servers and Remote Access.

Choosing the right tool โ€‹

ToolBest forRequires
cctv CLIShell scripts, cron/systemd timers, one-linerscctv installed
REST APICustom integrations, Python/JS code, Home AssistantAuth token
PluginsNew device types, persistent background servicesPlugin development
Power Profile SyncAuto-switching Modes with system power profilestuned/tuned-ppd

Rule of thumb: Start with cctv. Move to the REST API if you need data cctv doesn't expose. Write a plugin only if you need to add a new device type.

Common cctv examples โ€‹

List available Modes, then activate one:

bash
cctv --list-modes
cctv --activate-mode Quiet

Dump information about the system to stdout as json:

bash
cctv --dump

These commands can be used in any automation context (udev hooks, tuned scripts, cron/systemd timers, etc.). For a more concrete example, see Synchronizing CoolerControl with Power Profiles.

Using the REST API โ€‹

Open the OpenAPI page to discover endpoints, their request/response shapes, and authorization requirements. From there you can:

  • Use the โ€œTry it outโ€ feature to prototype requests against your local daemon.
  • Copy curl examples or language-specific snippets to your codebase.

Notes:

  • The daemon binds to the loopback interface by default. For remote access, prefer SSH tunneling or a TLS reverse proxy.
  • If you enable access protection, supply the appropriate credentials/headers as shown in the OpenAPI explorer and Access Protection.

REST API Code example โ€‹

You can find a minimal Python example in the CoolerControl repository:

You can use this as a starting point to build richer automations and integrations.

See Also โ€‹

  • cctv CLI - Full reference for the official command-line tool
  • REST API - Browse all available endpoints
  • Plugins - Extend CoolerControl with custom device support
  • Power Profile Sync - Auto-switch Modes with system power profiles
  • Access Protection - Generate access tokens for scripts and integrations

Released under the GPLv3+ License.