Xcel Energy ITron Gen 5 Riva

Hi – friend and I were looking at ours and troubleshooting here in Denver. It appears as if the meter goes into powersave/sleep mode very quickly, which we’re guessing is why it often shows as disconnected on Xcel’s website.

In the documentation, it looked as if there are references to url’s that function as a ‘keep alive’ url

This is how me and my buddy made this work in Homeassistant:

The steps highlighted by pdubs10 helped a lot. But it seemed like the generated certificate was not compatible with our meters. We took a shortcut and used a cert/key provided as an example on the Xcel SDK site. We have been successfully polling our meter for the past few days, without any issues.

Here are the steps to pull data into HA:

  1. Add the following LFDI on your utilities website: 58F371CB4CF0FC393B459559576904D1F7E338EE

  2. Create cert.pem (contents below)

  3. Create key.pem (contents below)

  4. Create a CLI Sensor in HomeAssistant

    • platform: command_line
      unique_id: elecmerter
      name: “Elec meter”
      command: ‘/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://HOST_IP:8081/upt/1/mr/3/r --cert /FILE_PATH/cert.pem --key /FILE_PATH/key.pem 2>&1 | grep -oPm1 “(?<=)[^<]+”’
      scan_interval: 91
      command_timeout: 16
  5. To test if the cert and key are able to communicate with your meter, open the HA ssh addon.
    5a) run the following command: curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure -v --url https://HOST_IP:8081/upt --cert /FILE_PATH/cert.pem --key /FILE_PATH/key.pem
    5b) < HTTP/1.1 200 OK response means it worked, you can follow the HREF chain to find data based on your meter version.

cert.pem File:
-----BEGIN CERTIFICATE-----
MIIBXjCCAQOgAwIBAgIJAK7D1P+OutH1MAoGCCqGSM49BAMCMBwxGjAYBgNVBAMM
EUhBTkFnZW50U2ltdWxhdG9yMB4XDTIyMDcyMDIzMDgzM1oXDTM0MDcyMDIzMDgz
M1owHDEaMBgGA1UEAwwRSEFOQWdlbnRTaW11bGF0b3IwWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAARUAkP91eEmI17OmpXCnT5owCy4YaVaKQJGc9C95xDLKNNVgI3p
9NBs5z1W5BpTQrrUeywcOov0sSmdRdHUsQeAoy4wLDAOBgNVHQ8BAf8EBAMCB4Aw
GgYDVR0gAQH/BBAwDjAMBgorBQEEAYLGMwEBMAoGCCqGSM49BAMCA0kAMEYCIQCr
+o3pClk7IZj7QI+4SveL1qJJk2gA+vgyiPwuHVwEyAIhAPBLhxGn/qJUAArtNftz
+BSapy7ghQpZNIU8dW9lOKl5
-----END CERTIFICATE-----

key.pem File:
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgW/+d+GstSyV5rgn3
8gRaZdSzd45LC59qH50u+87YMGigCgYIKoZIzj0DAQehRANCAARUAkP91eEmI17O
mpXCnT5owCy4YaVaKQJGc9C95xDLKNNVgI3p9NBs5z1W5BpTQrrUeywcOov0sSmd
RdHUsQeA
-----END PRIVATE KEY-----

2 Likes

where do the cert and key files get saved in HA? is there a specific file path/folder where they would need to be? Can they be created through the file editor in HA? Thank you for any help.

No specific path requirements, I have them saved in the /config directory and added that directory to configuration.yaml:

homeassistant:
allowlist_external_dirs:
- /config

Yes, the cert and key file can be created via File Editor in HA.

1 Like

Got this to work finally. I’m running on a Raspberry Pi, so might be some differences. The command_line sensor command wouldn’t work for me with the “grep -oPm1”, as “P” wasn’t recognized. I had to change me command to the following:

sensor:
  - platform: command_line
    unique_id: elecmerter
    name: “Xcel meter”
    command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://METER_IP:8081/upt/1/mr/3/r --cert /config/cert.pem --key /config/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    scan_interval: 91
    command_timeout: 16

I’m not a smart coder man, so there may be better ways, but this got it to work. May do a bit more tinkering, but this is pulling the “value” tag.

4 Likes

Just a head’s’ up that there’s been some decent updates to SDK on GitLab:

https://gitlab.com/xcel-energy-launchpad/energy-launchpadsdk-client/-/blob/main/GettingStarted.md

A lot more information now available than I’ve seen previously, just starting to read.

…including nice documentation on Riva Gen5

https://gitlab.com/xcel-energy-launchpad/energy-launchpadsdk-client/-/blob/main/docs/Itron_SDK_Xcel_2030.5_Metering.pdf

1 Like

I used the above to pull into the Energy Dashboard, and for some reason comparing hourly consumption with the Xcel website my numbers (energy dashboard) were all double what was reported on the Xcel site.

Haven’t done the experiment yet, but wondering what the difference between “https://METER_IP:8081/upt/1/mr/3/r” and “https://METER_IP:8081/upt/1/mr/2/r” might be based on this site: https://gitlab.com/xcel-energy-launchpad/energy-launchpadsdk-client/-/blob/main/docs/meterReadingList.xml

for now I’ve modified my config file for the command line sensor to basically divide the number by 2 to get closer.

sensor:
  - platform: command_line
    unique_id: xcel_meter
    name: Xcel Meter
    command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://METER_IP_ADDRESS:8081/upt/1/mr/3/r --cert /config/cert.pem --key /config/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    unit_of_measurement: "kWh"
    value_template: "{{ value | multiply(0.0005) | round(1) }}"
    scan_interval: 91
    command_timeout: 16

also… the process of getting the different tariffs working is a real pain… hopefully some of this helps.

edit… derp. just read the PDF Brendan linked. the upt/mr/2/r would show how much you have delivered to the meter…

Have you put the data into a utility meter helper and then applied the tariffs there?

Yeah. I used the utility helper. My understanding is after that I needed to create an automation which would change the “select.UtilityMeter” helper to the right tariff at the right time… then create another variable that changes the price at the same time… At this point, when the utility meter helper produces the different tariff meters, and then loading those into the energy monitor, I most likely could have gotten away with a static price for each tariff, but all the guides said I needed a variable price sensor. It certainly wasn’t very clear.

For the life of me I cannot get a curl command to return anything other than a 404 Not Found.

Connection accepted, TLS handshake negotiated, but…can’t find anything at reasonably known resource locations documented in GitLab documentation or posted in this thread…

Any advice?

bash> curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --verbose --url "https://10.0.0.232:8081/upt/0/mr?s=0&l=10" --cert cert.pem --key key.pem
*   Trying 10.0.0.232:8081...
* TCP_NODELAY set
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 10.0.0.232
 (10.0.0.232) port 8081 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ECDHE-ECDSA-AES128-CCM8
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [248 bytes data]

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [82 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [1803 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [148 bytes data]
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
{ [12 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
} [7 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-CCM8
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: [NONE]
*  start date: Aug 15 19:48:31 2021 GMT
*  expire date: Dec 31 23:59:00 9999 GMT
*  issuer: C=US; O=Itron; CN=IEEE 2030.5 MICA; serialNumber=7
*  SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
} [5 bytes data]
> GET / HTTP/1.1
> Host: 10.0.0.232:8081
> User-Agent: curl/7.68.0
> Accept: */*
> 
{ [5 bytes data]
* Mark bundle as not supporting multiuse
< **HTTP/1.1 404 Not Found**
< Date: Fri, 27 Jan 2023 20:26:42 GMT
< Content-Length: 0
< 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

Anything at /upt? On mine the ID is not 0.

Can you try running the CURL from the Terminal & SSH addon and not bash?

And yes, try just /upt and see it gives you a HREF

The Bash prompt is from command line on my Ubuntu box (running Docker version of HA, so no Terminal add-on). It’s where I’m finding the HTTP/1.1 404 Not Found error.

Also getting 404 with /upt.

I used self-signed cert creation / LFDI as @pdubs10 noted above.

Input that LFDI on Xcel’s site.

At first I was getting a connection refused, as was expected, until the Meter was updated with LFDI.

Days later I started to be able to connect using the cert, but I’ve only gotten the 404 error on response. Looks like handshake is fine / cert recognized … just doesn’t appear to be a resource.

Can someone post sample output that is what should be expected from this curl command?

The method provided by pdbus10 did not work for me. The only certificate that worked was the one I posted. Use that and see how it goes.

Supposed to get the Itron smart meter in a month, and I have rooftop solar, so I’m very interested in an HA integration. I’m a former dev, but significantly out of date, so although I’ve done a little Python that Github project scared me off. By the time I could conceivably figure it all out, surely someone will have a working integration.

Look up above. We have posted a working solution.

1 Like

Does this “pending” status eventually change or do I have to do something manually? My Itron smart meter was installed four days ago in Minneapolis. Thanks!

@seasideCT

Just so we’re all clear the solutions you’re referring to is in the 65 by SergeantScar and the post he quoted, correct? I have one of these meters in Denver hooked up to wifi and a Pi so may complete this soon. Will post results.

@cmb and everyone else looking at this thread

See the post above by @sss2400 that walks through step-by-step, he took the time to lay it out. Works great, I’ve been running it since early Jan with no interruptions and the reporting is within 99% of what Xcel reports.

If someone wants to take the time to make this into an integration and figure out a better way to dynamically create a certificate that works, by all means please do. But in the interim I can tell you with certainty that this works. The latest update to HA allows you to select an energy conversion for watts to kilowatt hours so there is now no need to create a separate template sensor.

3 Likes

I’m unable to get sensors working so I can monitor Xcel Smart Meter Energy readings for W and kWh.

I enrolled in Xcel Energy Launchpad and have LFDI 58F371CB4CF0FC393B459559576904D1F7E338EE installed and working with these cURL commands to extract kWh and Watts.

I ssh into home assistant to execute these commands to get watts and kWh.

[core-ssh ~]$ curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/1/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>'  2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'
863
[core-ssh ~]$ curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/3/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'
10722340
[core-ssh ~]$ 

I’ve added this to configuration.yaml because I think that’s how I’m supposed to get a sensor for W and kWH.

sensor:
  - platform: command_line
    name: "Smart Electric Meter Power"
    command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/1/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    unit_of_measurement: "W"
    #device_class: 'power'
    scan_interval: 5
    command_timeout: 5

  - platform: command_line
    name: "Smart Electric Meter Consumption"
    command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/3/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'"
    unit_of_measurement: "kWh"
    value_template: "{{ value | multiply(0.001) | round(3)}}"
    #device_class: 'energy'
    #state_class: 'total_increasing'
    scan_interval: 5
    command_timeout: 5

When home assistant restarts I get this error:

Logger: homeassistant.components.command_line
Source: components/command_line/__init__.py:48
Integration: command_line (documentation, issues)
First occurred: 12:32:33 PM (12 occurrences)
Last logged: 12:33:11 PM

Command failed (with return code 1): /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/1/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'
Command failed (with return code 1): /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/3/r --cert /root/config/xcelcerts/cert.pem --key /root/config/xcelcerts/key.pem 2>&1 | grep -o '<value>.*</value>' | grep -Eo '[0-9]+'