Power Control Center is a central hub for temperature and power management in your home. It integrates with various ESP32-based devices to monitor and control air conditioning units based on temperature, power consumption, and presence detection. The system provides a unified web dashboard to monitor and manage all connected devices.
The web dashboard is accessible on port 9040 by default. For example: http://raspberrypi.local:9040
This system integrates with several ESP32-based devices:
-
esp32-ir-airco-controller - ESP32 device with temperature sensor and IR emitter to control the airco unit. The repository includes a printable case for the device.
-
european_smart_meter - Reads European smart meter to determine current power consumption, and reads the Huawei solar inverter.
-
ac-pir-detector (optional component) - ESP32 with PIR sensor to disable AC for a few minutes until presence is no longer detected. Intended to maintain a stable temperature near the outside AC unit while in the area. Printable case available here.
Install the latest release with a single command:
curl -fsSL https://raw.githubusercontent.com/NotCoffee418/power_control_center/main/installation/install.sh | sudo bash- Download the installation script:
wget https://raw.githubusercontent.com/NotCoffee418/power_control_center/main/installation/install.sh
chmod +x install.sh- Run the installer:
sudo ./install.shThe installer will:
- Detect your system architecture (x86_64, arm64, armv7)
- Download the latest release binary
- Create necessary system user and directories
- Install the systemd service
- Set appropriate permissions
- Create a configuration file at
/etc/power_control_center/config.json:
sudo nano /etc/power_control_center/config.jsonSee the Configuration section below for detailed information about all available options. You can also reference config-example.json for a complete example.
- Enable and start the service:
sudo systemctl enable power_control_center
sudo systemctl start power_control_center- Check the service status:
sudo systemctl status power_control_center- View logs:
sudo journalctl -u power_control_center -f- Linux x86_64
- Linux ARM64 (aarch64)
- Linux ARMv7
Config file must be manually created on the device, use config.example.toml as a template.
Path: /etc/power_control_center/config.json
Database file will be automatically created on the device, if it does not exist.
Path is defined in config but is quite expected to be at this path.
Path: /var/lib/power_control_center/pcc.db
Records a PIR (motion) detection event and immediately turns off the corresponding AC device.
Query Parameters:
device(required) - The device name (e.g., "Veranda")
Headers:
Authorization: ApiKey <your_pir_api_key>orAuthorization: Bearer <your_pir_api_key>
Example:
curl -X POST "http://localhost:9040/api/pir/detect?device=Veranda" \
-H "Authorization: ApiKey your_pir_api_key_here"Behavior:
- Immediately turns off the AC for the specified device
- Records the detection time
- Prevents the AC from being turned back on for the configured timeout period (default: 5 minutes)
Receives a keep-alive signal from PIR devices for monitoring purposes.
Query Parameters:
device(optional) - The device name
Headers:
Authorization: ApiKey <your_pir_api_key>orAuthorization: Bearer <your_pir_api_key>
Example:
curl -X POST "http://localhost:9040/api/pir/alive?device=Veranda" \
-H "Authorization: ApiKey your_pir_api_key_here"The configuration file should be created at /etc/power_control_center/config.json. See config-example.json for a complete example.
{
"database_path": "/var/lib/power_control_center/pcc.db",
"listen_address": "0.0.0.0",
"listen_port": 9040,
"smart_meter_api_endpoint": "http://raspberrypi.local:9039",
"ac_controller_endpoints": {
"LivingRoom": {
"endpoint": "http://192.168.50.201",
"api_key": "secret123"
},
"Veranda": {
"endpoint": "http://192.168.50.202",
"api_key": "secret456"
}
},
"latitude": 51.5074,
"longitude": -0.1278,
"pir_api_key": "your_pir_api_key_here",
"pir_timeout_minutes": 5
}-
database_path: Path to the SQLite database file. Default:/var/lib/power_control_center/pcc.db(recommended to keep default) -
listen_address: IP address the web server will bind to. Default:0.0.0.0(all interfaces, recommended to keep default) -
listen_port: Port number for the web dashboard. Default:9040(recommended to keep default) -
smart_meter_api_endpoint: URL to your european_smart_meter API endpoint (e.g.,http://your-device-ip:9039). Configure this based on how you set up the smart meter API. -
ac_controller_endpoints: Object mapping room names to AC controller configurations. Each entry requires:endpoint: URL to the esp32-ir-airco-controller deviceapi_key: API key for the device (generated through the device's dashboard)
-
latitudeandlongitude: Geographic coordinates for your location. Used for solar calculations and automation. You can find your coordinates using Google Maps or similar services. -
pir_api_key: API key for authenticating ac-pir-detector requests. This is an arbitrary key that must match what you configured on the PIR device. (optional, defaults to empty/no auth) -
pir_timeout_minutes: Number of minutes to keep AC off after PIR motion detection. Default:5(optional)