WebThingsIO / gateway

WebThings Gateway
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 333 forks source link

Gateway Image Support [Question] #2374

Closed rajdpandey closed 4 years ago

rajdpandey commented 4 years ago

Hi,

I was going through the User Guide and Getting Started Material of Mozilla IoT Gateway and found that it supports only XBee and z wave for the communication with smart devices.

Suppose, I want to control a device that is Wi-Fi enabled let's say custom made ESP32 light controller. If I want to control it through gateway, can I? If yes then how?

madb1lly commented 4 years ago

Hi @rajdpandey,

Zigbee and Z-Wave have specific device profiles for different kinds of devices so they're much easier to interface to the gateway and in most cases will just work using the software add-on adapters for these protocols in the gateway.

Bluetooth and Wifi do not have these standard device profiles. Bluetooth kind of does, but the implementation is not standardised AFAICT. It's possible that an existing add-on adapter for a Bluetooth devices for the gateway will work with another Bluetooth device, if by chance they implement the usage profile in the same way, but it cannot be guaranteed and is probably unlikely.

Wifi devices are similar - an existing add-on adapter may work for another device, but it is highly unlikely because Wifi doesn't have any standard device profiles as it's not intended for IoT or PAN. In these cases the only thing to do is write a dedicated add-on adapter.

To answer your specific question, for an ESP32 controller you should use one of the generic WebThing libraries to include in your code and make your own custom WebThing: https://iot.mozilla.org/framework/

Personally I've been using the webthing-arduino library.

I hope that helps :)

mrstegeman commented 4 years ago

Well said, @madb1lly!

madb1lly commented 4 years ago

Thanks @mrstegeman, I'm glad I understood it! 😄

rajdpandey commented 4 years ago

@madb1lly Hi, just like webthings gateway(Which is an image and have the support of UI and all) does webthings framework will provide the same? As I saw it also starts a local server with custom things, which I think doesn't have any GUI. So is there a detailed example of using it. And if possible video guidance of simple project by using both gateway and framework? If not can you all make one?

mrstegeman commented 4 years ago

@rajdpandey The WebThings Framework is a set of libraries intended for building IoT devices which can in turn be controlled by the gateway or some other web of things client. The two go hand in hand.

Here is a blog post which should help explain things further: https://hacks.mozilla.org/2018/05/creating-web-things-with-python-node-js-and-java/

rajdpandey commented 4 years ago

@mrstegeman Thank you very much. If possible can you please attach this blog post in the Intro Readme of this repo or say on the webpage of Web things IoT. It will help other beginners also.

And if know more examples like this with a working project or any other can you also post it.

mrstegeman commented 4 years ago

The gateway portion of that blog post is essentially the same regardless of the web thing you're adding, so here are a few web things in various languages: