How wayne-willey/ha-emerald-ems works
Emerald EMS is a Home Assistant integration that authenticates an account, lets the user select a metering device, then polls Emerald’s cloud and exposes live sensors while importing completed hourly energy and cost statistics. The graph also includes device diagnostics and the recorder as distinct product capabilities. Edges follow the excerpts or README; unsampled behavior is represented only where documented, and no tests or delivery tooling are included.
Main entry points: coordinator.py Polling coordinator · api.py Emerald API client · __init__.py Integration setup · sensor.py Live sensors
Components 13
Account setup
- Account and device flow
custom_components/emerald_ems/config_flow.py - Integration setup
custom_components/emerald_ems/__init__.py
Cloud polling
- Emerald API client
custom_components/emerald_ems/api.py - Payload models
custom_components/emerald_ems/models.py - Polling coordinator
custom_components/emerald_ems/coordinator.py - Integration constants
custom_components/emerald_ems/const.py
Home Assistant output
- Live sensors
custom_components/emerald_ems/sensor.py - Device entity base
custom_components/emerald_ems/entity.py - Hourly statistics import
custom_components/emerald_ems/statistics.py
Diagnostics
- Redacted diagnostics
custom_components/emerald_ems/diagnostics.py
Other components
- Home Assistant user
- Emerald cloud API
- Home Assistant recorder
Connections 14
- Home Assistant user → Account and device flow: configures account
README.md - Account and device flow → Emerald API client: validates credentials
custom_components/emerald_ems/config_flow.py - Emerald API client → Emerald cloud API: sends API requests
custom_components/emerald_ems/api.py - Emerald API client → Payload models: parses responses
custom_components/emerald_ems/api.py - Integration setup → Emerald API client: creates client
custom_components/emerald_ems/__init__.py - Integration setup → Polling coordinator: starts polling
custom_components/emerald_ems/__init__.py - Integration setup → Live sensors: forwards sensor setup
custom_components/emerald_ems/__init__.py - Polling coordinator → Emerald API client: fetches energy
custom_components/emerald_ems/coordinator.py - Polling coordinator → Hourly statistics import: imports completed buckets
custom_components/emerald_ems/coordinator.py - Live sensors → Polling coordinator: reads polled data
custom_components/emerald_ems/sensor.py - Live sensors → Device entity base: extends device entity
custom_components/emerald_ems/sensor.py - Hourly statistics import → Home Assistant recorder: writes statistics
custom_components/emerald_ems/statistics.py - Redacted diagnostics → Polling coordinator: reads runtime data
custom_components/emerald_ems/diagnostics.py - Polling coordinator → Integration constants: uses polling settings
custom_components/emerald_ems/coordinator.py