This is a custom integration used to scrape data from a smarthub portal (used by different energy providers), and create an energy usage sensor in Home Assistant. The sensor can then be used with the Energy dashboard.
Clone this repository in your home assistant's custom_components
directory:
git clone git@github.com:gagata/ha-smarthub-energy-sensor.git
You can use the following shortcut
Or add the custom repository to your HACS installation:
- Copy the repository address:
https://github.com/gagata/ha-smarthub-energy-sensor.git
- Add the repository as custom repository in HACS: HACS -> click on 3-dot menu -> Custom Repositories -> Paste the URL and pick "Integration" and click "ADD"
- Go to HACS and search for
SmartHub Coop Integration
and click "Download"
Go to Settings > Devices & services and click +Add integration, and search for Smarthub.
The wizard will ask for:
- email address used to log in to the portal
- user password
- host (most likely
<your_provider>.smarthub.coop
) - your account id (taken from the billing)
- your location id (instruction below)
- poll interval (in minutes, 12 hours by default)
Getting the location id
- This value can be retrieved using
Network
tab in Developer Tools in your browser. - Navigate to Usage Explorer page, find a call to
services/secured/utility-usage/poll
in theNetwork
tab. - Open the call, and copy the
serviceLocationNumber
field from thePayload
tab.
- The API provides data with a delay, the integration just reports the current total for the unbilled period
- The integration currently only sets the usage (doesn't set the cost sensor)
- It hardcodes to only lookup
ENERGY
data (no gas information)
Thanks @tedpearson for his go implementation which inspired this integration.
Nope, and I don't intend to, as I genuinely despise Python. Feel free to use as is, but I'll also happily accept PRs to make this thing better :)