Updates to Konnected Integration

Hi Everyone. The Konnected team recently made some big changes to the Konnected integration to take advantage of the latest Home Assistant features and prep for the upcoming release of the Konnected Alarm Panel Pro.

The Konnected integration now supports…

  • discovery via ssdp
  • config and options flow based setup
  • device/entity registry

We’ve also migrated the integration and pypi module to full async. These changes were recently merged and will be available in the upcoming 0.106 beta release. Feel free to check them out and please let us know how things are working.

2 Likes

After applying the update, I get this message KeyError: 'access_token' from init.py. I can provide the full traceback if it would help.

That would be super useful - a quick code review didn’t expose anything. Creating a issue for this would also be a good idea.

I eventually got it working…sorta. I had rolled back to a snapshot and tried to recreate the error I was getting, but when I went to upgrade again, 0.106.0b1 was available. I installed that and no longer got the error. It’s worth noting though that my config still didn’t work. I had a YAML-based Konnected config in place that had been working fine, but it wasn’t recognized after the update again. I decided to try going through the UI to see if I might be able to get things working that way.

I initially got this error:
image
which I was able to get past by just retrying over and over. The reason I think I was getting that is that, after applying the update, my board was in a reboot loop. It would only stay up for about 1 minute at a time and then reboot. By retrying enough times, I think I caught it while it was still up.

From there, I was able to get to the config UI, where I listed out all of my zones as binary sensors. For each zone, I get this interface:
image

There’s no indication as to which zone I’m configuring, so I just assumed it started with 1 and went in order. Not a big deal, but it would be less confusing to have the zone being configured visible in that interface.

So, at this point, I have all of my sensors working, but only through using the GUI configurator. I’d really prefer to use YAML-based configs though. Can I now revert to using YAML since I’ve run through the GUI config? If so, how do I know which config it’s using?

I take it back. It turns out that if I try to use my existing YAML config, I consistently get this error now:

Logger: aiohttp.server
First occured: 2:52:07 PM (33 occurences)
Last logged: 2:53:31 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 417, in put
    return await self.update_sensor(request, device_id)
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 308, in update_sensor
    for entry in hass.config_entries.async_entries(DOMAIN)
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 308, in <listcomp>
    for entry in hass.config_entries.async_entries(DOMAIN)
KeyError: 'access_token'

Thanks for posting this. Really helpful!

Any chance you can share your configuration.yaml (at least the konnected portion)?

Here you go:

  access_token: arandomstringvalue
  api_host: http://192.168.86.32:8123 #IP address of Home Assistant
  devices:
    - id: 98f4abb25e3a  
      binary_sensors:
        - zone: 4
          type: motion
          name: 'Hallway Motion'
        - zone: 5
          type: window
          name: 'Master Bedroom Window'
        - zone: 6
          type: window
          name: 'Downstairs Windows'
      switches:
        - zone: out
          name: 'siren'
    - id: 60019406b9d6  
      #host: '192.168.86.117'
      #port: 8440
      binary_sensors:
        - zone: 1
          type: window
          name: 'Glass Break Sensor'
        - zone: 2
          type: door
          name: 'Back Door'
        - zone: 3
          type: door
          name: 'Side Door'
        - zone: 4
          type: door
          name: 'Front Door'
        - zone: 5
          type: motion
          name: 'Living Room Motion'
        - zone: 6
          type: window
          name: 'Upstairs Windows'
      switches:
        - zone: out
          name: 'Buzzer'
          momentary: 65
          pause: 55
          repeat: 4

The bad news is that I now have the Konnected config line in my configuration.yaml commented out, but I still get the same error (KeyError: ‘access_token’):

#konnected: !include configs/konnected.yaml

I even deleted the Konnected integration and went back through the GUI process to recreate it and still get the same error.

After a HASS restart I’m seeing this error:

Log Details (ERROR)
Logger: homeassistant.core
First occured: 3:48:55 PM (1 occurences)
Last logged: 3:48:55 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 109, in async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 172, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 240, in async_step_ssdp
    user_input={CONF_HOST: netloc[0], CONF_PORT: int(netloc[1])}
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 269, in async_step_user
    return await self.async_step_confirm()
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 294, in async_step_confirm
    entry.data[CONF_HOST] != self.data[CONF_HOST]
KeyError: 'host'

Looking into this and attempting to recreate. Will comment once I know more.

1 Like

@ryanm7780 I did some testing on my end and wasn’t able to reproduce the KeyError issues you’re seeing but I did find some other weirdness I’m fixing.

I suspect you have some config entry records in a bad state. Potentially from the repeated attempts to configure during the reboot loop.

To get things back to a known good state please delete any Konnected integrations listed as “Configured” in <your_ha_host>/config/integrations/dashboard.

After that - restart your HA instance. This should cause the Konnected integration to attempt to import the Konnected config from your configuration.yaml. Since your configuration.yaml doesn’t specify host/port info the integrations screen will likely show 4 Konnected integrations. The first two listed should be the imported ones, the second two will be from ssdp discovery.

Complete setup of the first two (the ones requiring you to enter host info) and the other 2 will disappear.

If you encounter anymore errors please share the traceback and any steps leading up to the error. Meanwhile I’ll be submitting some fixes for the other things I found.

Thanks Kit. I deleted the integration and started over as you specified and it worked ok for a few minutes. I then stopped getting notifications from the sensors and just scrapped the whole YAML config and started over. Now I only have the config done through the UI (no YAML config at all), but I’ll still getting this error:

Logger: homeassistant.core
First occured: 10:45:01 AM (1 occurences)
Last logged: 10:45:01 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 109, in async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 172, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 240, in async_step_ssdp
    user_input={CONF_HOST: netloc[0], CONF_PORT: int(netloc[1])}
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 269, in async_step_user
    return await self.async_step_confirm()
  File "/usr/src/homeassistant/homeassistant/components/konnected/config_flow.py", line 294, in async_step_confirm
    entry.data[CONF_HOST] != self.data[CONF_HOST]
KeyError: 'host'

And still these too. Even with no YAML. Very strange.

Logger: aiohttp.server
First occured: 10:45:24 AM (55 occurences)
Last logged: 10:48:08 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 417, in put
    return await self.update_sensor(request, device_id)
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 308, in update_sensor
    for entry in hass.config_entries.async_entries(DOMAIN)
  File "/usr/src/homeassistant/homeassistant/components/konnected/__init__.py", line 308, in <listcomp>
    for entry in hass.config_entries.async_entries(DOMAIN)
KeyError: 'access_token'

Thank you again for your help in getting this resolved, @kit-klein. In case anyone runs across a similar issue, this ended up being a bug related to the fact that I had ignored one of the Konnected boards on my network. (There are 3). Ignoring one of them created an invalid entry in core.config_entries which was causing the issues with the other two Konnected boards.

It sounds like Kit is going to get a fix for the ignore bug into 107.

Thanks again!

Thanks for being an early tester @ryanm7780. I’ve been following this, because I have a Konnected interface module (wish I had bought more before they sold out) that is critical for most of my light automations using wired contact and motion sensors. It works great!

When the final version rolls out, does it require you to know the port of the Konnected board? My understanding was that it changes for security reasons. I ran a port scan on my board to find it, so I can do that if required, but hopefully it detects it.

The old interface board is working so well, I will probably plan on upgrading to the new board and interface modules when available.

It actually detected everything for me and I had very little configuration to do. The new GUI-based config works great, but I’ll probably still keep everything in YAML, just because I like being able to version things that way, etc.

And I 100% agree with you. I have three Konnected boards and couldn’t be happier with them. I’m excited for the new Pro model to ship. It’ll be great to have hard-wired ether and PoE.

1 Like

I update HA Core to 0.106.0 earlier today and immediately started running into problems with the Konnected integration. The only mention of to Konnected in the release notes appears to apply to beta branch but there are breaking changes in the released version that are not well explained or documented.

First, I found that I had to go through the forced new config and options flow. Then I found some lost functionality with this approach as I could only set up one type of switch for a buzzer. In the old YAML configuration you could set up multiple switches on the same zone (e…g, beep once, beep twice, beep continuous). I don’t know how to get these features back up and running. Have reverted to 0.105.5 for now but it seems like more work needs to be done before these changes are published.

I just upgraded from 105.5 to 106, and everything went smoothly for me. I did get a notice that new devices were detected, and that led me to the new Konnected integration. It prompted me for both my IP address and the port number of the Konnected board. I keep track of all of my IP addresses, and I did a port scan to locate the port, so I was able to enter both, and the integration added all of my devices.

For those with Macs, there is a built-in port scanner:
Press Command-Spacebar to bring up Spotlight and enter “Network Utility”. Press Return to launch the Network Utility:

image

Choose the Port Scan tab, Enter the IP address of the Konnected board, and click Scan.

This should find one open port and will be the one needed to setup the integration.

the konnected team made the changes, so i would suggest you work with them to find out what is wrong

@sbowater I think you may have exploited an unexpected feature in the old configuration.yaml. If you DM me your old configuration.yaml I’ll look into what’s going on and see how we can help.