Replacing an old alarm system with Konnected.io
Our home had a mysterious bunch of wires that were meant for an alarm system. Of course we decided to integrate this wiring and its sensors into Home Assistant. To do this we used an open source project known as Konnected.io.
Konnected – prebuilt or DIY?
Before we start, you should know that Konnected started as an open source project based on the ever-handy ESP8266 board. “Konnected” can refer to the prebuilt hardware and software package that you can buy from Konnected.io or it can also refer to the open source project that you can flash onto your own ESP8266 board. Save yourself some time and buy the premade board at https://konnected.io. If you like to tinker (like us) you can go the DIY route and build your own Konnected.io boards.
You can use a temporary breadboard to wire everything up and test it. I chose to use a solderable breadboard instead and added some screw-down terminal blocks to secure my alarm system wiring. Konnected uses pins D1, D2, D5, D6, D7, and RX. The screw down terminals each need a path to a pin and a path to ground. Details can be found here. Here is the end result:
Flashing the ESP8266
There are many similar projects using the ESP8266, but in the interest of time I decided not to write my own code. The Konnected firmware and software are already well-developed and include all the wifi and GPIO bits you need, plus there’s already an integration with Home Assistant that is ready to go.
Everything you need to flash the board is on the project’s github: https://github.com/konnected-io/konnected-security Here are the basic steps:
- Download and install the driver for your OS
- Connect the board to your computer with a USB cable
- Download the firmware and the source files
- Run the custom flashing software
Again, all the details for your OS are here: https://github.com/konnected-io/konnected-security
Connect the Board To Your Wifi
This step is fairly straightforward:
- Power up the board (I’m using USB)
- Find the new wifi access point that it creates (usually it’s labeled konnected_xxxxxx)
- Once you’ve connected to that access point, open a browser and go to the board’s IP address (something like http://192.168.1.170). I like to use the phone app “Fing” to get the address.
- From there you can select your wifi network and enter its password.
- Click save and reboot.
- Now you can reconnect to your normal wifi access point.
Configuring Home Assistant
As with most built-in platforms, getting Home Assistant to talk to my new Konnected boards was as simple as editing my configuration.yaml file. Detailed configuration info can be found here.
- id: xxxxxxxxxxxx
- pin: 1
name: Front Door
- pin: 2
name: Deck Door
- pin: 5
name: Mud Room Door
- pin: 6
- pin: 7
- pin: 9
The access_token is just a random string. The id is the mac address of your ESP8266 without the colons, and in lowercase letters. I got the mac address from my router. The rest is handled automagically by Home Assistant. To add another board you would simply add another “- id” section. Since I’m using the ESP8266’s pins for reference, I referred to them in my configuration as well. Konnected only has 6 pin assignments: 1, 2, 5, 6, 7, and 8 (which IIRC is the RX pin?). Save that file and restart. If you did everything correctly you’ll see the new devices in Home Assistant’s device list.
Uh oh, TLS Problems
I am using the DuckDNS addon to expose my Home Assistant config securely to the internet. After restarting Home Assistant I noticed two things. First, my log was full of TLS errors. And second, the new Konnected devices in my Home Assistant device list were extremely slow updating when a state changed (and sometimes did not change at all)! This was worrisome since I just spent and hour soldering two boards and setting up the config. Some quick research and I learned that Konnected can’t handle SSL due to the memory and processing requirements. This meant that it needed to connect to Home Assistant using HTTP, not HTTPS. Fortunately, the solution is on the Konnected site here.
More searching and I learned that the Home Assistant add-on “nginx” would do that perfectly for me. So i went to the Hass.io add-on page and added the plug in. I had to make one quick change to my router (forward port 443 to my home assistant’s port 443 instead of 8123). After a restart eveything still worked and Konnected updated its devices instantly. Success!
Aside from the pleasure of another DIY job completed, we also have a very responsive interface to our door sensors that doesn’t require batteries. We have also removed the small, but unsightly, Xiaomi door sensors and will use them somewhere else. Not bad for about $10 each. Next up, adding relays to one of the Konnected boards to open and close the garage doors. Stay tuned…