letscontrolit/ESPEasy

No function of notification

comtechnik opened this issue · 32 comments

I have the latest version of ESPEasy. I use the “normal” version once and the “display” version once. In the “Display” version the notification works normally, but unfortunately this does not work in the “normal” version! But use the same SMTP settings for both. Is this possibly a bug?
Please help! Thanks!

Which exact build file did you use? (filename, see sysinfo tab)

ESP_Easy_mega_20231225_normal_ESP8266_4M1M

Both have the same board, a Wemos D1 mini.
One is running the version "ESP_Easy_mega_20231225_normal_ESP8266_4M1M" and the other is running the version "ESP_Easy_mega_20231225_display_ESP8266_4M1M".
Notification works in the display version, but not in the normal version

I don't understand your answer? Does that mean that I should create my own build? I don't understand why, because the "normal" version includes notification, but it doesn't work.

Can you see any message(s) in the log, related to notifications? Possibly error messages or connection failures?

This isn't an answer, but it is a label.
I did read your reply, but set it to unread for myself as I need to look into this later this evening.

With labels I can find things again later and also easily search through existing topics with the same label.
So for now it is: Have to dig into this a bit deeper.

Sorry, thank you very much!

This is what is written in the LOG when you press send:

16279149: Timeout while reading input data!
16280149: Timeout while reading input data!
16281149: Timeout while reading input data!
16282149: Timeout while reading input data!

but use the same SMTP settings on both devices

Do you use DHCP or static assigned IP?
Can you check the DNS server and gateway IP addresses as shown on the sysinfo page?
Which SMTP port do you use?

I use a static IP
the DNS and gateway are correct
SMTP port on both 2525
heizraum
PCB

Can you try on the same node (with this settings) to use the display build (or switch to the normal build on the working node) ?
Just to make sure it isn't any setting or maybe even a conflict on your network (e.g. IP is used by some other device too, or some firewall block is present in the router for this IP)

The code for both builds should be the same. If there would be some difference, then it should be something like "Notification" is included or not included in a build.

Don't quite understand what they mean. They are two separate devices, each has its own static IP. Not in the dhcp area. Both have the same notification settings, the same SMTP server, the same user name and the same password.

What you're seeing is this:

  • 2 devices with same settings (apart from static IP)
  • Only difference on devices is build ("normal" vs "display" build
  • device with "normal" build can't send, device with "display" build can

Since this should not happen, there are 3 options:

  • There is some bug in ESPEasy (not impossible, but harder to check quickly)
  • Settings perhaps not as "the same" as you would think
  • Some external factor in your network causing this behavior.

The last 2 options can be excluded by simply flashing the "display" build to the node running the "normal" build.

If this then "solves" the issue of not being able to send, then it is clearly a bug in ESPEasy.
If the node still isn't able to send, then it must be either some setting which is different, or there is some external factor.

External factors can be:

  • There is another device with that same IP present on your network
  • Router/firewall may be set to block device on that IP to connect to some online service/host
  • WiFi connection bad causing timeouts or slow reply from other hosts

OK, first of all, thank you. I will take another Wemos d1 mini and flash it once with the “normal” version and then with the “display” version. I'll give it a completely new static IP address and try the whole thing.
I don't want to re-flash my original "normal" one because otherwise all my controllers and devices would be gone.

I don't want to re-flash my original "normal" one because otherwise all my controllers and devices would be gone.

No, that's not true, you can update the Build installed, without losing your configuration, as long as the flash configuration (4M1M) is the same.
You can do an Over The Air (OTA) update via the Tools / Update Firmware button, browse to the 'other' .bin file, and upload that.

And if you're worried about loosing the configuration, you can download the config.dat and security.dat files from the node.

I just flashed the "display" firmware via OTA. It's the same problem as with the "normal" firmware. With the same settings. So there must be a conflict somewhere in the network that the Fritzbox has another device with this IP in there somewhere. despite static ip

You can power off the unit with issues, to see if you can still ping it.
What is a bit strange is that you can apparently still access the web interface of the ESPEasy node, so I'm really curious to what other device might have the same IP.
Could it be another ESPEasy device?

I'm always looking for a second device with the same IP address. Unfortunately in vain. There is only this one device with the IP in the network. I'm at a loss as to why this isn't working?

I just flashed the "display" firmware via OTA. It's the same problem as with the "normal" firmware.

Does this imply it's related to the ESP unit or network configuration, and not directly attributable to the software?

Have you checked the settings on the SMTP-server side, if there are IP-blocks or bans (like accepted IP-ranges) that may need adjustment?
Or maybe the unit did send a flood of messages for a short while, causing the SMTP server to auto-ban that IP-address?

No SMTP block, MQTT messages every 180 seconds, SMTP settings are correct otherwise it wouldn't work on the other device either.
I give up!
the same message always comes up.

211117: Timeout while reading input data!
212117: Timeout while reading input data!
213117: Timeout while reading input data!
214117: Timeout while reading input data!
215253: WD : Uptime 4 ConnectFailures 0 FreeMem 18104 WiFiStatus: WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init

If I press send on the other device with the "display" firmware, the message is there within 2 seconds.

Finally had some time to look into this...

That timeout error is being generated in the function safeReadStringUntil
In the email code it is trying to read until a newline.
Is it possible the mail body doesn't have a newline?

It is a bit hard to see from the source alone what might be wrong here.

Can you send me a zip file containing the notification.dat of both nodes via email? (maybe also config.dat)
Or you can perhaps try to diff both (binary) files to see where there is a difference.

I don't change the email text. on both devices.? Which email address can I send the zip file to?

Another idea....
Since the error is reported in waiting for a response of the mail server, could it be that the mail server still keeps the network connection open for some odd reason?
So you could maybe also disconnect the working one and try again with the not working one...

email: gijs dot noorlander at gmail dot com

I sent you the config.bat and notifications.bat from both devices by email. Unfortunately I can't compare them. Is there software that can be used to open and view the files.

In the notification.dat of the "normal" build you do seem to have something with a newline in it, can you please try with exactly the same message?

gijs@Imagine:/mnt/d/temp/ESPEasy/email_issue$ diff display_notification.dat.hexdump normal_notification.dat.hexdump
17,18c17,18
< 00000100  00 00 00 00 00 00 00 00  00 00 00 45 73 70 45 61  |...........EspEa|
< 00000110  73 79 5f 50 43 42 00 00  00 00 00 00 00 00 00 00  |sy_PCB..........|
---
> 00000100  00 00 00 00 00 00 00 00  00 00 00 45 73 70 65 61  |...........Espea|
> 00000110  73 79 5f 48 65 69 7a 72  61 75 6d 00 00 00 00 00  |sy_Heizraum.....|
21,24c21,26
< 00000180  00 00 00 00 00 00 00 00  00 00 00 00 45 41 53 50  |............EASP|
< 00000190  45 41 53 59 20 50 43 42  20 4e 61 63 68 72 69 63  |EASY PCB Nachric|
< 000001a0  68 74 20 67 65 73 65 6e  64 65 74 00 00 00 00 00  |ht gesendet.....|
< 000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
---
> 00000180  00 00 00 00 00 00 00 00  00 00 00 00 42 69 74 74  |............Bitt|
> 00000190  65 20 6b 6f 6e 74 72 6f  6c 6c 69 65 72 65 6e 20  |e kontrollieren |
> 000001a0  64 65 69 6e 65 20 48 65  69 7a 75 6e 67 21 0d 0a  |deine Heizung!..|
> 000001b0  45 69 6e 65 20 54 65 73  74 6e 61 63 68 72 69 63  |Eine Testnachric|
> 000001c0  68 74 2e 00 00 00 00 00  00 00 00 00 00 00 00 00  |ht..............|
> 000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Just to be sure it is something odd in ESPEasy (which it seems to be)

Edit:
Position 0x18C in the notification.dat is where the body starts.

I saw that I had a blank line in the message in the "normal" device, I took it out and now everything works. Thank you very much for your great help! you are the best. Thanks alot! I opened the two notificatons.dat in notepad++ and saw that there were 2 lines and in the display notifications.dat there was only one line. perfect!
May I ask what you use to open the .dat files and what software?

Still ESPEasy shouldn't handle it like this, so I will take another look at it.

I used hexdump -C <filename> under Linux to create the hexdump files and then just diff to see the differences

You can also hexdump with Notepad++, then save those to a separate file and then use any diff tool (also one in Notepad++ if I'm not mistaken) to compare 2 files

thank you for everything!
They were a great help to me

Ah found the bug.....

    aMesg.replace(F("\r"), F("<br/>")); // re-write line breaks for Content-type: text/html

This should check for the char '\r' and not the string "\r"

Will fix it for the next build.

So it's a little problem with ESPEasy. If ESPEasy should still process the blank line. That would be great if it was fixed in the next build, THANK YOU.
I read that you are the owner and main developer of ESPEasy. I think ESPEasy is very good! TOP!
Thank you