Mqtt node red

Hi, I’m a newbie to HA, I have made a gas sensor with ESP32, publishing topic publish/gas/mq5 and i get this messages in developer tools-mqtt-listen to topic page as “Message 3501 received on publish/gas/mq5 at 23:56:
m1=160
QoS: 0 - Retain: false”
But in nodered when is create mqtt it shows only connecting why? I couldnt see any debug messages. I have set server- local:1883 port, also topic-publish/gas/mq5. Someone help me… :face_with_head_bandage:

Can you show your Node Red flow including the exported code?

Sure…
[{“id”:“1a19ea90.5518a5”,“type”:“mqtt in”,“z”:“84511314.ede24”,“name”:"",“topic”:“publish/gas/mq5”,“qos”:“0”,“datatype”:“json”,“broker”:“41a0a0cf.de78e”,“x”:120,“y”:260,“wires”:[[“b60ee9db.b90d98”]]},{“id”:“b60ee9db.b90d98”,“type”:“debug”,“z”:“84511314.ede24”,“name”:"",“active”:true,“console”:“false”,“complete”:“false”,“x”:330,“y”:260,“wires”:[]},{“id”:“41a0a0cf.de78e”,“type”:“mqtt-broker”,“z”:"",“name”:"",“broker”:“localhost”,“port”:“1883”,“clientid”:"",“usetls”:false,“compatmode”:false,“keepalive”:“60”,“cleansession”:true,“birthTopic”:"",“birthQos”:“0”,“birthPayload”:"",“closeTopic”:"",“closePayload”:"",“willTopic”:"",“willQos”:“0”,“willPayload”:""}]

Listen to a topic

Listening to
publish/gas/mq5

Message 35 received on publish/gas/mq5 at 23:07:
86
QoS: 0 - Retain: false
Message 34 received on publish/gas/mq5 at 23:07:
44
QoS: 0 - Retain: false

I got a serious doubt…
Is it necessary to install this? ‘node-red-contrib-mqtt-broker’
Palette?

I’m assuming you’ve already installed the MQTT add-on to Home Assistant. Without it you wouldn’t be able to see the messages in Developer Tools.

Your Node Red MQTT node is connected to localhost. I think this would resolve to the IP of the docker container (eg. 172.17.0.10), not the machine everything is running on. Try changing it to 127.0.0.1 (or the IP address of the machine if it is static in your LAN).

Have you installed an MQTT broker and configured it in HA? If not, you’re probably getting the unsupported deprecated one. The recommended approach is this HA add-on.

Also, when posting code, use </> in the toolbar. All of your double-quotes were converted to ones that cannot be imported.

Ya I have installed mqtt broker add on and also configured it. It’s running well but in log it shows new connection connected, below that it states 173...* (don’t remember exact) and says socket error and time out disconnecting. I will send you all messages when i get back home.

MQTT Log-
1593015374: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1593015375: New client connected from 172.30.32.1 as auto-2EF30DBC-DF2C-B4AC-2A5A-4DD50A62E33C (p2, c1, k60, u’homeassistant’).
1593015451: New connection from 192.168.0.55 on port 1883.
[INFO] found mqtt on local database
1593015451: New client connected from 192.168.0.55 as auto-E359F9D6-F37D-FDFD-804F-A86AC780F9FB (p2, c1, k15, u’mqtt’).

[
    {
        "id": "1a19ea90.5518a5",
        "type": "mqtt in",
        "z": "84511314.ede24",
        "name": "",
        "topic": "publish/gas/mq5",
        "qos": "0",
        "datatype": "json",
        "broker": "41a0a0cf.de78e",
        "x": 120,
        "y": 260,
        "wires": [
            [
                "b60ee9db.b90d98"
            ]
        ]
    },
    {
        "id": "b60ee9db.b90d98",
        "type": "debug",
        "z": "84511314.ede24",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 330,
        "y": 260,
        "wires": []
    },
    {
        "id": "41a0a0cf.de78e",
        "type": "mqtt-broker",
        "z": "",
        "name": "",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
[{"id":"1a19ea90.5518a5","type":"mqtt in","z":"84511314.ede24","name":"","topic":"publish/gas/mq5","qos":"0","datatype":"json","broker":"41a0a0cf.de78e","x":120,"y":260,"wires":[["b60ee9db.b90d98"]]},{"id":"b60ee9db.b90d98","type":"debug","z":"84511314.ede24","name":"","active":true,"console":"false","complete":"false","x":330,"y":260,"wires":[]},{"id":"41a0a0cf.de78e","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

After sometime I got these in my MQTT Broker Log

1593015849: New client connected from 192.168.0.55 as auto-9D6E27C4-CF46-C2CE-9CAE-28D9E4979B45 (p2, c1, k15, u'mqtt').
1593015850: New connection from 172.30.32.1 on port 1883.
1593015850: Socket error on client <unknown>, disconnecting.
1593015861: Client auto-168CD94D-1B25-52B4-8CF2-C7A912605FB4 has exceeded timeout, disconnecting.
1593015865: New connection from 172.30.32.1 on port 1883.
1593015865: Socket error on client <unknown>, disconnecting.
1593015880: New connection from 172.30.32.1 on port 1883.
1593015880: Socket error on client <unknown>, disconnecting.
1593015895: New connection from 172.30.32.1 on port 1883.
1593015895: Socket error on client <unknown>, disconnecting.
1593015910: New connection from 172.30.32.1 on port 1883.
1593015910: Socket error on client <unknown>, disconnecting.
1593015925: New connection from 172.30.32.1 on port 1883.
1593015925: Socket error on client <unknown>, disconnecting.
1593015940: New connection from 172.30.32.1 on port 1883.
1593015940: Socket error on client <unknown>, disconnecting.
1593015955: New connection from 172.30.32.1 on port 1883.
1593015955: Socket error on client <unknown>, disconnecting.
1593015970: New connection from 172.30.32.1 on port 1883.
1593015970: Socket error on client <unknown>, disconnecting.
1593015985: New connection from 172.30.32.1 on port 1883.
1593015985: Socket error on client <unknown>, disconnecting.
1593016000: New connection from 172.30.32.1 on port 1883.
1593016000: Socket error on client <unknown>, disconnecting.
1593016015: New connection from 172.30.32.1 on port 1883.
1593016015: Socket error on client <unknown>, disconnecting.
1593016030: New connection from 172.30.32.1 on port 1883.
1593016030: Socket error on client <unknown>, disconnecting.
1593016045: New connection from 172.30.32.1 on port 1883.
1593016045: Socket error on client <unknown>, disconnecting.
1593016060: New connection from 172.30.32.1 on port 1883.
1593016060: Socket error on client <unknown>, disconnecting.
1593016075: New connection from 172.30.32.1 on port 1883.
1593016075: Socket error on client <unknown>, disconnecting.
1593016090: New connection from 172.30.32.1 on port 1883.
1593016090: Socket error on client <unknown>, disconnecting.
1593016105: New connection from 172.30.32.1 on port 1883.
1593016105: Socket error on client <unknown>, disconnecting.
1593016120: New connection from 172.30.32.1 on port 1883.
1593016120: Socket error on client <unknown>, disconnecting.
1593016135: New connection from 172.30.32.1 on port 1883.
1593016135: Socket error on client <unknown>, disconnecting.
1593016150: New connection from 172.30.32.1 on port 1883.
1593016150: Socket error on client <unknown>, disconnecting.
1593016166: New connection from 172.30.32.1 on port 1883.
1593016166: Socket error on client <unknown>, disconnecting.
1593016181: New connection from 172.30.32.1 on port 1883.
1593016181: Socket error on client <unknown>, disconnecting.
1593016196: New connection from 172.30.32.1 on port 1883.
1593016196: Socket error on client <unknown>, disconnecting.
1593016211: New connection from 172.30.32.1 on port 1883.
1593016211: Socket error on client <unknown>, disconnecting.
1593016226: New connection from 172.30.32.1 on port 1883.
1593016226: Socket error on client <unknown>, disconnecting.
1593016241: New connection from 172.30.32.1 on port 1883.
1593016241: Socket error on client <unknown>, disconnecting.
1593016256: New connection from 172.30.32.1 on port 1883.
1593016256: Socket error on client <unknown>, disconnecting.
1593016271: New connection from 172.30.32.1 on port 1883.
1593016271: Socket error on client <unknown>, disconnecting.
1593016286: New connection from 172.30.32.1 on port 1883.
1593016286: Socket error on client <unknown>, disconnecting.
1593016301: New connection from 172.30.32.1 on port 1883.
1593016301: Socket error on client <unknown>, disconnecting.

But still i receive messages in developer tools
Message 8 received on publish/gas/mq5 at 22:05:

304

QoS: 0 - Retain: false

Message 7 received on publish/gas/mq5 at 22:05:

307

QoS: 0 - Retain: false

Message 6 received on publish/gas/mq5 at 22:04:

272

QoS: 0 - Retain: false

Message 5 received on publish/gas/mq5 at 22:04:

306

QoS: 0 - Retain: false

Message 4 received on publish/gas/mq5 at 22:04:

240

QoS: 0 - Retain: false

Message 3 received on publish/gas/mq5 at 22:04:

243

QoS: 0 - Retain: false

Message 2 received on publish/gas/mq5 at 22:04:

286

QoS: 0 - Retain: false

Message 1 received on publish/gas/mq5 at 22:04:

285

QoS: 0 - Retain: false

Message 0 received on publish/gas/mq5 at 22:04:

450

QoS: 0 - Retain: false

Michael please take a look at this post https://community.home-assistant.io/t/mqtt-mosquitto-broker-and-nodered-not-working/132805
Any good?