Development of the Open-Source Telegram Bot for MQTT IoT

Today I will be sharing my experience in developing a flexible Telegram-bot. His purpose: obtaining information and controlling IoT devices via the MQTT protocol.

What’s so special? Because this is not just a bot with two-three hardcoded buttons to operate a light bulb (there are many examples of that on the Internet), but a bot that supports flexible subscriptions and commands to operate directly from the menu, without any changes introduced to the source code. It’s a ‘NoCode solution’, so to speak.

The MQTT Essentials are Back

For data exchange with constrained devices and server applications, MQTT is the top choice of large enterprises around the world. You are just as likely to find MQTT connecting things in your living room, in a car as within a factory. MQTT's widespread adoption has led to its acceptance as an open OASIS and ISO standard. Today, MQTT is the absolute standard protocol for the Internet of Things (IoT) worldwide (see Google Trend Chart).

In 2015, HiveMQ wrote the MQTT essentials blog series. A new article introducing the core concepts of MQTT was published every Monday - that was the beginning of the MQTT Monday. By explaining the features of the protocol and other essential information, our aim was to provide easy access to the subject. The idea was to make it easy to understand and implement MQTT quickly and successfully. 

Capture IoT Devices Data Via RabbitMQ

Introduction

The purpose of this article is to give you an overview of how to capture events from MQTT enabled IoT sensors/devices and monitors it via ELK stack.

After capturing events, you could either store it in event-stores or in time-series database for further processing.

MQTT – Message Queue Telemetry Transport

What Is MQTT

  • A message protocol with “a small code footprint and on-the-wire footprint”.
  • MQTT is a publish-subscribe-based messaging protocol.
  • On top of TCP/IP.
  • Requires a broker (e.g. mosquito, hivemq, azure IO Hub).
  • ISO standard (ISO/IEC PRF 20922).
  • A message bus for: unreliable, high latency, low bandwidth
  • Payload with a plain byte array.

MQTT PUB/SUB

  • The protocol uses a publish/subscribe architecture in contrast to HTTP with its request/response paradigm.
  • Publish/Subscribe is event-driven and enables messages to be pushed to clients.
  • The central communication point is the MQTT broker, it is in charge of dispatching all messages between the senders and the rightful receivers.
  • Each client that publishes a message to the broker, includes a topic into the message. The topic is the routing information for the broker.
  • Each client that wants to receive messages subscribes to a certain topic and the broker delivers all messages with the matching topic to the client.
  • Therefore the clients don’t have to know each other, they only communicate over the topic.
  • This architecture enables highly scale-able solutions without dependencies between the data producers and the data consumers.

… and What Is With REST?

  • HTTP/REST is useful to handle documents and resources.
  • MQTT is useful to handle messages.
  • HTTP/REST can be complex and is not always the best solution for simple messages.
  • The MQTT packet size is 2 byte + payload.
  • MQTT supports 1-to-1, 1-to-many, and many-to-many messages.
  • Request and response vs publisher and subscriber.

Architecture

The difference to HTTP is that a client doesn’t have to pull the information it needs, but the broker pushes the information to the client, in case there is something new.

Therefore each MQTT client has a permanently open TCP connection to the broker. If this connection is interrupted by any circumstances, the MQTT broker can buffer all messages and send them to the client when it is back online.

IoT Architectures for Digital Twin With Apache Kafka

A digital twin is a virtual representation of something else. This can be a physical thing, process or service. This post covers the benefits and IoT architectures of a Digital Twin in various industries and its relation to Apache Kafka, IoT frameworks and Machine Learning. Kafka is often used as a central event streaming platform to build a scalable and reliable digital twin and digital thread for real-time streaming sensor data.

I already blogged about this topic recently in detail: Apache Kafka as Digital Twin for Open, Scalable, Reliable Industrial IoT (IIoT). Hence that post covers the relation to Event Streaming and why people choose Apache Kafka to build an open, scalable and reliable digital twin infrastructure.

Why IoT Needs a Cloud-Native IoT Messaging Service

Today, there are two main challenges to building an IoT application that provides bi-directional communication between IoT devices and IoT cloud platforms:

  1. The big cloud providers use IoT solutions that lock-in customer devices to the individual cloud provider.
  2. Managing and deploying a messaging service requires considerable expertise and resources. These factors are serious barriers for many companies that want to deploy production IoT applications.

You may also like: Multi-Cloud for IoT

Raspberry Pi IoT: Sensors, InfluxDB, MQTT, and Grafana

Learn how to build a dashboard based on Grafana that visualizes data acquired by sensors.

This Raspberry Pi IoT tutorial will build an IoT system that monitors sensors using InfluxDB, MQTT, and Grafana. In other words, we will build a dashboard based on Grafana that visualizes the data acquired by sensors.

You may also like: Playing With Docker, MQTT, Grafana, InfluxDB, Python, and Arduino

With this, InfluxDB stores the values read by sensors. All the systems exchange data using MQTT. The picture below better describes the whole Raspberry Pi IoT project.

Why MQTT Has Become the De-Facto IoT Standard

Happy birthday, MQTT!

This week, Andy Standford-Clark announced in a tweet the 20th anniversary of the first MQTT release. In those 20 years, it is clear that MQTT has become the de-facto standard for IoT. All major IoT cloud providers support MQTT, many popular IoT Platform vendors support MQTT, and survey results show MQTT is widely used for building IoT applications.

An interesting question to ask is “Why has MQTT has been successful?” What were the factors that led to the MQTT domination of IoT?

IoT and Event Streaming at Scale With Kafka and MQTT

A key challenge to IoT is the ability to integrate devices and machines that can process data in real-time and at scale.

The Internet of Things (IoT) is getting more and more traction as valuable use cases come to light. A key challenge, however, is integrating devices and machines to process the data in real-time and at scale. Apache Kafka ® and its surrounding ecosystem, which includes Kafka Connect, Kafka Streams, and KSQL, have become the technology of choice for integrating and processing these kinds of datasets.

You may also like: IoT: Device Data and Stream Processing

Kafka-native options to note for MQTT integration beyond Kafka client APIs like Java, Python, .NET, and C/C++ are:

Why MQTT Is Essential for Building Connected Cars

The automotive industry is embracing the idea of building a connected car. They see opportunity in using telemetry data from vehicles to create new revenue opportunities, and to build a better user experience. However, implementing a connected car service that can scale to support millions of cars can present some challenges.

For most connected car services, there is a requirement for bi-directional communication between the car and the cloud. Cars will send telemetry data to the cloud and enable apps like predictive maintenance, assisted driving, etc. Similarly, the car needs to be able to receive messages from the cloud to respond to remote commands, like remote lock/unlock door and remote activation of horn or lights.

MQTT Data Throttling

This article was first published on the MQTT.Cool blog.

Most MQTT brokers currently available on the market provide native support for WebSockets, thus enabling any MQTT JavaScript library to establish communications by encapsulating MQTT messages into WebSocket frames: This is called the MQTT Over WebSocket