I have managed to add support for Mqtt, Websockets and Digest Https in Edge, but since they are written in pure Lua, they feel quite slow. So of performance reasons, I would like to see native implementations of these protocols. Has Smartthings team any plans for native support for these protocols in EDGE?
Well, for the MQTT side see this:
Get Started with Direct Connected Devices | SmartThings Developers
@nathancu, thank you for the link, but if I understand correct that is only for direct connected devices. My question was regarding hub connected devices (Edge).
The ask was ‘what is ST’s plan for…’
They PLAN to support MQTT through direct connected devices using that mechanism. Now apply that to the ask about edge…
For now, there’s no plan to support MQTT as part of SmartThings Edge, however the team doesn’t discard this path for future releases.
I recommend you to take a look at this post.
@erickv, yes that is the mqtt package I have added in my Edge driver. It works, but is a bit slow.
Nothing should really be noticeably slow. How slow are we talking? By far and away the slowest part of the system should be the network latency. I haven’t looked at that library, but unless it’s doing something incredibly inefficient, I can’t imagine parsing MQTT messages even in lua could take more than some double digit number of nanoseconds.
Actually, I have been focusing on to adapt the protocol packages and make them runnable on the Edge platform. So it’s just a feeling I have that some things are a bit slow. I use some encryption modules (base64, md5, sha1) in my driver and if you could provide native version of these , I think it would be good for the performance. (Saw that sha1 is included in latest release)
I work a lot with lua on embedded systems with limited resources and know the importance of to implement resource demanding functions i C to improve performace. But without good monitoring tools it’s very difficult to know what to focus on. Are there any tools on Edge I can use for monitoring?
Yeah, I can see that for some of the more computational intensive things like hashing, though, I still wouldn’t expect to see any delays that are noticeable in device operation to a human. But measurable, definitely. That SHA1 library is a lua library though. There’s some under the hood stuff being worked on around updates where having everything in Lua is incredibly helpful, so I wouldn’t expect any native libraries until at least after that is done. And even then having to maintain native libraries for different architectures would be something new that would require work. It’d definitely something we want to support, we actually were just taking about that in a meeting today, but it’s not as trivial as it might seem at first blush.
There’s nothing that we include by default, well, nothing besides
socket.gettime() and logging, but that probably doesn’t count for what I think you’re looking for. There’s some stuff coming up that’s not really my place to talk about that will make it possible for us to offer a lot more of this kind of stuff though. But I don’t know of any solid plans for exactly what/when that will be.
Maybe we should leave the performance issue for now. I’m working on a Edge integration with Vanderbilt SPC intrusion system. I have made same integration on a lot of other Smart Home systems, so when I’m ready with the driver I can compare performance with simulary platforms. Maybe I can come back to you with some results after that.
I use a V2 hub right now for my tests. Can I expect same performance on the V3 and Aeotec Hubs?
Interesting projects! I’ve done full UPnP implementation and haven’t found performance lacking at all, even with 20 devices all running simultaneously (and UPnP is a pretty chatty protocol on the multicast address).
Re. MQTT, yes it is used for the direct connected devices, but your device never does any interfacing at that level. There’s a higher-level API that the device apps use. MQTT is purely an interesting behind-the-scenes factoid for marketing purposes. However if you do a lot of work with embedded wifi devices and you use things like ESP32 or Raspberry Pi Zero, it’s a pretty useful way to integrate with STs.
technically the v2 hub has a faster processor and more memory than the v3 AFAIK