Can you run multiple MQTT On one RaspberryPi4?
I already have the "MQTT Client Gateway with LAN interface" running on Domoticz.
I'm about to introduce Shelly devices and would like to add a Zigbee dongle so will then need the ShellyMQTT and Zigbee2MQTT.
Can they all run on the same box, IP, port etc?
Multiple MQTT?
Moderator: leecollings
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
-
- Posts: 216
- Joined: Saturday 10 November 2018 18:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hungary
- Contact:
Re: Multiple MQTT?
They can use the same mqtt server, as the MQTT path used by the plugins is different. Just make sure to use enough CPU power and network bandwidth on mqtt server machine. A lot of device will make a lot of mqtt messages.
- FireWizard
- Posts: 1745
- Joined: Tuesday 25 December 2018 12:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Voorthuizen (NL)
- Contact:
Re: Multiple MQTT?
HI @Calzor Suzay
You wrote:
MQTT is a client/server protocol.
In order to use it, you need a MQTT server, often called a broker. This server can be installed on the same hardware as e.g. Domoticz.
There exist many different brokers, such as HiveMQ, Eclipse Mosquitto, etc.
A comprehensive list, you can find at https://github.com/hobbyquaker/awesome-mqtt#broker.
Probably one of the brokers (servers) that is most used, is Mosquitto,
It is sufficient to install one instance of Mosquitto on your host or even in your local network. It is possible to install a second instance, even on the same host, but in this case you need to give it another port number. The default port number is 1883 and if you install another MQTT server on the same device, you have to configure another port number, e.g. 1884.
All other devices, such as the Domoticz "MQTT Client Gateway with LAN interface" are clients (see the name). Also other "hardware" devices, such as Zigbee2MQTT, Shelly MQTT, but also the Desktop/Laptop clients, as MQTT Explorer and MQTTfx are clients. This is also the case with the CLI clients mosquitto_pub and mosquitto_sub, part of the mosquitto-clients package.
You can connect as many clients to your server, as you like (compare it as browser to a particular website).
Als the clients should publish their payloads under a different topic, so that other clients can subscribe to it.
@lwolf says:
To answer your question.
It is not necessary to change the port number, so leave it default 1883.
Your CPU power is more than enough. (I run one of my Mosquitto servers on a Pi 1) and MQTT is specially developed to run on low bandwidth networks.
See: https://mqtt.org/
From Wikipedia:
You wrote:
What do you really mean with "multiple MQTT"?Can you run multiple MQTT On one RaspberryPi4
MQTT is a client/server protocol.
In order to use it, you need a MQTT server, often called a broker. This server can be installed on the same hardware as e.g. Domoticz.
There exist many different brokers, such as HiveMQ, Eclipse Mosquitto, etc.
A comprehensive list, you can find at https://github.com/hobbyquaker/awesome-mqtt#broker.
Probably one of the brokers (servers) that is most used, is Mosquitto,
It is sufficient to install one instance of Mosquitto on your host or even in your local network. It is possible to install a second instance, even on the same host, but in this case you need to give it another port number. The default port number is 1883 and if you install another MQTT server on the same device, you have to configure another port number, e.g. 1884.
All other devices, such as the Domoticz "MQTT Client Gateway with LAN interface" are clients (see the name). Also other "hardware" devices, such as Zigbee2MQTT, Shelly MQTT, but also the Desktop/Laptop clients, as MQTT Explorer and MQTTfx are clients. This is also the case with the CLI clients mosquitto_pub and mosquitto_sub, part of the mosquitto-clients package.
You can connect as many clients to your server, as you like (compare it as browser to a particular website).
Als the clients should publish their payloads under a different topic, so that other clients can subscribe to it.
@lwolf says:
The different path, he mentioned, are the different topics. It is true for the plugin, you mentioned, but you should check that if you use MQTT, that the topics are different. But pay attention, that if two Domoticz instances, publish to the same MQTT server, they use the same topic (domoticz/out and domoticz/in). So do not configure 2 Domoticz devices to the same MQTT broker.They can use the same mqtt server, as the MQTT path used by the plugins is different
To answer your question.
Yes, all "hardware" can run on the same box and, yes that box has got one (wired) single IP address and Probably one (wireless) IP address.Can they all run on the same box, IP, port etc?
It is not necessary to change the port number, so leave it default 1883.
Your CPU power is more than enough. (I run one of my Mosquitto servers on a Pi 1) and MQTT is specially developed to run on low bandwidth networks.
See: https://mqtt.org/
From Wikipedia:
RegardsIt is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited.
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Multiple MQTT?
Ok so I'm thinking terminology or at least reading install FAQs that assume you have nothing and want to start from scratch.
I started off a while back with some Sonoff devices that I flashed with tasmota, at that point I ran through the wiki here https://www.domoticz.com/wiki/MQTT and installed Node.JS, Node-RED and an MQTT broker.
I believe this resulted in the "MQTT Client Gateway with LAN interface" under hardware.
Then I added 1 shelly device which I installed the ShellyMQTT python plug in for from here https://github.com/enesbcs/Shelly_MQTT
Which reading again looks like it points back to the MQTT server I setup in the first bit for Tasmota.
Now I want to add a Zigbee dongle and looking at this https://www.zigbee2mqtt.io/getting_star ... 2mqtt.html and it says "Before starting make sure you have an MQTT broker installed on your system" which I assume is the thing I installed right at the start for the Tasmota/MQTT requirement.
Is that a correct assumption?
In which case if it is I'm good to go and just need to get the dongle and then zigbee2mqtt but then I thought how does it appear in Domoticz and confused myself again.
Basically how do I get Zigbee devices into Domoticz, am I following the right path with zigbee2mqtt?
I plan on buying the ZZH device.
I started off a while back with some Sonoff devices that I flashed with tasmota, at that point I ran through the wiki here https://www.domoticz.com/wiki/MQTT and installed Node.JS, Node-RED and an MQTT broker.
I believe this resulted in the "MQTT Client Gateway with LAN interface" under hardware.
Then I added 1 shelly device which I installed the ShellyMQTT python plug in for from here https://github.com/enesbcs/Shelly_MQTT
Which reading again looks like it points back to the MQTT server I setup in the first bit for Tasmota.
Now I want to add a Zigbee dongle and looking at this https://www.zigbee2mqtt.io/getting_star ... 2mqtt.html and it says "Before starting make sure you have an MQTT broker installed on your system" which I assume is the thing I installed right at the start for the Tasmota/MQTT requirement.
Is that a correct assumption?
In which case if it is I'm good to go and just need to get the dongle and then zigbee2mqtt but then I thought how does it appear in Domoticz and confused myself again.
Basically how do I get Zigbee devices into Domoticz, am I following the right path with zigbee2mqtt?
I plan on buying the ZZH device.
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Multiple MQTT?
Think I just bumbled my way across the domoticz-zigbee2mqtt-plugin
So in summary I need:-
Dongle https://www.tindie.com/products/electro ... -rf-stick/
zigbee2mqtt installed https://www.zigbee2mqtt.io/getting_star ... 2mqtt.html
domoticz-zigbee2mqtt-plugin https://github.com/stas-demydiuk/domoti ... qtt-plugin
??
So in summary I need:-
Dongle https://www.tindie.com/products/electro ... -rf-stick/
zigbee2mqtt installed https://www.zigbee2mqtt.io/getting_star ... 2mqtt.html
domoticz-zigbee2mqtt-plugin https://github.com/stas-demydiuk/domoti ... qtt-plugin
??
- FireWizard
- Posts: 1745
- Joined: Tuesday 25 December 2018 12:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Voorthuizen (NL)
- Contact:
Re: Multiple MQTT?
Hi, @Calzor Suzay,
You wrote:
Fot your applications, in fact, the MQTT server is the heart of the system.
All kind of devices, like the Sonoff (flashed with Tasmota), Shelly or Zigbee devices, using Zigbee2MQTT, but also others publish their values to the MQTT server. All the plugins subscribe to the corresponding topics on the server and write directly the values to Domoticz.
Sometimes, we use an application or solution for which no plugin exists. In this case we can use Node Red, who subscribes to the published topic. We can convert the values into a by Domoticz readable format and publish it to the same server under the topic domoticz/in. Domoticz is able to read that data and controls the virtual sensor.
I think with you hardware/software selection you are on the right track and you will succeed.
Regards
You wrote:
In this case you have your complete infra structure ready and you have the tools to handle almost every challenge. In addition you can use several scripts and plugins.I ran through the wiki here https://www.domoticz.com/wiki/MQTT and installed Node.JS, Node-RED and an MQTT broker.
Fot your applications, in fact, the MQTT server is the heart of the system.
All kind of devices, like the Sonoff (flashed with Tasmota), Shelly or Zigbee devices, using Zigbee2MQTT, but also others publish their values to the MQTT server. All the plugins subscribe to the corresponding topics on the server and write directly the values to Domoticz.
Sometimes, we use an application or solution for which no plugin exists. In this case we can use Node Red, who subscribes to the published topic. We can convert the values into a by Domoticz readable format and publish it to the same server under the topic domoticz/in. Domoticz is able to read that data and controls the virtual sensor.
Right, you have installed the broker.(server)."Before starting make sure you have an MQTT broker installed on your system" which I assume is the thing I installed right at the start for the Tasmota/MQTT requirement. Is that a correct assumption?
This is handled by the Domoticz plugin: https://github.com/stas-demydiuk/domoti ... qtt-plugin.In which case if it is I'm good to go and just need to get the dongle and then zigbee2mqtt but then I thought how does it appear in Domoticz and confused myself again.
I think with you hardware/software selection you are on the right track and you will succeed.
Regards
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Multiple MQTT?
Thanks for confirming
I have some Shelly kit on order so will play with this first before adding Zigbee as well.
I have some Shelly kit on order so will play with this first before adding Zigbee as well.
-
- Posts: 216
- Joined: Saturday 10 November 2018 18:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Hungary
- Contact:
Re: Multiple MQTT?
I recommend using Domoticz Plugins Manager which has a nice GUI after you can succesfully install it, and in the future you can install or update Python plugins with one click:Calzor Suzay wrote: ↑Sunday 10 January 2021 22:42 Basically how do I get Zigbee devices into Domoticz, am I following the right path with zigbee2mqtt?
https://github.com/stas-demydiuk/domoti ... ns-manager
(list includes domoticz-zigbee2mqtt and shelly_mqtt plugin amongs a lot of other plugin)
Who is online
Users browsing this forum: No registered users and 1 guest