• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Not receive value of sensor with esp32 in node-red

Q&A Forum › Category: ESP32 › Not receive value of sensor with esp32 in node-red
0 Vote Up Vote Down
Anders Carlsson asked 6 months ago

Hello! I am using a raspberry 5  I have used the tutorial ESP32 Mqtt publish ds18b20. In the seriel monitor I got the temperature but the packet id say 0. In node-red it says conected.
Message: 23.31 /nPublishing on topic esp32/ds18b20/datarum6 at QoS 1, packetId: 0
And no message in debug in node-red.
And I have tested so the node-red works with an Esp8266 and the tutorial for ESP8266 NodeMCU MQTT . Both tested with no changes just password and ssid. So with Esp8266 it works.
Publishing on topic esp8266/ds18b20/datarum5 at QoS 1, packetId: 3 Message: 23.19
Publish acknowledged. packetId: 3


Question Tags: No packetId
17 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

Hi.
 
Taking into account what you described, it seems to be an issue with the MQTT topic.
On the Node-RED MQTT IN node, double-check that the topic is correct.  It is sensitive to lowercase or uppercase, and spaces matter too.
 
Let me know if that was the problem.
 
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 6 months ago

Hi Sara! Thanks for your advice. I always use copy and paste to avoid such things and I have tried again without any results. I have tried several times. And I have four DS18B20 that I will use which I started with. And all four I got the temperature in the serial monitor but nothing in node-red. After that I decided to test with just one sensor and made a new fresh installation with the code from gitshub. I get it with ctrl a and then ctrl c and then paste it into a new sketch. From that sketch I also take by copying the unique topic and pasting it into node-red, everything to avoid something going wrong. And it’s not the first time I’ve tested and it has always failed with Esp32 so I’ve gotten used to Esp8266 but now I’m going to have it work with Esp32. So I’ve used the tutorial from Esp8266 which is not written in the same way as the tutorial for Esp32 so it’s a different code, I think you have observed that. I’m out of ideas what’s wrong.

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

And I have installed Influxdb and made sensor with Esp32 and also Esp01 and others and they have been working out of the box. But not the one Esp32 and mqtt,

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Ok.
Can you tell me the exact code you’re running? So that I can also test it myself?
Also, tell me the exact library versions you’re using.
Are you using our forked version of the MQTT library? Which AsyncTCP library are you using, and which version?
It may be an issue with the library versions you’re using.
 
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Ok, https://raw.githubusercontent.com/RuiSantosdotme/Random-Nerd-Tutorials/master/Projects/ESP32/ESP32_MQTT/ESP32_DS18B20.ino that`s the code I use. And I use Ardiono 2.3.7 . and Async TCP version 3.4.10 and I have download the async-mqtt-client from here:https://github.com/marvinroger/async-mqtt-client/archive/master.zip renamed it to async-mqtt-clent and used add zip libery. And checked in my ardino folder and it`s there. And the compiling runs with no fault.

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
Use this version of the library instead: https://github.com/RuiSantosdotme/async-mqtt-client/archive/refs/heads/develop.zip
 
Delete the other one.
 
Tell me if that fixes the issue.
 
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

I did like this. I went to the libraries and deleted the AsyncMqttClient. Downloaded async-mqtt-client-devlop.zip. Rename the file to async-mqtt-client.zip Went to Arduion/Sketch/Include Library/Add ZIP Library The output says ok or done. Then I check in the library and ther was AsyncMqttClient I restarted the Arduino and then compiled the sketch with the same result, packetId: 0

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

What about the AsyncTCP library?
Which version do you have installed?
 
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Well I have Async TCP 3.4.10 But in the code it`s not include So I don`t understand? inklude:

freertos/FreeRTOS,freertos/timers, AsyncMqttClient, OneWire, DallasTemperature thats in the code.
Regards
Anders

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

You seem to have the correct libraries installed.
The AsyncMQTTClient library will automatically reference the AsyncTCP library.
 
I’ll try to test the code and setup tomorrow to try to understand if there’s something wrong or if there was some update with breaking changes.
 
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Hello!
Could I use the code as Esp8266 and just replace it with ESP32? That code says this:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESP8266WiFi.h>
#include <Ticker.h>
#include <AsyncMqttClient.h>
So just replace #include <ESP8266WiFi.h> with #include <WiFi.h> or is there more that needs to be changed. I have this to measure temperatures for my heating system and it is cold now down to -20C so it is a great help so you don’t have to keep going and checking.
Regards
Anders

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Ok.
Let me know if you got it working.
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Hi! No I didn’t manage to do that and haven`t time to try. I’ve ordered some new Esp 8266 so I can get measurements on that heater also. Did you find anything wrong with Esp32 code?

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Hi.
I was waiting for an answer before testing…

Anyway, I tested the project this morning. It is working as expected with the whole MQTT setup.
Your issue is probably that you forgot to insert the MQTT username and password???

Check like 123 of the code:

  // If your broker requires authentication (username and password), set them below
  //mqttClient.setCredentials("REPlACE_WITH_YOUR_USER", "REPLACE_WITH_YOUR_PASSWORD");

You need to uncomment that second line and replace with your MQTT username and password. Did you do that?

Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Hello!
Yes I have the credentials infilled and uncomment the second line.

Message: 19.50 /nPublishing on topic esp32/ds18b20/datarum1 at QoS 1, packetId: 0
I think I have an RPI4 to test with to see if that is the fault. 
But now I have messurment on that heater too, from the new Esp8266 so it`s 
not in a hurry right now
Regards
Anders

 

0 Vote Up Vote Down
Sara Santos Staff answered 5 months ago

Ok.
Then, let me know your results later on.
Regards,
Sara

0 Vote Up Vote Down
Anders Carlsson answered 5 months ago

Yes but it will take a while.
Regards Anders

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 Version 1.7 November 28, 2025
  • [eBook Updated] Smart Home with Raspberry Pi, ESP32, and ESP8266 V1.6 September 9, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2026 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.