Node-RED : MQTT subscribe on generic topic

Home Forums General Node-RED : MQTT subscribe on generic topic

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #16488
    Claude Favreau
    Participant

    Hi,

    I post a message because I didn’t really find a solution about my problem. I am developing a generic flow on Node-RED that I could deploy on severals gateways. What I am trying to do is to receive some messages on a MQTT topic that I subscribed. But I didn’t find a good way to have a generic “topic” like this :

    gateway/{serialNumber}/input

    Where the serial number is automatically filled. Someone has had to do this stuff ? Today my solution is to create a custom MQTT node but I would like to know if there are not better solution.

    Regards

    #16503
    Peter Ferland
    Blocked

    For MQTT topics the wildcard is ‘+’ so if you wanted to subscribe to every gateway’s input topic you would use “gateway/+/input”.

    If you wish to put your own string there for a specific gateway’s serial number, you’d need to build the string in a javascript node and then set the string as the topic property in the msg.

    #16505
    Claude Favreau
    Participant

    Hi,

    Yes I am agree with you but I wouldn’t to have many charge on gateways. Therefore, to avoid this problem I need to subscribe a specific topic with the serial number for each gateway. For an input mqtt node we canot give a topic like you told me.

    I think the way is to have a custom node if I want to insert the serial number from each gateway dynamically. But I would like to be sure.

    Regards

    #16507
    Peter Ferland
    Blocked

    For a MQTT input node you are correct, there is no way to programmatically set the topic on an input using the built in nodes so you would have to create a custom node to handle that.

    #16581
    Claude Favreau
    Participant

    Hi,

    Thanks very much. I have another question linked to this post. Do you know how to create a custom Node-RED app ? Because if I overwrite or I add a custom node for MQTT, I would like to have the possibility to deploy it on severals gateway easily.

    Regards

    #16582
    Peter Ferland
    Blocked

    There is extensive discussion on adding nodes to node-red on the Conduit in this thread: http://www.multitech.net/developer/forums/topic/adding-nodes-to-node-red/page/2/

    Once you figure out what commands need to be run, you can execute them in the install script in a custom application package and use DeviceHQ to deploy the custom application to each of your gateways. http://www.multitech.net/developer/software/aep/creating-a-custom-application/

    #16659
    Claude Favreau
    Participant

    Hi,

    Thanks, it helps me in what I want to do.

    Regards

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.