Hi, I have a problam similar to a former question.
Raspberry has your flow an works well. The ESP8266 has your sketch. The connection to the broker is established, see below from the serial monitor:
Connected to Wi-Fi.Connecting to MQTT…
Connected to MQTT.
Session present: 0Subscribing at QoS 2, packetId: 1
Publishing at QoS 0Publishing at QoS 1,
packetId: 2Publishing at QoS 2,
packetId: 3Publishing on topic counter at QoS 1,
packetId: 4Subscribe acknowledged.packetId: 1qos: 2
Publish acknowledged.
packetId: 2
Publish acknowledged.
But the dashboard only shows:
Test
switch
text
chart
nothing else. Everything is empty, the switch does not work.
Regards, Hajo.
Hi.
It seems that Node-RED is not establishing a connection with the broker.
Open the debug window in Node-RED after deploying the flow and see if you get any error messages.
Did you edit the MQTT nodes with your own broker details? You need to insert the MQTT broker username and password and make sure that you set the right IP address (if you’ve followed the eBook as it is, it should be localhost).
Let me know if this helps.
Regards,
Sara
Hi Sara,
Node-Red establishes the connection to the broker very well, testet with former flows (led on/off from Windows Browser). No error messages in Node-Red. The broker details are correct, username, password, IP address as 192.168….
Regards, Hajo.
That’s weird because on the Serial Monitor results you showed, it seems that the board is successfully publishing to the broker.
And if the connection with the broker on Node-RED is successful, it should have received the messages.
Did you change anything on the code?
Are you sure you’re using the correct topics on both sides? Taking into account that the other things are working correctly, the only issue can be related to the topics….
Also, make sure you Deploy your Node-RED flow every time you make a change (it happened to me before forgetting to Deploy and then not having the expected results).
Regards,
Sara
Hi Sara, no, I haven't changed anything in the code. I have already compared the topics on both sites. Yes, I didn't forget to deploy and also looked at it in node-red debug afterwards - nothing. Do you have any tips for me?
Regards, Hajo.
Can you share a screenshot of your Node-RED MQTT nodes?
To share a picture, you’ll need to upload it to Imgur, Google Drive, or dropbox, for example, and then share a link to the file.
Regards,
Sara
Hi Sara,
I think that’s not necessary.
The picture is exactly that from page 172, all settings are as in the ebook (checked). The flow is deployed.
On the other side of the ESP, your Arduino sketch is unchanged. Tested with an ESP8266 and a D1mini. In the result from page 175 there is only the switch, no value for “text” and no graphics.
The debug field in Node-Red shows no errors. The communication between Node-Red and broker works, the test on page 119 ran flawlessly from an external browser.
What can I do, where are my mistakes, what can I test, what information do you need?
Regards, Hajo.
Hi.
Everything seems to be working as expected. So, it’s very difficult to find where the problem is.
First, reboot your Raspberry Pi.
sudo reboot
Then, try to subscribe to the topics the ESP32 is publishing in via the Raspberry Pi terminal, as explained on page 109.
I also recommend running the following command to subscribe to all topics and see if you get the ESP32 board messages:
mosquitto_sub -d -t "#" -u YOUR_USERNAME -P YOUR_PASSWORD
Let me know the results.
Regards,
Sara
Hi Sara,
$ mosquitto_sub -d -t ‘#’ -u user -P pass
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending SUBSCRIBE (Mid: 1, Topic: #, QoS: 0, Options: 0x00)
Client (null) received SUBACK
Subscribed (mid: 1): 0
Client (null) received PUBLISH (d0, q0, r1, m0, ‘test’, … (6 bytes))
test 3
Client (null) received PUBLISH (d0, q0, r1, m0, ‘counter’, … (2 bytes))
15
Client (null) received PUBLISH (d0, q0, r0, m0, ‘test’, … (6 bytes))
test 1
Client (null) received PUBLISH (d0, q0, r0, m0, ‘test’, … (6 bytes))
test 2
Client (null) received PUBLISH (d0, q0, r0, m0, ‘test’, … (6 bytes))
test 3
Client (null) received PUBLISH (d0, q0, r0, m0, ‘counter’, … (2 bytes))
10
Client (null) received PUBLISH (d0, q0, r0, m0, ‘counter’, … (2 bytes))
12
^CClient (null) sending DISCONNECT
Does this help? Thank you really much for your help.
Regards, Hajo.
As you can see the broker is receiving the ESP32 messages.
So, Node-RED should have received them too.
Now, on Node-RED click the switch to control the LED and see what you get on the Terminal, after running the same command (this is to make sure that the broker is receiving Node-RED messages):
mosquitto_sub -d -t ‘#’ -u user -P pass
Regards,
Sara
Hi Sara,
the result is the same as in the above log. No new message, when I use the switch
Regards, Hajo.
Hi.
So, it seems there is a problem on the Node-RED side.
The messages are not reaching the broker.
Again, can you show me a printscreen of your Node-RED MQTT nodes? Maybe you’re missing something there…
Regards,
Sara
Hi Sara,
ok, I’m a difficult customer… 🙂
For the Raspberry I downloaded your code from the link on page 169 in the ebook and didn’t change anything. The result is exactly the image on page 172.
For the ESP8266 I used the code from your link on page 149, no changes. The Arduino IDE 1.8.13 runs on another Raspberry under Buster.
I don’t think it’s necessary to upload the screenshot as it looks exactly like yours in the ebook. By the way: I don’t want to use services like Google Drive, Imgur or Dropbox. I get trashed with emails from dropbox since the first try. I don’t like any of these services. I can email everything to you, if needed.
But I don’t get the result you described on page 175. I only see “Test”, “switch” with the switch icon, “text” with no value and “chart” but no chart.
What can I do now? If you don’t have any advice for me, I’ll have to give up the whole project, unfortunately. 🙁
Thank you for your great help.
Regards, Hajo.
(All errors in this text are from Google Translator. English is not my first language and I didn’t want to make too many mistakes 🙂
Hi.
I’ll send you an email.
You have two registered emails with us. So, I’ll send a message to both of your emails.
Regards,
Sara
HI,
it doesn’t get better. Following your advice, I reinstalled the entire system. Completely reinstalled Raspian (buster), access via SSH and VNC. Installed on it line by line according to the SmartHome book: Node-Red, broker. All tests according to the book went flawlessly. The small flow with the LED worked perfectly.
Then downloaded your flow, checked every detail. Downloaded, compiled and uploaded the Arduino code for the 8266. The result in the browser: no text, no graphics, only headings. The switch does nothing at all. Tested with different raspberry-pi4, with different 8266, with different browsers from windows and from another raspberry 4b. The serial monitor in the arduino ide shows normal behavior, connection to the broker, sending the data. The data arrives at the broker, tested with your proposal.
What else can I do to solve the problem? What’s wrong – my Raspberry Pi 4B? my ESP8266? my arduino ide? your book? I compared all topics on the Raspi and in the arduino ide, everything is correct. I checked the IP addresses, username and password. Everything is ok. But the result is not what is shown in your book, it is unusable. What can I do besides dismantle everything, throw away the book and forget the whole thing? It’s really frustrating. Can you please help?
Regards, Hajo.
Hi.
What is the operating system you are running? Raspbian buster?
That’s not the operating system we recommend.
We recommend Raspberry Pi OS 64-bit. Everything was tested on that operating system.
As I mentioned in my last email, please follow all instructions step by step, including the installation of the operating system.
I don’t know if there are any incompatibilities with other systems,
Regards,
Sara
Hi Sara,
I have now installed bulls-eye 64bit as you suggested. The OS is very bad, extremely slow. This is also the reason why I continue to stick with buster with my other raspberries.
After I installed bulls-eye and everything exactly line by line according to your ebook, the result is exactly the same. So it can’t be due to the version of the OS (which, frankly, would also be extremely unlikely). The flow for node-red and the arduino code for the esp8266 were taken from your documents. Only IP address, username and password have been changed.
I swapped the raspberry 4b, I swapped the esp8266 – no change in result. Your last suggestion was to change the OS, I did it, didn’t help.
The dashboard has been tested with different browsers: Chrome, Opera and Firefox on Windows-10 as well as chromium on another raspberry. The result was the same for all browsers.
What remains are possible errors in node-red or in the code for the esp8266. For lack of knowledge I can neither find nor fix it. I don’t have test options other than what you suggested to control the broker. I emailed you the result and further questions about it.
I will now continue testing with other flows, maybe I can track down the problem. I’m looking at other projects via Google search right now and I’m hoping this will lead me to get an idea of what could be the problem. You can please close this point in the forum. I’ll open a new topic if I should find a solution or I will stop the whole project.
Thank you for your efforts so far.
Regards, Hajo.
Hi.
I’m not sure why the OS is slow for you. I used that exactly OS with the 64-bit version on a Raspberry Pi 4 B and everyting run smoothly.
Are you using a Desktop version?
I had a reader that had issues with the Desktop version (similar to yours). I’m not sure why that would cause issues. But he could run the project just fine in the OS without desktop.
At this point, I’m out of ideas of what might be wrong. I just tested everything a few days ago… I can test everything again just in case. However, I’m currently out of the office. I’ll be back in approximatley one week. Then, I can test everything again and check if something was updated or if there are any current issues.
Regards,
Sara
Hi,
this is a good hint. Yes, I use the desktop version and connect to the raspberry via vnc.
You don’t have to reinstall this, I believe that it is working for you.
I will now install bulls-eye 64 without desktop… let’s see what comes out. 🙂
Best regards, Hajo.
Hi Sara,
because of the many changes from raspian (buster/bullseye, 32/64, with/without desktop)
and esp8266/d1mini some problem crept in.
Now everything is going as it should and I can continue with your book.
Thanks for your help.
Hajo.
By the way: the whole thing is now running on a raspberry with only 1 GB of main memory without problems. Finally I have a useful use for it.
I’m not sure, but I think that was it. It is now running bullseye 64 without a desktop.