Using external MQTT Broker with Zigbee2mqtt

33 views
Skip to first unread message

Ulf Holt

unread,
May 28, 2025, 5:27:17 PMMay 28
to TasmotaUsers
I have just set up some zigbee devices using Node-Red and local MQTT server. This works fine, but I would love to be able to use HiveMQ instead, so I can access my devices wherever they are.

The configuration I would like to try looks like this:Setup.png
It works fine if I use localhost:1883
I will, of course, have to change the server name. which is a simple task, but I think I will also need a tls-config file, and I have no idea how this should be done. I am using Tasmota for my ESP32 and ESP8266 devices, and TLS works fine, so maybe I can find something in the my_user_config.h file?

Any help would be appreciated

Best regards

Ulf H.


Justin Adie

unread,
May 28, 2025, 5:54:55 PMMay 28
to Ulf Holt, SonoffUsers
Would you be interested in making the zigbee devices matter compatible and having access to them via Alexa/Google etc?  Using node-red flows.  



On 28 May 2025, at 22:27, Ulf Holt <ulf....@gmail.com> wrote:

I have just set up some zigbee devices using Node-Red and local MQTT server. This works fine, but I would love to be able to use HiveMQ instead, so I can access my devices wherever they are.

The configuration I would like to try looks like this:<Setup.png>
It works fine if I use localhost:1883
I will, of course, have to change the server name. which is a simple task, but I think I will also need a tls-config file, and I have no idea how this should be done. I am using Tasmota for my ESP32 and ESP8266 devices, and TLS works fine, so maybe I can find something in the my_user_config.h file?

Any help would be appreciated

Best regards

Ulf H.



--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/sonoffusers/5faae382-dbbc-46b4-b780-7307d9f526f4n%40googlegroups.com.
<Setup.png>

Ulf Holt

unread,
May 28, 2025, 10:43:27 PMMay 28
to Justin Adie, SonoffUsers
I am using Node-Red as a platform for several other devices, and I am not very fond of Alexa or Home Assistant, but thank you for the suggestion. 

28. mai 2025 kl. 23:54 skrev Justin Adie <justi...@adieandco.com>:

Would you be interested in making the zigbee devices matter compatible and having access to them via Alexa/Google etc?  Using node-red flows.  

Justin Adie

unread,
May 29, 2025, 2:41:52 AMMay 29
to Ulf Holt, SonoffUsers
Two thoughts. 

1. Why not make your local mqtt server available publicly with a port forward rule? 

2. Bridge your local mqtt to hivemq. (I do this with my own public mqtt servers).
 there would be no need to reflash local devices. Transpare to tasmota so it would work on non esp32 devices.  All that you would need to do is 

1. Set up hiveMQ
2. Change the config for your local mqtt server to add the bridge 
3. Add the hiveMQ root certs


Assuming a raspberry pi you'd do something like this


Edit your mqtt config to add this (or if you are using s folder style config add this as conf.d/hiveBridge.conf)


connection hive_bridge
address mqtt.example.hivemq.cloud:8883
topic  //include a wild card to pick up topics of interest.  For everything use #

# Auth (if required)
remote_username your_hivemq_username
remote_password your_hivemq_password

bridge_cafile /etc/ssl/certs/ca-certificates.crt
bridge_insecure false
start_type automatic
cleansession true



Then make sure your certificate store is up to date

sudo apt update
sudo apt install --reinstall ca-certificates


Then restart your mqtt 

sudo systemctl restart mosquitto


The bridge should form automatically 

If you use ACL on your local mqtt config then there's an extra step to go through which I can share if needs be. 

ulf....@gmail.com

unread,
May 29, 2025, 1:02:25 PMMay 29
to Justin Adie, SonoffUsers

Interesting!

 

I am running on a Raspberry Pi 3 using latest version of bookworm.

Have just tried to bridge to hivemq, following your instructions. No error messages, but how can I check if it is working? I have tried to connect a mqtt-in node to the hiveMQ cluster, using # as the topic, but cannot see anything from the climate-sensor nodes which reports to my local mosquito broker, though I can se they are reporting using debug nodes connected to the climate-sensor nodes.

Justin Adie

unread,
May 29, 2025, 1:31:07 PMMay 29
to Ulf Holt, SonoffUsers
Easiest way is to listen to a known active topic.

If you are not seeing any traffic then look at the logs on the pi.  

ulf....@gmail.com

unread,
May 29, 2025, 1:59:12 PMMay 29
to Justin Adie, SonoffUsers

Looks like I might have found a solution that so far seems to work.

 

I configure a mqtt-out node, and connect it to the my HiveMQ cluster.

I set the topic to one of the object entries that comes from the

Climate-sensor nodes I have. I then log in to another system which is not using the local Mosquitto broker. When I set up mqtt-in node and connect it to HiveMQ, I can see the information that is sent from the other system. I do not have to configure a mqtt-bridge.

 

I will do some more testing, but so far it looks promising.

 

Best regards

 

Ulf

 

Justin Adie

unread,
May 29, 2025, 2:04:12 PMMay 29
to Ulf Holt, SonoffUsers
That is a bridge but you’re using a client to create the bridge rather than getting the server to do it for you efficiently.  If it works for you that’s great.  

ulf....@gmail.com

unread,
May 29, 2025, 3:22:50 PMMay 29
to Justin Adie, SonoffUsers

New update.

 

If I use a zigbe2mqtt Bridge instead, I will also get information about which device that is sending the information. Only problem is that the bridge is switching Offline every second minute or so and then is switched on after about 20 seconds.

 

Fra: Justin Adie <justi...@adieandco.com>
Sendt: 29 May 2025 20:04
Til: Ulf Holt <ulf....@gmail.com>
Kopi: SonoffUsers <sonof...@googlegroups.com>
Emne: Re: Using external MQTT Broker with Zigbee2mqtt

 

That is a bridge but you’re using a client to create the bridge rather than getting the server to do it for you efficiently.  If it works for you that’s great.  

Reply all
Reply to author
Forward
0 new messages