- CLP Subscriber
- CLP website credentials
- CLP smart meter installed (for
HOURLYusage data)
- Setup
HACShttps://hacs.xyz/docs/setup/prerequisites - In
Home Assistant, clickHACSon the menu on the left - Select
integrations - Click the menu button in the top right hand corner
- Choose
custom repositories - Enter
https://github.com/thematrixdev/home-assistant-clpand chooseIntegration, clickADD - Find and click on
CLPHKin thecustom repositorieslist - Click the
DOWNLOADbutton in the bottom right hand corner - Restart Home Assistant
- Go to
Settings,Devices and Services - Click the
Add Integrationbutton - Search
CLPHK - Go through the configuration flow
- Open
Settings->Devices and Services->CLPHK - Step 1: Enter
Access TokenandRefresh Token - Step 2: Configure sensor options
- Open an Incognito window (
Ctrl+Shift+N) - Go to https://www.clp.com.hk/services/en/login and sign in
- Open Chrome DevTools (
F12) - Go to
Application->Storage->Local Storage - Select
https://www.clp.com.hk - Copy these keys:
act-> use asAccess Tokenrct-> use asRefresh Token
- Close the Incognito window (do NOT sign out)
WARNING: Do NOT sign out from the CLP website. Signing out will revoke the refresh token and the integration will stop working. Always close the browser window directly after copying the tokens.
You can paste either:
- Full JSON object (recommended), for example
{"data":"...","time":...,"expire":"..."} - JSON string value, for example
"..."(including quotes) - Plain base64 token string, for example
...
For both Access Token and Refresh Token, only these formats are accepted:
- JSON object:
{"data":"<base64-token>","time":...,"expire":"..."} - JSON string:
"<base64-token>" - Plain base64 string:
<base64-token>
| Key | Type | Required | Accepted Values | Default | Description |
|---|---|---|---|---|---|
access_token |
string | * | Accepted token formats above | (N/A) | CLP access token |
refresh_token |
string | * | Accepted token formats above | (N/A) | CLP refresh token |
name |
string | Any string | CLP |
Name of the sensor | |
timeout |
int | Any integer | 30 |
Connection timeout in second | |
retry_delay |
int | Any integer | 300 |
Delay before retry in second | |
type |
string | BIMONTHLYDAILYHOURLY |
|
Type of data to be shown in state If not specified, best accurate value is used |
|
get_account |
boolean | TrueFalse |
False |
Get account summary | |
get_bill |
boolean | TrueFalse |
False |
Get bills | |
get_estimation |
boolean | TrueFalse |
False |
Get usage estimation | |
get_bimonthly |
boolean | TrueFalse |
False |
Get bi-monthly usage | |
get_daily |
boolean | TrueFalse |
False |
Get daily usage | |
get_hourly |
boolean | TrueFalse |
False |
Get hourly usage | |
get_hourly_days |
int | 1 or 2 |
1 |
Number of days to get hourly data | |
renewable_energy_sensor_enable |
boolean | TrueFalse |
False |
Enable renewable energy sensor | |
renewable_energy_sensor_name |
string | TrueFalse |
'CLP Renewable Energy' |
Name of the renewable energy sensor | |
renewable_energy_sensor_type |
string | BIMONTHLYDAILYHOURLY |
|
Type of data to be shown in state If not specified, best accurate value is used |
|
renewable_energy_sensor_get_bill |
boolean | TrueFalse |
False |
Get energy generation in bills | |
renewable_energy_sensor_get_daily |
boolean | TrueFalse |
False |
Get daily energy generation | |
renewable_energy_sensor_get_hourly |
boolean | TrueFalse |
False |
Get hourly energy generation | |
renewable_energy_sensor_get_hourly_days |
int | 1 or 2 |
1 |
Number of days to get hourly data |
- It is recommended to provide
typeandrenewable_energy_sensor_typefor data consistency
This integration uses access_token + refresh_token.
- Go to
Settings,Devices and Services - Click
CLPHK - Click
Configure - Fill in new
Access TokenandRefresh Token - Click
Submit
No extra setup is required for automatic refresh.
If refresh returns HTTP 4xx:
- tokens are cleared
- a persistent notification is shown in Home Assistant frontend
- the integration is unloaded (stopped) for safety
At that point, reconfigure with fresh tokens.
- More than one
clphkentry will cause issues. Avoid multiple entries. - Timeouts may occur on slower hardware. Increase
timeoutvalue to mitigate. - If you see
CLPHK Authentication Failednotification, refresh token was rejected by CLP and the integration was stopped. Reconfigure with new tokens.
- On Home Assistant, go to
Settigns->Logs - Search
CLPHK
- Add these lines to
configuration.yaml
logger:
default: info
logs:
custom_components.clphk: debug- Restart Home Assistant
- On Home Assistant, go to
Settigns->Logs - Search
CLPHK - Click the
LOAD FULL LOGSbutton
- Open an issue on GitHub
- Specify:
- What's wrong
- Home Assistant version
- CLP custom-integration version
- Configuration (without sensitive data)
- Logs
- Telegram Group https://t.me/smarthomehk
- Ubuntu 24.04
- Home Assistant Container 2025.6.1