Sense-exporter is a Prometheus exporter for Sense Energy Monitor power usage data.
The Sense API that this tool relies on is unofficial and unsupported by Sense. This repo has no affiliation with Sense. This code could stop working at any time.
Device-specific metrics are tagged with device_id, make, model, monitor, name, type:
sense_device_wattsis the current power consumption of a Sense-detected or -integrated devicesense_device_activedescribes whether a Sense-integrated device is currently active (0 or 1)sense_device_onlinedescribes whether a Sense-integrated device is currently online (0 or 1)
Sense-detected devices are the devices Sense has discovered by analyzing its power usage. Sense-integrated devices are devices Sense has identified through an integration with a service such as Hue. I'm just making these terms up, but that's what appears to be the case.
Monitor-specific devices are tagged with monitor:
sense_monitor_hzis the current mains frequency measured by the monitorsense_monitor_upis 1 while the exporter is able to collect data from a monitorsense_monitor_voltsis the current voltage measured at each of the monitor's leads (tagged withchannel)sense_monitor_wattsis the current total power consumption measured by the monitor (sense_device_wattsshould sum to this number)sense_scrape_time_secondsis how long it took for the exporter to collect these metrics for the monitor
sense-exporter --sense-config=config.yaml
sense-exporter --sense-email=you@example.com --password=s3cr3t
Configuration is described more fully below.
Sense-exporter can be configured with a YAML configuration file, command-line flags, or environment variables. If a config file is used, all other configuration is ignored.
Usage: sense-exporter -sense-config <filename>
The config file is structured like this:
accounts:
- credentials:
email: you@example.com
password: secretMultiple accounts can be configured in this way.
The full list of options available under credentials:
emaildefines a literal e-mail addressemail-fromreads the e-mail address from the given filepasswordpassword-frommfa-fromreads the MFA code from the given file (for accounts that require MFA)mfa-commandexecutes the given command and expects an MFA code as its output
If no config file is provided, the following flags can be used, which operate exactly as the YAML properties described above:
-sense-email-sense-email-from-sense-password-sense-password-from-sense-mfa-from-sense-mfa-command
If no config file is provided, these environment variables will be used for any fields not set by a flag:
SENSE_EMAILSENSE_EMAIL_FROMSENSE_PASSWORDSENSE_PASSWORD_FROMSENSE_MFA_FROMSENSE_MFA_COMMAND