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!
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.
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]+'
I read through the spec and put together the proper commands to generate your own certificate.
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"
This will give you cert.pem
and key.pem
valid for just under 3 years (which is the maximum valid length).
The LFDI is the first 40 characters of the SHA256 signature.
openssl x509 -noout -fingerprint -SHA256 -inform pem -in cert.pem | sed -e 's/://g' -e 's/SHA256 Fingerprint=//g' | cut -c1-40
I added this LFDI to my devices in Xcel and the certificates worked a few seconds later.
Currently have it pulling in on my Energy dashboard with:
sensor:
- platform: command_line
unique_id: xcel_meter_power
name: "Smart Electric Meter Power"
command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://192.168.1.39:8081/upt/1/mr/1/r --cert /config/c.pem --key /config/k.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
unique_id: xcel_meter_consumption
name: "Smart Electric Meter Consumption"
command: "/usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://192.168.1.39:8081/upt/1/mr/3/r --cert /config/c.pem --key /config/k.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
homeassistant:
customize:
sensor.smart_electric_meter_consumption:
device_class: energy
state_class: total_increasing
sensor.smart_electric_meter_power:
device_class: power
state_class: measurement
I used your earlier method of generating certs and Xcel Energy launchpad devices. I haven’t heard back from xcel yet so I don’t know if it works or not.
I’m going to try your new method, but I’m trying to get @SergeantScar 's LFDI working.
I posted a message just above yours. I can ssh into home assistant to execute these commands to get watts and kWh. But when I try to execute the same commands in configuration.yaml, I get an error that says Command failed (with return code 1): /usr/bin/curl
I don’t know why it doesn’t work. It looks just like yours.
[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 ~]$
configuration.yaml file:
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
Remove /root
That fixed it!!!
Thank you very much!!
I’ve spent two days googling and trying to figure this out.
Awesome, thank you, will backup my certs and give this a shot when I have a chance.
@pdups10,
The cut needs to be 18-58 to get past SHA1 Fingerprint= and leave you the 40 character fingerprint.
Can you edit it.
openssl x509 -noout -fingerprint -inform pem -in cert.pem | sed -e ‘s/://g’ -e ‘s/SHA256 Fingerprint=//g’ | cut -c18-58
Looks like some slight difference between openssl/libressl versions. Added the -SHA256
arg.
openssl x509 -noout -fingerprint -SHA256 -inform pem -in cert.pem | sed -e 's/://g' -e 's/SHA256 Fingerprint=//g' | cut -c1-40
Yes, I noticed that just now. Its a SHA1 instead of SHA256.
Your scripts make it simple and easy. Thanks!!
I uploaded to my new LFDI to xcel devices and it worked.
I fetched with @SergeantScar 's LFDI (first cURL below) and my own certs and LFDI (second cURL below)
[core-ssh xcelcerts]$ 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
<Reading
xmlns="urn:ieee:std:2030.5:ns"
href="/upt/1/mr/1/r">
<qualityFlags>01</qualityFlags>
<timePeriod>
<duration>1</duration>
<start>1676307749</start>
</timePeriod>
<value>742</value>
</Reading>
[core-ssh xcelcerts]$ curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://10.0.0.226:8081/upt/1/mr/1/r --cert /root/config/xcelcerts/myown/cert.pem --key /root/config/xcelcerts/myown/key.pem
<Reading
xmlns="urn:ieee:std:2030.5:ns"
href="/upt/1/mr/1/r">
<qualityFlags>01</qualityFlags>
<timePeriod>
<duration>1</duration>
<start>1676307760</start>
</timePeriod>
<value>745</value>
</Reading>
[core-ssh xcelcerts]$
I’ve been trying to get this up and running for the last couple days. I added my meter to my wifi network, found it on my controller, and locked it to a certain AP because it kept finding a further away one rather than a closer one with a better signal. It has now been on the network for 17hrs and I’ve generated a pair of keys and added it as an LFDI to my Xcel account, but cannot get any response from the meter on my network. I also don’t get a ping response from the meter either.
If I can get it up and running I’m looking at making a container to use the mDNS functionality to make it easier to find the meter and automate the process a bit more. Then I want to convert the API outputs from the meter and broadcast them via MQTT to more easily integrate the messages into HomeAssisstant.
This post is very helpful, but the homeassistant.customize
isn’t working for me, or at least it is not showing up in my energy dashboard.
So the Xcel site shows my meter is “Ready to Go” and I can see its IP on my network. However, I cannot seem to get the website to accept the registration. I have an LFDI based on pdubs10’s latest message, but I just keep getting an unsuccessful message. Does anybody have any thoughts?
UPDATE this appears to have been a temporary issue with the site.
I believe something is incorrect with my registration based on comments in this thread, but could someone confirm? I wasn’t ever prompted to set up my WIFI network when registering my meter and attempting to add a new device (using the LFID/certs above or generating my own) doesn’t work because I’m never prompted for the certificate itself. Am I missing a step or does something look incorrect?
Without changing anything with my registration, keys, LFDI, etc. I just received a new error message:
curl: (35) OpenSSL/3.0.8: error:0A000152:SSL routines::unsafe legacy renegotiation disabled
I’ll have to look into it later, but thats a lot more promising that zero response from the meter. Looks like registration might be taking a little longer right now?
I had that originally, I believe either incognito mode or deleting all of the cookies for that site fixed it for me.
Similar situation in Minneapolis. Did this ever update?