Konnected.io adapter

Hello, I’m the guy who jumped in and contributed fixes to the DateTimeAdapter which is now part of the WTIOAddons organization I created so that others could also contribute to the DateTimeAdapter if they so choose (in particular I added the original creator and some others to the organization, if you want in let me know; otherwise you can just use the normal fork and pull request method).

Anyway, on to the next thing. I am creating a konnected-adapter for konnected.io alarm board replacements. It’s a neat device that lets you hard wire all your existing wired door sensors and motion sensors to it, including the siren. With a proper Konnected adapter you will be able to drop it into your WebThings and go to town. The point I’m at now is I have an MVP working, but I’m not sure about best practices. I have implemented my own HTTPServer to receive messages from the device (by getting the ip address of wlan0 and adding my own port server at 8001), but they are just RESTful http://my.wlan.ip.addr:8001/api/konnected calls that it seems like I wouldn’t have to stand up a server for, and I could just tell it to use my https://gatewayaddress.webthings.io/thing/144223/api/konnected/xxxx144223 instead to receive messages (they’re json payloads). So, rather than my own server, how do I receive such a RESTful message directly in my python code? Second, I am initially scanning via SSDP and connecting to the Konnected.io board (V2) through urllib.request to “provision” the board (tell it where my URL is and what my zones are, among other things). Is that best practices, or is there some way to make an HTTP call with a JSON payload from within the gateway addons api and/or do the SSDP scan? It works as is, but I want to follow proper security and portability, etc. Code is at https://github.com/WTIOAddons/konnected-adapter for reference. With my adapter you won’t need to provision your card through konnected.io, just set up the wifi on it and stop there (don’t create a konnected.io account).

Cool idea/effort @billfahle! I like the idea of “upcycling” (re-using) already installed infrastructure like older/legacy home security systems. Does it work if you leave the existing security alarm system in place? (Such as a local key-pad “away”/“off” alarm system?) If so, I’d be eager to try it once it’s in a stable state, even if not fully complete yet.

There are two main options with Konnected. You can get the board that essentially takes over the complete functionality of the system, and leaves it to management by the hub (in our case by the adapter and rules for the device). The existing keypads in this case become useless, but you can replace them with tablets via some hardware they also sell (the tablets are wired to power through the old power for the keypads and a special 12 volt power supply). Then there is the other option, where you keep your old system, but wire in an “interface” to that, and keep your existing system, but use the interface to monitor the behavior of the existing system. Control over the existing system is more limited this way, but your keypads still work. Either option costs about the same, but obviously adding in optional tablets will up the price for the first option. Keeping the existing board wasn’t an option for me, because I didn’t have the dealer code to my existing system and don’t know the user code. It was unplugged. With the interface (what you would want) you can do things like detect door open or motion detector having gone off, and forward that information to the webthings system, then use it to turn on a light, for example, without interfering with alarm operation. I would be interested to have someone make sure everything works under that scenario since I’m doing the other.

I’ve been playing around with the idea of the konnected adapter using a user-supplied auth token to get to the hub rather than run an unsecure website on the wireless lan (an obvious security hole). So far, I have been able to get to my created konnected thing using curl to test with (I’ve successfully gotten properties), but I need to dig into the messaging system to make sure I’m getting the messages forwarded when I send an api message. All I get back right now is an html page that has this form:


Cannot PUT /things/14290783/api/konnected

So, I gave up on the idea of a RESTful API for now, and am simply using my own http server. I may get around to setting up an HTTPS server at some point to be more secure, but I have to make sure konnected can handle it. 0.0.4 should be stable enough to use if you want to get started.

V2 of the konnected adapter, I have made it look like a Lock to the gateway. I put the action for arm/disarm (a lock toggle action) with an input property of an integer. Then in configuration I set what that integer should be. For example, configure access to 1234, then when you go to arm/disarm action, it asks for an integer, and if you enter 1234 it toggles, otherwise it does nothing. However, I’d like to obscure that integer and check the security code against that so the criminal can’t just go type in a new code and unlock it. It this overkill? What is the recommended way to obscure such a code into the config?