Hey folks, I’m trying to set this up on my home assistant yellow and I’m having the same SSL issue that has been reported. I’ve skimmed the thread (it’s long :D), and seen what others are doing… so here’s my setup (hopefully I’m not missing something):
I’ve got the smart meter connected to my wifi and added the LFDI and relevant data to my XCel account
I manually copied the scripts from the relevant /addons_config/
directory, made a directory under /config
called /certs
and put them there.
I used the native MQTT integration from HASS, currently it shows no devices or entities
I created a directory under config called xcelcerts and created an openssl.conf file in that directory. Here’s the contents of that conf file:
openssl_conf = openssl_init
[openssl_init]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
Options = UnsafeLegacyRenegotiation
I created a command_line.yaml
in the config directory, and it’s contents are (copied from another post in this thread):
command_line:
- sensor:
unique_id: xcel_meter_power
name: "Smart Electric Meter Power"
command: "OPENSSL_CONF=/config/xcelcerts/openssl.conf /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://192.168.198.11:8081/upt/1/mr/1/r --cert /config/certs/cert.pem --key /config/certs/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
- sensor:
unique_id: xcel_meter_consumption
name: "Smart Electric Meter Consumption"
command: "OPENSSL_CONF=/config/xcelcerts/openssl.conf /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://192.168.198.11:8081/upt/1/mr/3/r --cert /config/certs/cert.pem --key /config/certs/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: 86400
scan_interval: 5
command_timeout: 5
- sensor:
unique_id: xcel_meter_productiion
name: "Smart Electric Meter Production"
command: "OPENSSL_CONF=/config/xcelcerts/openssl.conf /usr/bin/curl --ciphers ECDHE-ECDSA-AES128-CCM8 --insecure --url https://192.168.198.11:8081/upt/1/mr/2/r --cert /config/certs/cert.pem --key /config/certs/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: 86400
scan_interval: 5
command_timeout: 5
I added the line to the bottom of my configuration.yaml
:
command_line: !include command_line.yaml
I still get the SSL error and I’m confused as to why. Can anyone help? Is there a single, comprehensive write-up for this somewhere that covers everything step by step?
Here’s the exact error output from the add-on logs tab:
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-xcel-itron-mqtt: starting
[16:24:32] INFO: Initializing Xcel iTron2MQTT
s6-rc: info: service init-xcel-itron-mqtt successfully started
s6-rc: info: service xcel-itron-mqtt: starting
s6-rc: info: service xcel-itron-mqtt successfully started
s6-rc: info: service legacy-services: starting
[16:24:33] INFO: Starting Xcel iTron2MQTT
s6-rc: info: service legacy-services successfully started
Connected to MQTT Broker!
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 1046, in _create
self.do_handshake()
File "/usr/local/lib/python3.12/ssl.py", line 1321, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate (_ssl.c:1000)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='192.168.198.11', port=8081): Max retries exceeded with url: /sdev/sdi (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate (_ssl.c:1000)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/xcel_itron2mqtt/main.py", line 79, in <module>
meter = xcelMeter(INTEGRATION_NAME, ip_address, port_num, creds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/xcel_itron2mqtt/xcelMeter.py", line 67, in __init__
details_dict = self.get_hardware_details(hw_info_url, hw_info_names)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/xcel_itron2mqtt/xcelMeter.py", line 97, in get_hardware_details
x = self.requests_session.get(query_url, verify=False, timeout=4.0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='192.168.198.11', port=8081): Max retries exceeded with url: /sdev/sdi (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate (_ssl.c:1000)')))
[16:24:38] INFO: Service Xcel iTron2MQTe exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service xcel-itron-mqtt: stopping
s6-rc: info: service xcel-itron-mqtt successfully stopped
s6-rc: info: service init-xcel-itron-mqtt: stopping
s6-rc: info: service init-xcel-itron-mqtt successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
Even after I overcome the SSL error, do I need to add things to MQTT?