Konnected Alarm Panel - connect a wired alarm system to HA new in 0.70

Not too sure to be honest. I’ll have a look how other components do this.

I’m a bit of a novice with Python and GitHub but if I can work it out I’ll put through a PR.

Anyone ever have a problem with switches? I did have the alarm and buzzer working reliably but now they are not working, all sensors are working flawlessly. Running latest hass.io

Log below

Log Details (ERROR)
Mon Dec 31 2018 09:28:51 GMT+1030 (Australian Central Daylight Time)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 277, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/switch/konnected.py", line 73, in turn_on
    resp = self.client.put_device(
AttributeError: 'NoneType' object has no attribute 'put_device'

Config

konnected:
  access_token: <removed>
  devices:
    - id: <removed>
      binary_sensors:
        - zone: 1
          type: door
          name: 'Front Door'
        - zone: 2
          type: motion
          name: 'Front Room Motion'
        - zone: 3
          type: motion
          name: 'Hallway Motion'
        - zone: 4
          type: motion
          name: 'Living Room Motion'
        - zone: 5
          type: motion
          name: 'Rumpus Motion'
      switches:
        - zone: out
          name: Siren
    - id: <removed>
      binary_sensors:
        - zone: 1
          type: garage_door
          name: 'Right Shed Door Toggle'
        - zone: 2
          type: window
          name: 'Front Window'
        - zone: 3
          type: window
          name: 'Master Bedroom Windows'
        - zone: 4
          type: window
          name: 'Guest Bedroom Windows'
      switches:
        - zone: 5
          name: Right Garage Door
          momentary: 500
          activation: high
        - zone: 6
          name: Left Garage Door
          momentary: 500
          activation: low
        - zone: out
          name: Warning
          momentary: 65
          pause: 55
          repeat: -1
        - zone: out
          name: 'Beep Beep'
          momentary: 65
          pause: 55
          repeat: 4
    - id: <removed>
      binary_sensors:
        - zone: 1
          type: door
          name: 'Rumpus Door'
        - zone: 2
          type: window
          name: 'Dining Windows'
        - zone: 3
          type: door
          name: 'Sliding Door'
        - zone: 4
          type: door
          name: 'Laundry Door'
        - zone: 5
          type: window
          name: 'Living/Kitchen Windows'
        - zone: 6
          type: window
          name: 'Laundry/Bathroom Windows'

In other HA components I looked at that are compatible with discovery, I couldn’t see any explicitly listing it as a dependency. Also no mention of it needing to be a dependency in the documentation except for http

I removed the discovery dependency completely from konnected.py on my setup to test out.

Works as expected when manually specifying ip/port without having to have discovery enabled.

I also tested out not specifying the ip & port manually and discovery works perfectly.

I’ll put through a PR shortly.

did you resolve this? I have the same error currently.

I’m still troubleshooting, I have tried almost everything including re-installing home assistant and only configuring a switch and have the same issue.

The only thing left to do is to disconnect my xiaomi hub from the power as its being auto discovered and connecting devices into the new install.

I am in the same boat @leafkicker . I have replicated the issue on a traditional container and the RPI I have. both are not discovering the nodes automatically. nodes are present on the network and no chatter to the container. I know discovery is working because it is finding other things on my network such as cameras and chromecasts which i can control. I have also flashed / reset the konnected panels through the wifi board still the same issue. I read there is a way to manually specify the nodes but i cannot find the way to determine their port (apparently all pick a random port to run the konnected API on). I submitted this question this afternoon to support and @heythisisnate

This was not a fun experience but finally i have 3/4 units working. Discovery 100% is not working. I decided to flash all wifi modules with firmware erasing configs to start from scratch. I hooked each one up to my PC and debugged it to get the port number. Assigned DHCP reservations to the three MAC addresses. and set discovery: false, host:: dnsaddress port: debuggerportnumber all the while verifying everything with nmap.

I have also had units that have been unable to connect back to wifi and go back into initial config mode. I will try and reproduce this but for now at least they are communicating and it is updating the statuses of the unit. Debug logger is also very helpful inside home assistant during this process.

My binary sensors are working but its the switches I have issues with for the beeper / alarm / relay. I just get “Error doing job: Task exception was never retrieved” in the logs.

Sounds like I need to try to connect them without discovery, I need to read up on how to find the ports on each device.

if you enable discovery, and add the below to your configuration.yaml, you should be able to see the debugging logs for konnected in your Home Assistant logs. When Konnected connects it will log the ip and port

logger:
  default: warning
  logs:
    homeassistant.components.konnected: debug

FYI my PR got merged and will make it to the next release.
Remove Discovery dependency from konnected.py

How guys I found my issue, I upgraded my routers firmware and it disabled IGMP. My sensors were still working but my switches were not, if you have this issue check your router!

Asus RT-ACXXXX Routers

  1. Set IGMP Proxy to Enabled
  2. Set IGMP Snooping to Disabled
  3. Set Multicast rate to OFDM6

Thanks for this, I have been having intermittent connection with the switches and wasn’t sure why. Hopefully this is my issue too

TL;DR Use static IP addresses (or reserved IPs via DHCP) for your konnected devices and your HomeAssistant host. Then set the base_url and host config parameters like so:

konnected:
  access_token: !secret konnected_access_token
  api_host: http://192.168.1.220:8123
  devices:
    - id: 807d3a000000
      host: 192.168.1.121
      binary_sensors:
        - zone: 1
          type: door
          name: 'Front Door'

I think only the base_url is critical. Then power cycle the konnected devices. You may need to reflash the firmware on the konnected devices (I did several times in desperation along the way, so I cannot be sure it isn’t a necessary step.) Instructions on flashing the konnected device is here: https://help.konnected.io/support/solutions/articles/32000023470-flashing-new-konnected-firmware-software

The full story:

OK, just finished 2 day journey of debugging konnected and hassio. In retrospect the problems started when I changed the base_url in the Home Assistant configuration. At this point the konnected stopped being able to connect to Home Assistant. Oddly enough I could trigger the buzzer attached to one of my konnected device, but none of the attached sensors would trigger.

Discovered that all the konnected devices were in a constant state of rebooting. My first clue was that the blue LED was flashing non-stop. If I ran ping against the konnected IP address (I have fixed IP assigned to them via DHCP) I would see that the device was up for about 5 seconds and then down for 5 seconds and then back.

If you want to see what your konnected device is doing on boot you need to attach to the wifi module via USB. https://help.konnected.io/support/solutions/articles/32000023786-device-debugging-with-screen

Konnected firmware 2.2.5
NodeMCU 2.2.0.0 build 20190117 powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)
Heap:   34928   Initializing Konnected (807d3a3eae60)
Heap:   33488   Version:        2.2.5
Heap:   31848   Connecting to Wifi..
> Heap:         36592   Wifi connected with IP:         192.168.1.123   255.255.255.0   192.168.1.1
Heap:   35360   UPnP:   Listening for UPnP discovery
Heap:   34984   HTTP:   Starting server at http://192.168.1.123:12107
Heap:   34824   Loaded:         server
Heap:   26624   Initializing sensor pin:        1
Heap:   26592   Initializing sensor pin:        2
Heap:   26592   Initializing sensor pin:        5
Heap:   26592   Initializing sensor pin:        6
Heap:   26592   Initializing sensor pin:        7
Heap:   26592   Initializing sensor pin:        9
Heap:   26592   Initializing actuator pin:      8
Heap:   26232   Endpoint:       http://REDACTED.COM/api/konnected
Heap:   26200   Loaded:         application
Heap:   29128   HTTP Call:      200     state   0       pin     8
Heap:   29064   Initialized actuator Pin:       8       Trigger:        1       Initial state:  0
Heap:   29464   HTTP Call:      500     state   1       pin     1
Heap:   29448   HTTP Call:      500     state   1       pin     1       retry   1
HTTP client: Disconnected with error: -8
HTTP client: Connection timeout
Heap:   31840   HTTP Call:      -1      state   1       pin     1       retry   2
Heap:   4616    UPnP:   Sent SSDP NOTIFY
Heap:   7896    HTTP:   Discovery
Heap:   27544   HTTP Call:      500     state   1       pin     1       retry   3
Heap:   30152   HTTP Call:      500     state   1       pin     1       retry   4
Heap:   29656   HTTP Call:      500     state   1       pin     1       retry   5
Heap:   29512   HTTP Call:      500     state   1       pin     1       retry   6
Heap:   29640   HTTP Call:      500     state   1       pin     1       retry   7
Heap:   29824   HTTP Call:      500     state   1       pin     1       retry   8
Heap:   29696   HTTP Call:      500     state   1       pin     1       retry   9
Heap:   29848   HTTP Call:      500     state   1       pin     1       retry   10

So every konnected device has a random port for checking the state, so you need to install the python package netdisco to discover the port number and check the konnected device directly. (Dear @heythisisnate this random port number is pointless, it does not add security as it is discoverable anyway and just makes debugging more annoying. Please fix this soon.)

In the meantime I got all sorts of weird errors, including:

Your Konnected device software may be out of date. Visit https://help.konnected.io for updating instructions.

This was because homeassistant wasn’t getting a well formed response from the constantly crashing konnected device. Since it wasn’t JSON format, HA thinks it’s an old version of konnected instead of just a panicing konnected.

Followed by the error:

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 99, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 118, in handle
    result = await result
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/konnected.py", line 430, in put
    if not hmac.compare_digest('Bearer {}'.format(self.auth_token), auth):
TypeError: unsupported operand types(s) or combination of types: 'str' and 'NoneType'

When HA tries to check the auth token in the garbage konnected reply. See the code here https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/konnected/init.py#L424

I still have a question though. It looks like the konnected devices are calling http://hassio.local:8123/api/konnected but this returns a 404 error. What is that about?

@heythisisnate: is there any way to upgrade the firmware without usb? An OTA one?
TIA

I just went through this the other day. In your configuration.yaml file is it setup something like:

http:
base_url: http://hassio.local #hassio hostname

and

konnected:
api_host: http://10.0.2.100 #hassio IP address

I had issues where the api_host could not communicate with hassio.local and needed the IP address of the hassio computer. I use ssl so my config is a bit different but I to had the constant reboots and this solved it.

1 Like

Would someone please tell me exactly where to place “base_url” line in code? I am stuck trying to get the HomeAssistant (HA) panel to recognize the Konnected Boards. I believe the Konnected boards are logged into local wifi. Capitalized words below have been inserted to replace actual words for security. I do not yet have ANY wires plugged into the Konnected boards (wanted to get showing in HA first). I have not set up any .pem files even though are listed below (I pasted code from forums). If you could not already tell I am a total Noob and little experience with modern coding. :blush:
TIA,
hotoru

My HomeAssistant Confg file looks like:
———————————————

  "password": "PASSWORD",
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "allowed_networks": [
    "ROUTER_IP"
  ],
  "banned_ips": [
    "8.8.8.8"
  ],
  "banlimit": 0,
  "ignore_pattern": [
    "__pycache__"
  ],
  "dirsfirst": false,
  "enforce_basepath": false,
  "notify_service": "persistent_notification.create"

My configuration.yaml on the Pi looks like

  access_token: MY_ACCESS_TOKEN
  api_host: http://ROUTER_IP:8123
  devices:
    - id: PANEL1_MAC
      host: PANEL_IP
      binary_sensors:
        - zone: 1
          type: door
          name: 'Front Door'
        - zone: 2
          type: motion
          name: 'Test Motion'
    - id: PANEL2_MAC
      host: PANEL_IP
      binary_sensors:
        - zone: 5

Here is my configuration.yaml info I used to get https and Konnected working together.

http:
  server_port: 443
  ssl_certificate: /ssl/certificate.pem
  ssl_key: /ssl/privkey.pem
  base_url: https://hassio.local

konnected:
  api_host: https://10.0.2.100 #IP address of Home Assistant
  access_token: !secret Konnected_access_token
  devices:
    - id: xxxxxxxx #Mac address of Konnected ie 68c63a8bcd53
      binary_sensors:
        - zone: 1
          type: door
          name: 'Front Door'
        - zone: 2
          type: door
          name: 'Back Door'
        - zone: 3
          type: window
          name: 'Bedroom Window'
        - zone: 4
          type: motion
          name: 'Downstairs Motion'
        - zone: 5
          type: smoke
          name: 'Smoke Upstairs'
        - zone: 6
          type: smoke
          name: 'Smoke Downstairs'
      switches:
        - zone: out
          name: 'Siren Switch'

By setting https to port 443 which is the standard https port makes thing a bit easier that the 8123 port.

To get the Konnected board setup:
When you first start the Konnected board you connect to its wireless network and go to 192.168.1.4 on the webpage you enter in your wireless network information. The board restarts and will then connect to your wifi network.
Next you will need get the mac address of the Konnected board. You can usually get this by looking at your wireless router or DHCP server to see which ip and Mac address.
The Mac address of Konnected board is the ID in the configuration.yaml file.

The constant rebooting of Konnected is that it there is a connection issue and it can’t communicate with Home Assistant.

I connect to home assistant using http://hassio.local in safari and in the Home Assistant app on the iPhone.

Please correct your post, see the blue box at the top of the page.

Umm, I checked the blue box at top of page, then tried to edit my post. When I click the </> button it just inserts text that states " indent preformatted text by 4 spaces"
I tried to put four spaces in front of my code and retried but did not seem to do anything but insert a “reformatted text” word… Is there some specific text I can put at start and end of code block to indicate that it is code? like [ and ] or < and >?

edit
I finally followed the link and read you need to place three back ticks at start and end of code block. :blush:
hotoru

Looks ok now thanks.