Page 1 of 1
How to send MQTT to Node-RED
Posted: Sunday 14 April 2024 16:29
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:
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"
Setup:
Running Domoticz V 2024.1 on Synology in Docker. All other MQTT-traffic to Node-RED is working fine.
Any help is appreciated.
Re: How to send MQTT to Node-RED
Posted: Sunday 14 April 2024 21:05
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
Re: How to send MQTT to Node-RED
Posted: Sunday 14 April 2024 23:25
by waltervl
Never used this function but they also not popup in the default Domoticz/out topic?
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 7:44
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>"
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 19:56
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...
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:
And this is the actual setup:
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.
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..
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 19:57
by PieterS
This is the setup of the MQTT client gateway
This are the properties of the device:
The kind of device might have to do with the problem?
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 20:48
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"
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 21:32
by PieterS
Ah, making progress!
There is something passing by.
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?
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 21:58
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:
This is about the result I need..
I will play further tomorrow. My problem seems to be solved
Thanks a lot gentlemen!
Re: How to send MQTT to Node-RED
Posted: Monday 15 April 2024 22:37
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....
Re: How to send MQTT to Node-RED
Posted: Tuesday 16 April 2024 8:53
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