How to send MQTT to Node-RED Topic is solved

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

How to send MQTT to Node-RED

Post by PieterS »

I want to send data from a few devices in Domoticz to Node-RED. I followed the wiki https://www.domoticz.com/wiki/MQTT
Passed Setup, More Options, Data Push, MQTT and configured the form like this picture:

Image

The devices are updated every 5 minutes but I do not see any data in the log of Domoticz and also not in MQTT Explorer.

I expected twe new, fresh topics in Topic "energy" :cry:

Setup:
Running Domoticz V 2024.1 on Synology in Docker. All other MQTT-traffic to Node-RED is working fine.
Image

Any help is appreciated.
Synology with Domoticz build (V2024.7) in Docker
skippy711
Posts: 31
Joined: Friday 20 January 2017 17:52
Target OS: NAS (Synology & others)
Domoticz version: 2024.2
Location: Netherlands
Contact:

Re: How to send MQTT to Node-RED

Post by skippy711 »

Hi Pieter,

I use Node-Red solely to 'inject' values from MQTT into Domoticz, and maybe you do that as well. So I'm no expert in how to inject from Domoticz --> Node-Red, but perhaps you have to use the 'MQTT Client Gateway with LAN interface' in the Hardware tab.

Remote Server: in your case the 192.168.1.18
Port 1883 (should not be a surprise)
User & password if required
Topic OUT Prefix: Energy; I leave this empty for all my 'hardware' IDX (I only use an IN Prefix), but I just tested with one of the IDX and as soon as I put some prefix in this field I get readings in MQTT explorer with this prefix

Hope this gives you an idea, but probably there are more solutions and maybe others can help you with other paths.

Good luck
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by waltervl »

Never used this function but they also not popup in the default Domoticz/out topic?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Kedi
Posts: 536
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: How to send MQTT to Node-RED

Post by Kedi »

When you have configured the 'MQTT Client Gateway with LAN interface' hardware leave the Topic out prefix "domoticz/out"
The subscribe to "domoticz/out/<DeviceName>"
Logic will get you from A to B. Imagination will take you everywhere.
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by PieterS »

All members thnx for reply.

I had already a MQTT Client Gateway with LAN interface. In Setup were all devices (329) in the optionlist and they send a lot of data to domoticz/out... :o I was not able to filter that in MQTT Explorer.. My fault. If I put text in the searchfield it filters that topicname. But I want to filter a device in that topic... Maybe can someone explain that to me too?

This is the config of the MQTT client gateway:

Image

And this is the actual setup:

Image

But in the last hour there were no more messages send related to PVoutput. I do not see them passing by in MQTT Explorer and also not in debug screen of Node-RED.. This is how I subscribed to the input Node.

Image

So up till now no results..

I made on proposal of skippy711 another hardware device with only subscription to energy and 2 selected options but no results either.. :x
Last edited by PieterS on Monday 15 April 2024 19:58, edited 1 time in total.
Synology with Domoticz build (V2024.7) in Docker
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by PieterS »

This is the setup of the MQTT client gateway

Image

This are the properties of the device:

Image

The kind of device might have to do with the problem?
Synology with Domoticz build (V2024.7) in Docker
Kedi
Posts: 536
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: How to send MQTT to Node-RED

Post by Kedi »

Click in MQTT Explorer on the arrow of "domoticz/out"
Wait a moment until all or most of the "domoticz/out/<DeviceName> topic will be present.
Take that exact topic name to subscribe in Node-Red.
topic like: "domoticz/out/Electriciteit Verbruik"
Logic will get you from A to B. Imagination will take you everywhere.
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by PieterS »

Ah, making progress! :D There is something passing by.

Image

I guess that I have to change names: spaces not allowed. But the field "name" will be the name of the topic in NR?

So I will change the name of the device and use that as topicname in NR?
Synology with Domoticz build (V2024.7) in Docker
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by PieterS »

Using the "name" PVoutput-Goodwe as topic in the input node in NR is not successfull.

It seems I need child topics based on the name of devices. So I changed in the configuration of MQTT client gateway:
  • Topic Out Prefix: energy
  • Publish Topic: Name

This is about the result I need.. :D

Image

I will play further tomorrow. My problem seems to be solved :D

Thanks a lot gentlemen!
Synology with Domoticz build (V2024.7) in Docker
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by waltervl »

Better to use the default Domoticz/out as topic out prefix.
If you want to publish non energy related devices in the future to mqtt you will have a new problem....
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: How to send MQTT to Node-RED

Post by PieterS »

If I understand the principle I can change and organize the topics.
Now I created a new hardware-object in Domoticz to keep the data of energy together.😃
It is one way or the other.
In this case it is a good solution. But thanks for comment
Synology with Domoticz build (V2024.7) in Docker
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests