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

Tags: #<Tag:0x00007f32737866b0>

Just wanted to let you know it’s working now that I updated my Konnected nodes to 2.2.3 and HA to 0.74.2. Can’t wait to get some automations going now!

@heythisisnate - I have a smoke alarm that can only be wired for normally open (NO), rather than the usual NC. I see that you added support for this in the device handler for SmartThings to be able to support this. Any way to implement this to HomeAssistant? I think that it can be accomplished by taking the smoke alarm and using sensor templates to reverse the logic, but it’s a kludge. If it can be set at the board level that would be awesome… Thanks!

Is it possible to connect prewired sensors to a ring alarm base station through HA using the Konnected?

I’m experimenting with a Home Assistant running in docker on a QNAP nas, and konnected running on NodeMcu.

I’m struggling with an intermittent issue with the konnected NodeMcus getting into an unrecoverable blue-light-flashing state.

On several occasions, when the whole system was working and all the konnected sensors were showing up in HA fine, I did one more config.yaml tweak (unrelated to konnected) and restarted the docker instance, and then the konnected nodemcu stopped working. During HA startup, I see the blue light on the NodeMcu flashing repeatedly, he konnected devices no longer show up in the web interface, and a bunch of repeating error messages like this in the log:

2018-08-21 03:22:51 INFO (MainThread) [homeassistant.components.http.view] Serving /api/konnected/device/68c63ad6548f to (auth: False)                                                                                          
2018-08-21 03:22:51 ERROR (MainThread) [aiohttp.server] Error handling request                                                                                                                                                               
Traceback (most recent call last):                                                                                                                                                                                                           
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 378, in start                                                                                                                                                  
    resp = await self._request_handler(request)                                                                                                                                                                                              
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 341, in _handle                                                                                                                                                     
    resp = await handler(request)                                                                                                                                                                                                            
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 88, in impl                                                                                                                                                 
    return await handler(request)                                                                                                                                                                                                            
  File "/usr/src/app/homeassistant/components/http/static.py", line 66, in staticresource_middleware                                                                                                                                         
    return await handler(request)                                                                                                                                                                                                            
  File "/usr/src/app/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware                                                                                                                                               
    return await handler(request)                                                                                                                                                                                                            
  File "/usr/src/app/homeassistant/components/http/ban.py", line 67, in ban_middleware                                                                                                                                                       
    return await handler(request)                                                                                                                                                                                                            
  File "/usr/src/app/homeassistant/components/http/auth.py", line 66, in auth_middleware                                                                                                                                                     
    return await handler(request)                                                                                                                                                                                                            
  File "/usr/src/app/homeassistant/components/http/view.py", line 113, in handle                                                                                                                                                             
    result = await result                                                                                                                                                                                                                    
  File "/usr/src/app/homeassistant/components/konnected.py", line 319, in put                                                                                                                                                                
    device = data[CONF_DEVICES].get(device_id)                                                                                                                                                                                               
KeyError: 'devices'                              

This seems unrecoverable. I tried reverting all my tweaks in the configuration.yaml and restarting HA but it didn’t help. I tried power cycling everything. I deleted my docker instance (0.74.2) and updated to the latest (0.76.1).

The only thing that worked was reflashing the v2.2.2 Konnected firmware and filesystem onto the Nodemcu. Then, after restarting the board and HA, it all came back to life. Then I restored my full, tweaked configuration.yaml and all was well.

So I guess it’s nothing to do with my config or my setup. But maybe something to do with frequently editing the config and restarting the docker instance? Maybe it isn’t shutting down cleanly and leaves the konnected/nodemcu in a funky unrecoverable state?

Since this keeps happening, it’s making me nervous about depending on this as I continue to expand the setup. Anyone have any advice? Should I bail on docker/qnap and get hass.io running on a rpi?

Very interesting. I am receiving what I think is similar message as below with my Konnected and my symptoms are nearly identical. Works after a re-flash but then stops.
My setup is Hassio on a Pi3+ with Caddy and Samba shares, so very basic.

018-08-21 14:44:38 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 230, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 297, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
2018-08-21 14:44:46 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 230, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 297, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
2018-08-21 14:44:54 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py”, line 230, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File “aiohttp/_http_parser.pyx”, line 297, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

I’ve been able to reproduce some of the issues a few of you have reported where the Konnected devices constantly reboot due to HTTP errors in Home Assistant. This problem was exacerbated with the 2.2.3 Konnected software update which includes automatic retry/failsafe behavior that reboots itself after 10 failed HTTP requests.
The problem is that Home Assistant depends on discovery to re-discover the boards every time hass is rebooted. Between the time that Hass is rebooted and discovery runs successfully, if Konnected is trying to update a sensor state it will get an error and retry/reboot. This could be considered a circular dependency problem.
I’m working on some updates to the Konnected component that will allow it to partially load faster, not relying on discovery every single time Hass is rebooted. It should fix this problem.
Thank you all for your continued feedback and for your patience while this is address. In the meantime you can downgrade to version 2.2.1 to avoid the issue.

Thanks for confirming, Nate! Yes- that matches my experience. When it is failing, the blue light flashes briefly around 10 times, then pauses, then longer flash, then 10 more times, and repeats.

If it occurs again before your update (hope not!), could you point me to any directions on downgrading?

Meanwhile, I’ll look forward to that update. :slight_smile:. I saw some commit notes on github about OTA update- how does that work? Or will it require reflashing the boards?

Thanks again!

To downgrade or upgrade just grab the two *.bin files from the release you want: https://github.com/konnected-io/konnected-security/releases

Flash them with the Konnected Flash Tool or esptool.

There used to be an OTA update feature but I yanked it because it was flaky.

I will update here when I have progress on the issue.

Got it- thanks Nate!

It happened again today, so I went ahead and flashed with 2.2.1 and it’s working well again now. That’s a relief. I’ll look forward to your giving your next update a try.

I’ve submitted a PR this morning that should fix the reboot loop problems that some of you have experienced:

This change makes the Konnected sensor & switch entities show up immediately when the konnected component is loaded instead of waiting for the discovery callback. This will make the device recover much more quickly after a Hass reboot and eliminates the circular dependency hinged on discovery.

Hopefully this will get reviewed and merged before the 0.77-beta cutoff which I think is tomorrow. Please review and comment on the PR for visibility!

Great news! I commented on the PR, for what that’s worth :slight_smile:
Incidentally, my konnected setup has been working great since downgrading to 2.2.1


I’m observing a new problem today with HA 0.78:

A few weeks back, I installed HA 0.77.3, and re-flashed all my nodemcu firmwares to your latest 2.2.3, and all has been working well. I also set up my piezo to use your new beeping config, for pending-arming-status. Good stuff!

Today, I saw HA 0.78 was released, so I updated my hassbian. After that, several times my piezo beeper suddenly started beeping solid beep. Also, I saw a couple of my nodemcu started failing again with the flashing blue light issue…

I see this in the log:

2018-09-17 21:55:15 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved

Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py”, line 224, in _handle_service_platform_call
await getattr(entity, func)(**data)
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/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’

I guess I’ll downgrade HA back to 0.77.3 and hope it recovers…

Update: after downgrading HA to 0.77.3, one of my nodemcu’s was stuck in the flashing blue light state with the piezo buzzer stuck on. Painful! :slight_smile: I had to reflash my nodemcu konnected firmware to get it working again…

There were no changes to the Konnected component in 0.78. Any issues you had after the upgrade were purely coincidental.

Any chance one of the dependencies was updated as part of 0.78 which caused a problem with konnected? Or maybe just part of the process of updating HA caused the boards to go into that infinite flashing-blue-light loop?
Was that log trace failing in konnected.py any clue?

I just tried Konnected Firmware on NodeMCU, I have 3 door (Connected to Pin 1,2,5) and 3 window sensors (Connected to Pin 6,7,9). I am having two issues:

1 - I am seeing significant delay in state update for binary sensor. It was as high as 30+ second in some scenarios.

2 - For some reason, my window sensors are not picking up state changes. Even when I try to switch the pins to 1,2,5.

I have NodeMCU + MQTT based security system that I wrote earlier which is detecting windows without any issue. Any feedback/comment/leads highly appreciated.

John, what probably happened is that the devices were trying to reach Hass to update a sensor state while it was down for the upgrade. If the Hass API can’t be reached, it’ll retry several times and then reboot repeatedly as a failsafe. This is expected behavior so that when the service comes back up it will immediately update the current states.

The error that you posted happens when you try to switch a switch that hasn’t been discovered yet. Discovery takes place within a minute or so of Hass rebooting, and then Hass stores the IP address of the devices. Usually just waiting a minute or two will resolve this.

Could be a couple things:

  1. Resistors wired inline with your sensors. Remove them.
  2. You’re using the http component to serve a SSL certificate. This is not recommended because of the additional required to communicate via https. Use a reverse proxy instead so that HA’s built-in http server can serve local traffic over http. See: https://help.konnected.io/support/solutions/articles/32000023964-set-up-hass-io-with-secure-remote-access-using-duckdns-and-nginx-proxy

Thank you for prompt reply Nate.

  1. I don’t have any resistors inline with sensors.

  2. I am using DuckDNS with Let’s Encrypt to serve SSL.

  3. I added motion sensors as well and they seem to up getting updated fairly quickly.

Few more think about my set up,

  • running 0.78 hass version right now.
  • connected all binary sensors ground wire to single GND terminal on NodeMCU.
  • Konnected Firmware 2-2-2