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

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

This is your problem. See my article here about why this is problematic and the simple workaround by using the Nginx addon to serve the LetsEncrypt cert:

I’ve encountered another (possibly related) scenario where the konnected/HA setup fails in a strange way. Yesterday afternoon, I restarted my airport extreme (the wifi router that the nodemcus are connected to).

After this, the system seemed a bit scrambled. When I opened my front door (which is connected to one of the nodemcus)- it didn’t show as opened in HA, but the piezo (which is connected to one of the other nodemcus) turned on with a solid beep. I couldn’t get it to turn off, without physically pulling the wire off the nodemcu. I only have the piezo configured in the konnected setup as a momentary/pause/repeat beeper so it’s strange that it turned on solid. The HA log doesn’t show proper messages for either the door or the beeper events.

Looking in the log at the time the airport extreme restarted, I can see a bunch of comm failures. And it looks like the nodemcus were given new ip addresses by the airport. I see this (possibly related) error in the log for the 68c63ad74b44 (the nodemcu with the front door). It had previously been discovered 5 days before, with a different ip address.

2018-09-22 15:20:26 INFO (Thread-2) [homeassistant.components.konnected] Discovered Konnected device 68c63ad74b44. Open http://192.168.1.21:22109 in a web browser to view device status.
2018-09-22 15:20:27 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 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 336, in _async_add_entity
    msg)

Restarting HA didn’t resolve it. So I power cycled the whole konnected panel. Still no good (and piezo was stuck on!) Then I restarted HA again, and finally after a couple minutes, the piezo turned off and it looks like the sensors are working properly.

I guess maybe I should reserve fixed addresses for the nodemcus in the router? Any other advice? Like how can I stop that piezo from getting stuck on in such situations?

Thanks,
John

Adding an IP reservation for the boards and HA will help. Both HA and the boards have to know each other’s IP address, so when one changes, things break until discovery can run again successfully.

I would love to see a konnected feature that could communicate using the home assistant Mqtt server. It would resolve the SSL issue without using a proxy as mqtt doesn’t use it. Home assistant would not need to know the IP of the konnected as konnected would just subscribe to the built in mqtt server.

What are you using on you nodeMCU to update Mqtt. What advantage does konnected have over this?

I am running my own sketch on NodeMCU. I can share my code if you are interested. The only downside is you will have to configure lot of things compare by yourself. The only advantage is over Konnected is not having need for proxy but Konnected give lot of things for free and its being actively worked on.

Am I correct that the disadvantage of using the nginx proxy is that port 80 needs to be forwarded to the home assistant server to renew the SSL certificate automatically with the let’s encrypt addon but the duck DNS add-on gets around this? If that’s the case then I can’t use konnected if the SSL is unreliable at the moment so would really like to try what you have instead if your willing to share?

Here you go - https://github.com/slonkar/MQTT_SecuritySystem.

There’s virtually no disadvantage to using Nginx proxy unless you have untrusted devices on your LAN that you suspect may be snooping on your local traffic. There’s no need to forward port 80, I’m not sure where you got that idea. By default, the Nginx proxy listens on port 80 and just serves a redirect to port 443 for convenience (so you don’t have to type https://) but this is not necessary.

If you use my step by step guide below, it still uses the DuckDNS add-on to issue and auto-renew the LE certs. Literally the only difference is that Nginx serves up the certs instead of home assistant’s built in http server.

I was under the impression that using nginx instead of hassio direct would mean that the duckdns add-on would not work and I would need to direct port 80 to get the letsencryt add-on working to renew certificates as this is mentioned in the nginx add-on guide. I have followed your guide and I now have konnected on test with a PIR attached to trigger a light in the kitchen.

If I want to manually specify the IP and port for the konnected device instead of using discovery, what port does konnected device use by default?

The default port is randomized per device (security by obscurity) so I couldn’t tell you. You can connect the NodeMCU module to your computer to see what the port is in the console boot output, or use discovery for the first time to see what it is and make a note.

I can 't get my alarm to trigger. When I trigger the automation I receive notification that the alarm has been triggered but the siren does not alarm and the red light on the MCU board does not come on. All my sensors are working, my siren goes off if I just connect it to 12 volt power. When I arm the alarm and set off a sensor I do not get notification that the alarm was triggered.

So I tested out my new konnected panel with discovery enabled and it works great.

However can’t get it to work without discovery…I have the correct host and port setup but get this in the logs

2018-12-11 12:58:03 ERROR (MainThread) [homeassistant.config] Invalid config for [konnected]: [host] is an invalid option for [konnected]. Check: konnected->konnected->host. (See /config/configuration.yaml, line 335). Please check the docs at https://home-assistant.io/components/konnected/

2018-12-11 12:58:03 ERROR (MainThread) [homeassistant.setup] Setup failed for konnected: Invalid config.

Not sure why it says host is invalid config option when its in the doc and I can see CONF_HOST in the python component?

Here’s my config (im on HA 0.83.3)

konnected:
  access_token: !secret konnected_token
  api_host: !secret hass_url
  devices:
    - id: !secret konnected_mac
      binary_sensors:
        - zone: 1
          type: motion
      switches:
        - zone: out
  host: !secret konnected_host
  port: !secret konnected_port
  discovery: false

Worked out what the issue was in my config in my previous post…host & port should be nested under devices.

But now next issue…I need to still have the discovery component enabled in my Home Assistant setup which kind of defeats the purposes of why I would manually specify the host & port. Is it possible to remove the discovery dependency on line 99 below?

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/konnected.py#L99

Good point. I suppose we should make the discovery dependency optional.
Is there any way to dynamically define dependencies? I’ll have to look into this.

PRs are welcome :wink: