letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.26k stars 2.21k forks source link

[BUG] mDNS unavailable in ESP32-C3 #5061

Open TobiasPSP opened 4 months ago

TobiasPSP commented 4 months ago

Firstly, I am new to ESPEasy so in case I overlooked something I apologize. Thanks for your awesome work!

I seem to be unable to configure or use mDNS in the latest "Display" build targeting S2/S3/C3 on a C3 Mini. I searched for hours in the documentation but couldn't find a setting or even mention.

It appears to me that one target audience of ESPEasy are makers that are looking for a lean and generic management platform. For this audience I feel mDNS is crucial. I wouldn't be able to keep track of changing IP addresses when trying to contact devices.

Apparently, mDNS is included in ESPEasy. What am I doing wrong/missing to get it configured?

Many thanks!

TD-er commented 4 months ago

I have to check, but I think it might have been disabled by me out of pure frustration as it is a continuous source of 'strange issues'.

TD-er commented 4 months ago

At least I found this commit to explicitly disable mDNS for the ESP32-S2: https://github.com/letscontrolit/ESPEasy/pull/4672/commits/9aed4b033617c3df19c665f493291f8c1f29abb2

Will look further to see why/when it was disabled for the C3 (and others???)

TD-er commented 4 months ago

Also found this commit: https://github.com/letscontrolit/ESPEasy/pull/4979/commits/bfe5926589cb009b7dc5ed4b68f841946c5f2008#diff-0e7c5ae1aa6edf7e0f181cf8990739e1ef2d9354826fc56dbd241d540e6ae507R2763 Apparently I did disable it for C3/C6 as it did cause some long stalls where the ESP became unresponsive for quite a long time (seconds)

TobiasPSP commented 4 months ago

Thank you for looking into this. I am sorry that mDNS in ESPEasy is causing so much trouble.

Is there a chance to have an option in config to control mDNS by the user?

TD-er commented 4 months ago

I did look a bit more in some commits for the recent ESP-IDF5.1 and the latest Arduino 3.0.0 code for ESP32 I guess we could try enabling it. I can add it to a branch I'm now working on for a new plugin, so you could later test a test build.

TD-er commented 4 months ago

Thank you for looking into this. I am sorry that mDNS in ESPEasy is causing so much trouble.

Not only ESPEasy. I just asked the people from Tasmota whether they are using mDNS and this was the reply:

We do use only for Matter. For this restricted use case it does work It is not activated for the "classic" use

Anyway I will include it in a test build, however I'm not sure it will now work with less issues compared to earlier builds where it was still enabled.

TD-er commented 4 months ago

As soom as this GitHub Actions test build is ready, you can try any ESP32-xx build with "LittleFS" in the name as those have FEATURE_MDNS enabled again.

N.B. if you had a build running without "LittleFS" in the name, you need to backup your settings and rules file as the file system will be erased when moving from SPIFFS to LittleFS.

TD-er commented 4 months ago

I also uploaded the build to the webflasher: https://td-er.nl/ESPEasy/latest/

TobiasPSP commented 4 months ago

Greatly appreciated! I‘ll test and report back.

Just to clarify: will there be a setting in config showing up in mDNS-enabled builds where I would specify the mDNS name, or is this automatically using the node name?

Sorry if this sounds naive, I did wrap my head around the documentation quite extensively but mDNS doesn’t seem to be explicitly mentioned, or I possibly missed it.

Anyway, looking forward testing it. Thank you for your response and willingness to look into this.

TD-er commented 4 months ago

It just uses the set hostname as mDNS You can see the .local name on the root page

For example: image

TD-er commented 4 months ago

I will disable it again as just having mDNS enabled will cause the ESP32-C3 to have a load of 35 - 50% without doing anything else... And it will also interfere significantly with just about anything as the background task handling this will sometimes take 200 - 500 msec which is blocking the entire system.

So it will be disabled unless you explicitly enable it for a custom build.

TobiasPSP commented 4 months ago

Ok, I understand. I am not as quick as you are ;-) family and job taking its toll.

I was about to test tonight but if the side effects are so severe then I agree it doesn’t make sense.

So this issue is isolated to newer mc like c3/s2,3? Would a build for a classic esp32 have mDNS enabled?

TD-er commented 4 months ago

I have it now disabled for all builds if it hasn't been explicitly enabled (so only for custom builds where you enable it using a define)

Later I can try to figure out whether it is related to ESP32-C3/C6 only or also for the others. (I assume they all suffer from it)

I had it enabled for a pending PR I'm working on to implement support for a lightning detector. This is somewhat time-critical as you need to fetch the info from the sensor ASAP or else you will be missing strikes and that was exactly what was happening.