1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 00:49:45 +01:00
RIOT/examples/paho-mqtt
Marian Buschsieweke cefbc394ca
pkg/lwip: automatically pull in lwip_netdev
Pull in lwip_netdev for netdev integration automatically if there is
any netdev to integrate, otherwise don't pull in the module.

As a result, applications no longer need to select that module by hand.
2024-04-30 08:41:07 +02:00
..
main.c examples/paho-mqtt: remove superflous space 2022-12-07 22:32:19 +01:00
Makefile examples,tests: Drop redundant dependency 2023-04-19 16:58:10 +02:00
Makefile.board.dep examples, tests: Changes for the native64 board 2024-02-05 22:02:14 +01:00
Makefile.ci boards/weact-g030f6: add new board 2024-02-05 00:45:42 +01:00
Makefile.gnrc paho: use GNRC instead of lwip 2022-11-30 20:42:05 +01:00
Makefile.lwip pkg/lwip: automatically pull in lwip_netdev 2024-04-30 08:41:07 +02:00
README.md examples: add example for paho-mqtt package 2020-07-05 19:10:41 +02:00

About

This application demonstrates the usage of the Eclipse paho MQTT package in RIOT.

Setup

For using this example, two prerequisites have to be fulfilled:

  1. You need a running MQTT broker like Mosquitto broker for example. Take a look at Mosquitto Broker. Check online any guide that will help you setting up the broker into some port (a). For example this one for debian base linux users How to setup a Mosquitto MQTT Server and receive data.

  2. Your RIOT node needs to be able to speak to that broker at the same port you set in 1.

Setting up RIOT native on Linux

  • Run sudo ./dist/tools/tapsetup/tapsetup -c 1

Running the example

  • Run on RIOT's root directory:

    make -C examples/paho-mqtt all term

  • To connect to a broker, use the con command:

con  <broker ip addr> [port] [clientID] [user] [password] [keepalivetime]
  • broker ip addr: IPv6 or IPv4 broker address.
  • port: broker port. Default 1883
  • client ID: is the client id you set up on the broker. Default can be set through DEFAULT_MQTT_CLIENT_ID in your makefile. Otherwise is an empty string.
  • user: the one set in the broker, check online tutorial to do it regarding chosen broker. Default user can be set through DEFAULT_MQTT_USER in your makefile. Otherwise is an empty string.
  • password: the one set in the broker, check online tutorial to do it regarding chosen broker. Default user can be set through DEFAULT_MQTT_PWD in your makefile. Otherwise is an empty string.
  • keepalivetime: keep alive in seconds for your client. Default 10 secs.
  • To subscribe to a topic, run sub with the topic name as parameter and a QoS level between 1 to 3, e.g.
sub hello/world 2
  • To unsubscribe to a topic, run unsub with the topic name e.g.
unsub hello/world
  • For publishing, use the pub command with a QoS level between 1 to 3:
pub hello/world "One more beer, please." 2