I use openhab for many years now with many arduinos communicating with mqtt. My house is entirely automated through multilple arduinos where every single switch and every single light/shutter relays are plugged with an arduino pin. So I got around 50-80 openhab items. I also have some home made temp sensors and remote sockets. It includes hundreds of lines of rules in openhab managing my shutters…
Anyway, with openhab 2.0, I was thinking of making the arduinos with their “channels” discoverable without having to implement a new openhab binding. I quickly looked and I didn’t find such a protocol on top of mqtt that the arduino could implement to make the channels discoverable by openhab.
I’m sure there must be an open protocol for that, any idea ?
Note: that I’m not blocked at all tio migrate from 1.x to 2.0, it’s just an idea I could work on.
It is the binding that does the discovery. You will have to implement a new binding. Furthermore, autodiscovery only works with Things, not Items and since MQTT is a 1.x binding there are no Things, and hence no autodiscovery.
What would be awesome would be to pick up the work that has already been done but dropped to implement a 2.x version of the MQTT binding. They got some sort of technical challenge and development stalled.
You might be able to build something outside of OH that implements some sort of discovery protocol and use the OH REST API to create Things and Items.
But there is no generic protocol I know if that rides on top of MQTT that supports autodiscovery and even if there were, it wouldn’t be supported in OH because the MQTT binding doesn’t support autodiscovery.
Ok thanks, so there isn’t any low level open source protocol to let IoT services discover IoT objects, functionnalities… I’m surprised ! Maybe there is one not running on top of mqtt ?
Each home automation vendor comes with its own proprietary API to let external components (such as OH) communicate with its objects. There must be some people trying to standardize that, isn’t it ? I can’t believe no one is working on such solution. May it’s udp, http… ?
There are lots of people working on IoT standard protocols. Ask any company in the IoT industry and they will claim to have THE standard. All are of varying states of maturity, all are all but incompatible with each other, and all all but lock you into a walled garden.
MQTT itself is considered a high-level protocol. It is unlikely that anyone will come up with some sort of protocol on top of MQTT because:
- it requires the user to set up their own broker and do a lot of additional configuration
- configuration can become complex, particularly if one wants to have encrypted traffic
- because it is open, it isn’t in a company’s interest to base their communications upon it
At the end of the day, the only way to provide something with a modicum of security to non-technical end users is to pass all the communications through the company’s servers or to build the communications into the hardware. Since these companies stand to gain little and potentially lose much by having too open of a protocol don’t expect them to open up their protocols anytime soon. Oh sure, they will open up an API to their servers but rarely will they open up the API so you can talk to their devices directly.
Ultimately, openHAB and all of the other HUB developers are standardizing this by providing the ability to talk to each of these technologies and present them to you the user via a unified interface (Things and Items in OH’s case).
I half heartedly looked for that one and didn’t find it. Thanks for being more diligent than me.
Thanks a lot for your comments, love the xkcd one. No standardisation yet for an open source discovery protocol. I understand.
Let’s come back to my real problem. Let’s say, many people (thousands ?) have arduinos and openhab at home. What would be the best way forward to integrate them easily ? I mean, after uploading the sketch to the arduino and running it, what magic to build in order to have openhab automatically discover it ?
Maybe there isn’t any need because those guys should have enough skills to edit .items files ?
In any case, I would love having a little library in my arduinos. Of course, I would need to describe in the lib configuration what are arduino channels. Everytime I run it, openhab would pick it automatically and suggest new items, channel… Do you know how I could sense if people would like that ?
Thanks again @rlkoshak
Maybe this already offers what you are looking for:
There is even an existing binding for it, at least it is close to being finished maybe you can even help the creator of the binding to finish this:
Note that @David_Graeff is also working on the mqtt binding for eclipse smart home / openHAB 2.
The solution is not one protocol but multiple. Mdns /avahi for discovery. Mqtt or coap for transport, ssl or dtls for secure transport and homie/easyesp or lwm2m for modelling the actual sensor data or actuators.
I haven’t seen that someone is working on a homie binding. I definitely need to contact that guy after I finished the ESH mqtt implementation.
I already pointed out to @Kwave that he should depend on the MQTT transport which I believe you are working on, so he could definitely use your help and maybe provide some input for you.
Thanks for your hard work!
You might also want to check mysensors.org, arduino based (ethernet,serial or mqtt gateway) and has its own openhab binding…
Keep in mind, automatic discovery only applies to Things. You still need to create Items, though you can do it through either PaperUI or editing .items files.