MQTT Message Not Being Sent

Hi Team,

I have a dashboard that I use for scheduling, I use inject nodes injecting into function blocks.
The function blocks contain several message.

Example

let var_obj_message = {};

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/scheduler";
var_obj_message.payload = "05:00:00";
node.send(var_obj_message);

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/switch/01";
var_obj_message.payload = "off";
node.send(var_obj_message);

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/switch/02";
var_obj_message.payload = "off";
node.send(var_obj_message);

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/switch/03";
var_obj_message.payload = "off";
node.send(var_obj_message);

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/switch/04";
var_obj_message.payload = "off";
node.send(var_obj_message);

var_obj_message.topic = "feeds/thing-x/process-io-z/incoming/io/switch/05";
var_obj_message.payload = "off";
node.send(var_obj_message);

For some odd reason only the first message gets sent, I added a debug node and looking at that it shows all the messages being sent.

I run two of the same type of things and these work fine without any issues.

This is my debug output

28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '10:00:00',
  _msgid: '49abbcd39f74fc36'
}
28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'off',
  _msgid: '49abbcd39f74fc36'
}
28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/02',
  payload: 'off',
  _msgid: '49abbcd39f74fc36'
}
28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/03',
  payload: 'off',
  _msgid: '49abbcd39f74fc36'
}
28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/04',
  payload: 'off',
  _msgid: '49abbcd39f74fc36'
}
28 Aug 10:00:00 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/05',

How do you know that?

If you create a debug and an mqtt-in node subscribed to feeds/thing-x/process-io-z/incoming/io/switch/# what does it show?

let me add that and check, I used mosquitto_sub to check

Install MQTTExplorer on a PC, it is an excellent way of seeing what is going on with MQTT.

This is the debug output for the mqtt receiver subscripted to that topic, only the first two messages are sent

28 Aug 22:50:01 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '22:50:00',
  qos: 2,
  retain: false,
  _msgid: 'cdeb3f5e34d41c06'
}
28 Aug 22:50:01 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: 'f09749e4dfee535d'
}
29 Aug 00:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '00:00:00',
  qos: 2,
  retain: false,
  _msgid: '183d77f646604476'
}
29 Aug 00:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: '6711ee391f7131fd'
}
29 Aug 01:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '01:00:00',
  qos: 2,
  retain: false,
  _msgid: '8b37d66a719b1619'
}
29 Aug 01:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: 'a9877310f0cf94b7'
}
29 Aug 02:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '02:00:00',
  qos: 2,
  retain: false,
  _msgid: '17e64a6a5d8402dc'
}
29 Aug 02:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: '7bfde283e829467e'
}
29 Aug 05:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '05:00:00',
  qos: 2,
  retain: false,
  _msgid: 'b979eec32545c781'
}
29 Aug 05:00:00 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'off',
  qos: 2,
  retain: false,
  _msgid: '6bc4c3154baaab51'
}


On my computer with this flow, the function sends 6 messages eg
image

If I feed them through mqtt-out and mqtt-in (Mosquitto) I see all 6 messages eg
image

What version of Node-red do you have?
What platform are you running it on?
What MQTT broker are you using?
Can you show us a screen capture of your flow?

What version of Node-red do you have?
V4.0.0

What platform are you running it on?
Raspberry Pi 5

What MQTT broker are you using?
Mosquito

The odd thing is I have several of these that all work fine except for this one.

Here is a export

[
    {
        "id": "72c7a56419da2980",
        "type": "tab",
        "label": "wcx.io.z.scheduling",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "3b7a6f0b1e6d6c1d",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"05:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 40,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "3d9ce95c723d8517",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"05:50:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 100,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "a1c614234917a123",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"10:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 160,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "f5ea6dde6102dd4a",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"15:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 220,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "b10514be95ac0885",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"15:50:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 280,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "f27cbcb83a6bd4f9",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"17:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 340,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "54231b96a8a542c0",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"17:50:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 400,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "c5a9e93d6988f581",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"22:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 460,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "c27983ee91f8d4a9",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"22:50:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 520,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "dbbc5bb517919a95",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"00:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 580,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "92e48d9deebc7b49",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"01:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 640,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "044f4fa004ce3053",
        "type": "function",
        "z": "72c7a56419da2980",
        "name": "function.io.switch",
        "func": "let var_obj_message = {};\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/scheduler\";\nvar_obj_message.payload = \"02:00:00\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/01\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/02\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/03\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/04\";\nvar_obj_message.payload = \"on\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/05\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/06\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/07\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nvar_obj_message.topic = \"feeds/thing-x/process-io-z/incoming/io/switch/08\";\nvar_obj_message.payload = \"off\";\nnode.send(var_obj_message);\n\nnode.done();",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 700,
        "wires": [
            [
                "a0ceeabe7e0f461a",
                "fecd7f06c22b8be4"
            ]
        ]
    },
    {
        "id": "a0ceeabe7e0f461a",
        "type": "mqtt out",
        "z": "72c7a56419da2980",
        "name": "mqtt.out",
        "topic": "",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "66d480061cc03526",
        "x": 980,
        "y": 320,
        "wires": []
    },
    {
        "id": "277f52a91b7b5c17",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.05:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 05 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 40,
        "wires": [
            [
                "3b7a6f0b1e6d6c1d"
            ]
        ]
    },
    {
        "id": "4733b44d1ebb6cc1",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.05:50:00",
        "props": [],
        "repeat": "",
        "crontab": "50 05 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 100,
        "wires": [
            [
                "3d9ce95c723d8517"
            ]
        ]
    },
    {
        "id": "78376189bdd6ddde",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.10:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 10 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 160,
        "wires": [
            [
                "a1c614234917a123"
            ]
        ]
    },
    {
        "id": "a4392b6bc648acfe",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.15:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 15 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 220,
        "wires": [
            [
                "f5ea6dde6102dd4a"
            ]
        ]
    },
    {
        "id": "11258e95c1b5121e",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.15:50:00",
        "props": [],
        "repeat": "",
        "crontab": "50 15 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 280,
        "wires": [
            [
                "b10514be95ac0885"
            ]
        ]
    },
    {
        "id": "6c98db62247b7458",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.17:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 17 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 340,
        "wires": [
            [
                "f27cbcb83a6bd4f9"
            ]
        ]
    },
    {
        "id": "da080917fb1e8b49",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.17:50:00",
        "props": [],
        "repeat": "",
        "crontab": "50 17 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 400,
        "wires": [
            [
                "54231b96a8a542c0"
            ]
        ]
    },
    {
        "id": "de26f9dd825e8cce",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.22:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 22 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 460,
        "wires": [
            [
                "c5a9e93d6988f581"
            ]
        ]
    },
    {
        "id": "447c1a309630afd9",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.22:50:00",
        "props": [],
        "repeat": "",
        "crontab": "50 22 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 520,
        "wires": [
            [
                "c27983ee91f8d4a9"
            ]
        ]
    },
    {
        "id": "c0d37f3cc00f8231",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.00:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 00 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 580,
        "wires": [
            [
                "dbbc5bb517919a95"
            ]
        ]
    },
    {
        "id": "5458ec52644050a0",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.01:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 01 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 640,
        "wires": [
            [
                "92e48d9deebc7b49"
            ]
        ]
    },
    {
        "id": "6064ef3f7eecc564",
        "type": "inject",
        "z": "72c7a56419da2980",
        "name": "inject.02:00:00",
        "props": [],
        "repeat": "",
        "crontab": "00 02 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 120,
        "y": 700,
        "wires": [
            [
                "044f4fa004ce3053"
            ]
        ]
    },
    {
        "id": "fecd7f06c22b8be4",
        "type": "debug",
        "z": "72c7a56419da2980",
        "name": "debug.out.mqtt",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "counter",
        "x": 1000,
        "y": 380,
        "wires": []
    },
    {
        "id": "756704d8d7c552fc",
        "type": "mqtt in",
        "z": "72c7a56419da2980",
        "name": "mqtt.in",
        "topic": "feeds/thing-x/process-io-z/incoming/io/#",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "66d480061cc03526",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 970,
        "y": 180,
        "wires": [
            [
                "215aab6898d7d89d"
            ]
        ]
    },
    {
        "id": "215aab6898d7d89d",
        "type": "debug",
        "z": "72c7a56419da2980",
        "name": "debug.in.mqtt",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "counter",
        "x": 1200,
        "y": 180,
        "wires": []
    },
    {
        "id": "66d480061cc03526",
        "type": "mqtt-broker",
        "name": "wcx-services-mqtt",
        "broker": "",
        "port": "5050",
        "clientid": "node-red-z",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "50",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

I think you may have to give a bit more information about which mosquitto version you have.

Which one, version, etc.

Is mosquitto on the same computer as Node-red?

You could try putting a delay node in front of mqtt-out to rate limit it to eg 10 messages per second but I doubt if it will make a difference.

I find Mosquitto on a Pi very reliable and capable but you could experiment with a cloud based broker such as hivemq.

Please upgrade to the latest, though I do not expect it to make a difference.

Node red and mosquitto will easily handle thousands of messages a second, it isn't that.

Please change the debug nodes also Output to Console, then stop and start node-red in a command window, then run your code to publish the messages. Then copy/paste the complete command window output here please. Copy/paste not screenshot please.

29 Aug 10:57:35 - [info]
Welcome to Node-RED
===================
29 Aug 10:57:35 - [info] Node-RED version: v4.0.2
29 Aug 10:57:35 - [info] Node.js  version: v18.20.3
29 Aug 10:57:35 - [info] Linux 6.6.20+rpt-rpi-2712 arm64 LE
29 Aug 10:57:35 - [info] Loading palette nodes
29 Aug 10:57:35 - [info] Dashboard version 3.6.5 started at /
29 Aug 10:57:36 - [info] Settings file  : /home/admin/.node-red/settings.js
29 Aug 10:57:36 - [info] Context store  : 'default' [module=memory]
29 Aug 10:57:36 - [info] User directory : /home/admin/.node-red
29 Aug 10:57:36 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 Aug 10:57:36 - [info] Flows file     : /home/admin/.node-red/flows.json
29 Aug 10:57:36 - [info] Server now running at http://127.0.0.1:8080/admin/
29 Aug 10:57:36 - [info] Starting flows
29 Aug 10:57:36 - [info] Started flows
29 Aug 10:57:36 - [info] [xxxxx] Connected to broker: node-red-z@mqtt://wxxx
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '05:50:00',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/02',
  payload: 'on',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/03',
  payload: 'on',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/04',
  payload: 'on',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/05',
  payload: 'off',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/06',
  payload: 'off',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/07',
  payload: 'off',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.out.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/08',
  payload: 'off',
  _msgid: 'b291cdc418d47b5b'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/scheduler',
  payload: '05:50:00',
  qos: 2,
  retain: false,
  _msgid: 'c9858afb865a5569'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/01',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: 'cb8bca6cf611d391'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/02',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: 'ffb985a26b684b86'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/03',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: 'a2240bdd2feae961'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/04',
  payload: 'on',
  qos: 2,
  retain: false,
  _msgid: '3ae9b998028543f4'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/05',
  payload: 'off',
  qos: 2,
  retain: false,
  _msgid: '2c3701de2b191280'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/06',
  payload: 'off',
  qos: 2,
  retain: false,
  _msgid: 'fab0d0714500cb6b'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/07',
  payload: 'off',
  qos: 2,
  retain: false,
  _msgid: '2ffe56462377073c'
}
29 Aug 10:57:56 - [info] [debug:debug.in.mqtt]
{
  topic: 'feeds/thing-x/process-io-z/incoming/io/switch/08',
  payload: 'off',
  qos: 2,
  retain: false,
  _msgid: '04edc635e6358dd1'
}

Broker is on a separate PI 5, stage thing is if I run trigger the inject manually it works fine

Sorry, I am trying to not get too involved. But also would like to help.

Which inject node?

On the screen shot you posted, there are quite a few of them.

Or is it if you press ANY inject node it works?
(Just for clarity)

Oh, another question that I feel needs to be asked:
Is that PI 5 on the same subnet/vlan as the other machines?
Sorry, just I have been caught with VLAN/subnet traps and it was a bit annoying.

Oh, also - sorry:
Could you draw a basic map of your network?

eg:

Any of the inject nodes. If I tigger them manualy messages comes through no issues, If they are triggered by the time interval only the first two messages are sent.

All on the same subnet no plans.

and on the same node red server I have identical flows but different topics that all work fine no issues

Ok, sorry. To me the question was begging to be asked.

Indulge me
Could you open one/any of those function nodes and copy/paste the code?

I am at a loss to see.....

I'm not seeing where the time interval is injected.

Ok, at this point you may be torn between posting ALL the flow - not really good for people sometimes/most time - but I would like to see how it is supposed to work.

Ok, from that:

What are the MQTT OUT nodes set to?

Just in case their topics are set differently.

Maybe take screen shots of them both.

The working one and the non working one.

Shrug.
Just sharing ideas.

HANG ON!!??

I have identical flows but different topics that all work fine

Sorry, that does not compute (lost in space 70's show reference)

Try adding a delay node after the function node and set it to 5 milliseconds and see if that changes anything. The reason I'm suggesting that is because in your debug the _msgid is the same in each of the debug:debug.out.mqtt you show.

1 Like

Leave the log open and wait for a triggered inject and see what you see in the log then.

That will likely be because they are all clones of the same original message. node.send() clones the message when it sends it, but that will not change the msg id.
I suspect something else is happening at the same time when the node triggers on the interval and is crashing node-red or locking something up. or something similar.

1 Like