Using MQTT is as easy as 1, 2, 3

SAMI just got another way of letting the data flow. We’ve just published instructions on using MQTT, a lightweight message protocol that has become an IoT standard.

Due to its bandwidth and battery efficiency, MQTT is well suited for home automation, low-powered IoT devices such as wearables and remote sensors, and mobile apps. In our MQTT implementation, SAMI acts as a message broker for connected devices. As MQTT clients, the connected devices can publish messages containing data or subscribe to receive Actions sent to them.

How MQTT works in SAMI

Now is a good time to take stock of all the available methods of communicating with SAMI. Looking at the right half of the below diagram, MQTT enables direct communication between SAMI and connected SAMI devices. For those applications requiring more bandwidth or flexibility than MQTT currently allows, SAMI also offers REST APIs, which enables posting of both standard and Action messages; and WebSockets for bi-directional message streaming in real-time.

How SAMI builds an ecosystem

SAMI can also retrieve data from commercial devices by using Cloud Connectors, which bridge SAMI to third-party clouds. This is depicted on the left half of the diagram. Finally, connected devices on both sides of the picture can use subscriptions and notifications to listen for messages and Actions.

It is important to note that MQTT is designed to function as part of the broader SAMI ecosystem. With MQTT now in the picture, it is possible to have a device publishing messages to SAMI via MQTT, while another connected device listens for the messages via WebSockets or subscriptions/notifications. Likewise, a device may subscribe via MQTT to receive Actions that are sent by other devices via REST or WebSockets.

With all of these options, connecting to the ecosystem isn’t a question of how, but of when. Head on over to the documentation to learn more about our MQTT implementation, including a simple smart light example.