Integrating Xcel Energy Smart Meters into Home Assistant

This is an in progress post documenting my research to get to getting this into Home Assistant


Steps That Lead Me Here

  1. Got new Smart Meter
  2. Found this post in 2021: https://community.home-assistant.io/t/xcel-energy-itron-gen-5-riva/346943/264
  3. Forgot about it until I was messing with RTL 433 again
  4. Remembered my Smart Meter doesn’t use 433 anymore
  5. Found that same post again

Resources:

Pro to this is that seems to just be a “simple” Setup

Con can’t run in Home assistant or HASSOS

A PDF outlining some of the SDK of the ITron Riva Gen5 Smart Meter

The signup/configure page for adding your smart meter to your Wifi, and then telling Xcel which devices should be allowed to access it.

A Reddit post, outlining steps do do it all via curl in Home Assistant. I’m copy and pasting the post below since lately stuff on Reddit, disappears.

Finally got connected using a command_line sensor and it’s working like a charm! I don’t have to deal with peak/off-peak hours, but I’m curious what folks here do.

  1. Xcel installed a new smart meter over the summer
  2. Go to Xcel’s website and enroll in Launchpad
  3. Once your meter is connected to your wireless network, you’ll have to add Home Assistant device to launchpad.
  4. Create the cert and key you’ll use by running openssl req -x509 -nodes -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -keyout key.pem -out cert.pem -sha256 -days 1094 -subj '/CN=MeterReaderHanClient' -addext "certificatePolicies = critical,1.3.6.1.4.1.40732.2.2" -addext "keyUsage = critical,digitalSignature"
  5. To get the necessary LFDI (first 40 characters of the SHA256 signature), run the command openssl x509 -noout -fingerprint -SHA256 -inform pem -in cert.pem | sed -e 's/://g' -e 's/SHA256 Fingerprint=//g' | cut -c1-40
  6. In your Home Assistant /config directory, create an /xcel folder
  7. You’ll need three files, the cert.pem and key.pem you created from step 4, and an openssl.conf file (contents below).
  8. Either in your configuration.yaml or an included command_line.yaml file (my preference), put the sensors below
  9. Make sure your paths to openssl.conf, key.pem and cert.pem are accurate.
  10. Also make sure your IP address is typed correctly
  11. Restart Home Assistant and they should be valid entities to read. xcel_meter can be added to the Energy Dashboard in Settings -> Dashboard -> Energy -> Add consumption

openssl.conf

openssl_conf = openssl_init

[openssl_init]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
Options = UnsafeLegacyRenegotiation

command_line.yaml

- sensor:
    unique_id: xcel_meter
    name: Xcel Meter
    command: "OPENSSL_CONF=/config/xcel/openssl.conf /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://172.16.5.11:8081/upt/1/mr/3/r --cert /config/xcel/cert.pem --key /config/xcel/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    unit_of_measurement: "kWh"
    value_template: "{{ float(value) | multiply(0.001) | round(3) if is_number(value) }}"
    device_class: 'energy'
    state_class: 'total_increasing'
    scan_interval: 5 #in seconds
    command_timeout: 5 #in seconds
      
- sensor:
    unique_id: xcel_meter_load
    name: Xcel Meter Load
    command: "OPENSSL_CONF=/config/xcel/openssl.conf /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://172.16.5.11:8081/upt/1/mr/1/r --cert /config/xcel/cert.pem --key /config/xcel/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    value_template: "{{ float(value) if is_number(value_json) }}"
    unit_of_measurement: "W"
    device_class: 'power'
    scan_interval: 5 #in seconds
    command_timeout: 5 #in seconds


Reddit User: https://www.reddit.com/user/-eschguy-/