Green Button Connect smart home integration, free and open source

Imports your electricity use from Green Button utilities (PG&E, SCE, SDG&E, Hydro One…)
Imports into Gladys the electricity consumption that your utility publishes through Green Button Connect My Data, the North American standard (NAESB ESPI) offered by PG&E, SCE, SDG&E, Toronto Hydro, Hydro One and many other utilities in the United States and Canada.
Each electricity meter of your subscription becomes a device in Gladys. Its consumption is stored per 30-minute slot (or per day, for meters read once a day), dated with the reading time: Gladys computes its cost with your energy contract and shows it in the energy dashboards.
Before you start
Green Button Connect My Data works by authorizing an application at your utility. Every utility runs its own portal (the "Data Custodian"):
- On your utility's Green Button / "Share My Data" portal, register a third-party application for Gladys. Depending on the utility, it is a self-service form or a request to their Green Button team.
- The utility gives you: a client ID, a client secret, the authorization URL and the token URL of its OAuth 2.0 server, and the scope of the data (a text like
FB=1_3_4_5_13_14_39;IntervalDuration=900;...). - The utility asks for a redirect URI: it is the address of Gladys the utility sends you back to. Click Connect once (see below): the authorization page of the utility shows it in the
redirect_uriparameter of its address. Register that one.
Some utilities and Green Button data hubs give you an access token and a subscription URL directly: then you can skip the Connect button (see "Without the Connect button").
Installation
- In Gladys, open Integrations, then the external integrations store.
- Search for Green Button Connect and click Install.
- Wait for the container to start: the integration shows up in the list.
Configuration
Open the Configuration tab of the integration:
- Authorization URL, Token URL, Client ID, Client secret, Scope: the values of your registration. Save.
- Utility account: click Connect, sign in on the utility's site and authorize Gladys. Back in Gladys, the status turns to connected and the first synchronization starts.
- Without the Connect button: fill in Subscription URL (the ESPI
Batch/Subscriptionaddress) and Access token instead. The subscription URL also overrides the one the utility returns on connection. - History to import (days): how far back the first synchronization reads (30 days by default, 365 at most).
- Synchronization interval (hours): utilities publish the readings hours or days late, every 6 hours is enough.
- Daily alert threshold (kWh): a day above it fires the "Daily consumption above the threshold" trigger (0 disables it).
The Synchronize now button reads the utility immediately, over the number of days you choose: use it to import an older history.
Usage
After the first synchronization, open the Discovery tab of the integration and add your meter. Its history is then published, and every synchronization adds the new readings.
- A meter read every 5, 15 or 60 minutes carries a 30-minute consumption feature (an hourly reading is split into two equal halves).
- A meter read once a day carries a daily consumption feature.
- Gladys derives the cost from your energy contract: create one in the energy settings and attach it to the meter.
Only the electricity delivered to the home is imported: gas meters and the energy exported by a solar installation are not.
Scenes and dashboards
Triggers
- New consumption data: the utility published new readings of a meter. Variables: meter name, last complete day, its consumption (kWh) and cost, end of the last reading.
- Daily consumption above the threshold: a complete day exceeded the threshold of the configuration. Variables: meter name, day, consumption, threshold.
- Utility connection lost: a synchronization failed after a successful one, filterable by reason (authorization refused, service unavailable).
Actions
- Synchronize Green Button: reads the utility now. Outputs: meters found, intervals published, end of the last reading.
- Get the last day's consumption: for a meter (the first one when left empty). Outputs: day, consumption (kWh), cost, last 7 days (kWh), end of the last reading — for example to send "Yesterday: 23.4 kWh" in a message.
Widget
- Green Button usage: consumption of the last day and of the last 7 days, cost of the day when the utility provides it, daily bars of the last two weeks, last reading, connection state and a Refresh button. Choose the meter in the widget settings (the first one by default).
Privacy
The integration only talks to your utility's servers. The tokens are stored in the Gladys configuration and never written to the logs.
Help
A question or a problem? Ask on the Gladys community forum or open an issue on the GitHub repository.
Configuration settings
These are the settings Green Button Connect asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Register Gladys with your utility | section | No | Green Button Connect My Data lets your utility send your meter readings to an application you authorize. Register Gladys as a third-party application on the utility's Green Button portal: it gives you a client ID, a client secret, the authorization and token URLs and the scope. When you click "Connect", the authorization page shows the redirect address of Gladys in its redirect_uri parameter: it is the one to register with the utility. |
| Authorization URL | string | No | OAuth 2.0 authorization endpoint of the utility's Data Custodian. |
| Token URL | string | No | OAuth 2.0 token endpoint of the utility's Data Custodian. |
| Client ID | string | No | |
| Client secret | secret | No | |
| Scope | string | No | The Green Button scope given at registration (function blocks, interval, history). |
| Utility account | oauth2 | No | Save the fields above first, then connect and authorize Gladys on the utility's site. |
| Without the Connect button | section | No | Some utilities and Green Button data hubs hand out an access token and a subscription URL directly. Fill them in here instead of connecting. The subscription URL also overrides the one the utility returns on connection. |
| Subscription URL | string | No | |
| Access token | secret | No | |
| Synchronization | section | No | Utilities publish the readings hours or days late: the integration reads them on a schedule and dates every interval. |
| History to import (days) | number | No | Read on the first synchronization and when a meter is added. |
| Synchronization interval (hours) | number | No | |
| Daily alert threshold (kWh) | number | No | A day above it fires the "Daily consumption above the threshold" trigger. 0 disables it. |
How to install Green Button Connect in Gladys
- In Gladys, open Integrations: Green Button Connect appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/prohand/gladys-green-button-connect:1.1.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/prohand/gladys-green-button-connect.
Green Button Connect requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Green Button Connect is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by prohand, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation