0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MeePet に mosquitto をインストールする

Posted at

以前、 Node-Red 単体でも MQTT Broker が使えることを確認したが、その前に行った mosquitto のインストールについても記事化しておく。
Aedes MQTT broker は MQTT V5 で接続できなかったが、 mosquitto だと MQTT V5 で接続可能なため、用途によっては mosquitto の方が適しているかもしれない。

mosquitto のインストール

公式サイトには Linux でのインストールに snap や Ubuntu レポジトリを使うよう書いてある。

Termux も pkg(apt) は使えるので、 pkg install mosquitto をしたところ、あっさりインストールできた。

ただし、そのままでは自機でしか使えないため、他の PC ・機器が接続できるよう設定を変更する必要がある。

/data/data/com.termux/files/usr/etc/mosquitto/mosquitto.conf
listener 1883
allow_anonymous true

この2行を探し、コメントアウトを外してオプションを書き換え・書き足す。

さらに、 mosquitto.conf を読み込ませるため、 -c オプションを付けて起動する必要があるという。

前後でコンソール出力を比較してみると
mosquitto1.png
mosquitto2.png

同一 LAN 使用を前提として allow_anonymoustrue に設定しているため、 subscribe 側の設定はサーバーIPアドレスとトピックだけでよい。
Node-Red で Publish した情報が MQTTX と MyMQTT で受信できることを確認した。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?