core: ElkM1 not connecting after upgrade to 2023.6.2

The problem

The ElkM1 integration was no longer able to connect to the ElkM1 panel after upgrading to 2023.6.1. I have been watching #94198 and HA is still unable to connect to the ElkM1 panel after upgrading to 2023.6.2. I am getting the following message in the log:

Logger: elkm1_lib.connection Source: runner.py:179 First occurred: 11:35:38 AM (669 occurrences) Last logged: 12:13:49 PM Error connecting to ElkM1 ([SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1002)). Retrying in 60

What version of Home Assistant Core has the issue?

2023.6.2

What was the last working version of Home Assistant Core?

2023.5.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Elk M1

Link to integration documentation on our website

https://www.home-assistant.io/integrations/elkm1

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: elkm1_lib.connection
Source: runner.py:179
First occurred: 11:35:38 AM (669 occurrences)
Last logged: 12:13:49 PM
Error connecting to ElkM1 ([SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1002)). Retrying in 60

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Thank you! I manually updated the TLS version (after a backup), restarted HA, and re-enabled the integration. Everything seems to be working well again.

I am deeply grateful for the help and for the excellent integration!

side note: I think we could probably move the abort so manual config would update the existing entry to avoid the need to manually edit the config entry

diff --git a/homeassistant/components/elkm1/config_flow.py b/homeassistant/components/elkm1/config_flow.py
index ac7fc90333..d54d24505a 100644
--- a/homeassistant/components/elkm1/config_flow.py
+++ b/homeassistant/components/elkm1/config_flow.py
@@ -239,9 +239,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
         self, user_input: dict[str, Any], importing: bool
     ) -> tuple[dict[str, str] | None, FlowResult | None]:
         """Try to connect and create the entry or error."""
-        if self._url_already_configured(_make_url_from_data(user_input)):
-            return None, self.async_abort(reason="address_already_configured")
-
         try:
             info = await validate_input(user_input, self.unique_id)
         except asyncio.TimeoutError:
@@ -252,6 +249,12 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
             _LOGGER.exception("Unexpected exception")
             return {"base": "unknown"}, None
 
+        self._abort_if_unique_id_configured(
+            updates={CONF_HOST: info[CONF_HOST], CONF_PREFIX: info[CONF_PREFIX]}
+        )
+        if self._url_already_configured(_make_url_from_data(user_input)):
+            return None, self.async_abort(reason="address_already_configured")
+
         if importing:
             return None, self.async_create_entry(title=info["title"], data=user_input)
 
@@ -312,7 +315,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
                 await self.async_set_unique_id(
                     dr.format_mac(device.mac_address), raise_on_progress=False
                 )
-                self._abort_if_unique_id_configured()
                 # Ignore the port from discovery since its always going to be
                 # 2601 if secure is turned on even though they may want insecure
                 user_input[CONF_ADDRESS] = device.ip_address

There would have to be some other changes as well though since other callers are expecting _url_already_configured to run before validation.

Geeez… I don’t even know what XEP and TLS firmware is. Or where to check. I have hundreds of logic scripts and programming hanging off the elk integration. Sensors, entities and automation. This Elk HA integration is the backbone of my smarthome. I’m not doing any upgrade from 2023.5.4 until the developers know 100% what is going on/wrong here. I’d pay extra to have this Elk integration failsafe robust into the future… It’s really that important for me. Will follow the thread with interest. thanks for all the efforts to all concerned. W

Your XEP (or M1-XEP which is the ELK part #) is the ethernet module connected to your ELK alarm. Its firmware can be found using the ELK-RP software. If your ELK is that rooted into the smart home I would expect that you have the software. If not, you can go to elkproducts.com and sign up as an owner and it will let you download the software and any firmware for the hardware connected to it. If you rely on your alarm installation company for all programming related to the ELK, you should be able to contact them to find out your firmware version the M1-XEP.

TLS is a secure communication protocol for encrypting the traffic between devices, in this case between the ELK M1-XEP ethernet module and Home Assistant. TLS has different compatibilities depending on the firmware/software of a product. You cannot tell a software (Home Assistant) to make a link with a device (M1-XEP) with TLS 1.2 if that device only supports TLS 1.0. With ELK, the XEP firmware is going to determine which firmware it has - TLS 1.0 or TLS 1.2.

If the M1-XEP gets updated by the user and now requires TLS 1.2, that is not the HA integration creators responsibility. He created the integration following the practices of how TLS works and it is on us - the ones implementing the integration - to use the correct option when installing. If we update our hardware and it breaks the link, that is on us to re-install the integration to use the updated TLS version that our hardware now wants.

Now in your case, if everything was working fine before the update to 2023.6.1 broke it, then upgrading to 2023.6.2 should work just fine. The particular issue in this thread is that the OP updated his ELK control panel firmware and M1-XEP firmware (just like I did) and it broke the connection to HA because he previously had the integration setup to use TLS 1.0. He needs to redo the integration and select TLS 1.2, then his issue should be resolved.

Depending on how long ago he first set up his integration he may have all the correct naming conventions that are being used now (they have gone through some variations over the years). The zones used to be sensor.zone_001 and the lighting was light.light_001 and so forth. Now they actually populate with sensor.elkm1_(zone_name) and light.(light_name). I just had to update my automations and custom cards to reflect those since I had been procrastinating updating the naming schemes.

I just went ahead and removed the integration and re-added it, reconnected just fine. I have been using the ELK integration since day 1 pretty much and there were a lot of changes in the naming schemes and such that I was avoiding redoing. About 30 minutes or so of renaming some things in my dashboard and at least it is back to normal. Now I have to go and update the naming conventions in my Node Red automations.