Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDNS webserver advertise not working on core 2.5.0 #4938

Closed
5 tasks done
araczkowski opened this issue Jan 15, 2019 · 15 comments
Closed
5 tasks done

MDNS webserver advertise not working on core 2.5.0 #4938

araczkowski opened this issue Jan 15, 2019 · 15 comments
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended

Comments

@araczkowski
Copy link
Contributor

Describe the bug

I'm trying to advertise web server
on sdk core 2.3.0 this is ok - I'm able to see the service using the avahi-discover,
but on 2.5.0 the device is not visible in network, I don't know why

of course I have
USE_DISCOVERY and WEBSERVER_ADVERTISE on in the my_user_config file

I figure out that the
MDNS.addService("http", "tcp", WEB_PORT);
is in the support_wifi.ino

to be sure that this part is executed I added a log info below

snprintf_P(log_data, sizeof(log_data), "MDNS.addService");
AddLog(LOG_LEVEL_INFO);

now I can see that the line MDNS.addService("http", "tcp", WEB_PORT); is executed each second - see the screenshots below

it is normal that MDNS.addService is executed each second?
how we can advertise the device on 2.5.0 maybe something was changed in the core version?

Thanks

Also, make sure these boxes are checked [x] before submitting your issue - Thank you!

  • Searched the problem in issues and in the wiki
  • Hardware used : D1 mini
  • Development/Compiler/Upload tools used : PlatformIO, Arduino SDK Core 2.5.0
  • If a pre-compiled release or development binary was used, which one? : latest
  • You have tried latest release or development binaries? : yes
  • [] Provide the output of commandstatus 0 :

To Reproduce
program device with lates verion compiled on sdk 2.5.0
try to find the http service from device in network via avahi-discover

Expected behavior
be able to see the http service via avahi-discover

Screenshots
image

@Jason2866
Copy link
Collaborator

Jason2866 commented Jan 15, 2019

#3275 (comment)
#4793
It is not supported. If it works, fine. If not it could be Theo wont fix it.
Yes, there are changes in Core 2.5.0 related to mDNS

@araczkowski
Copy link
Contributor Author

I'm talking about advertise the devices web service in the network - this option seems to be still supported in Tasmota

3257 is about resolving the MQTT broker address on device via mDNS hostname,
I see that this is not implemented and not planned

4793 is about possiblity to set the mDNS on/off
but when it is on, the advertise the devices web service in the network is still possible/supported?

@ascillato
Copy link
Contributor

As that is a feature of the Arduino core, please try a simple arduino sketch with that, to test if the problem is in the core or in Tasmota. Thanks.

@araczkowski
Copy link
Contributor Author

ok - this was my plan too :)
later or tomorrow I will try this one
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266mDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino
and I will let you know

Thanks and have a nice day

@andrethomas
Copy link
Contributor

It is correct for it to be executed frequently otherwise other hosts will never know the device exists.

So its neither a core or Tasmota issue - you can extend your logs by adding a similar AddLog for every driver if you like to be flooded with debugging info :)

To answer your last question in your initial post - you may enable and disable mDNS with SetOption55 as documented in the Wiki here https://github.com/arendst/Sonoff-Tasmota/wiki/Commands

@araczkowski
Copy link
Contributor Author

It is correct for it to be executed frequently otherwise other hosts will never know the device exists.

thanks for clarification :)
I don't have lot of experience with C/C++ code, in Python or Java this kind of addService is done once in lib and the rest is magically ;) done without repeating
so I thought that maybe the MDNS.addService is taking care about repeating this
that is why I asked

@ascillato2 ascillato2 added awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting labels Jan 15, 2019
@araczkowski
Copy link
Contributor Author

according to the advice from @ascillato - Thanks!

I just checked the simple arduino sketch on the same D1 mini:
https://raw.githubusercontent.com/esp8266/Arduino/master/libraries/ESP8266mDNS/examples/mDNS_Web_Server/mDNS_Web_Server.ino

the MDNS.addService is executed only once and works OK
please see the screens below

image

image

@ascillato
Copy link
Contributor

ascillato commented Jan 15, 2019

Ok. So, it is a Tasmota bug for core 2.5.0. Thanks for reporting. We had a similar problem with otaurl that now it is fixed.

Another question. Have you tried the latest stage core from arduino repository? The one from today?

@ascillato2 ascillato2 changed the title MDNS.addService("http", "tcp", WEB_PORT) is executed each second MDNS webserver advertise not working on core 2.5.0 Jan 15, 2019
@ascillato2 ascillato2 added bug Type - Confirmated Bug and removed awaiting feedback Action - Waiting for response or more information troubleshooting Type - Troubleshooting labels Jan 15, 2019
@andrethomas
Copy link
Contributor

Ah yes, was a bit early for me...

@arendst
Copy link
Owner

arendst commented Jan 15, 2019

I guess it should have been executed only once in core 2.3.0 too.

I'll change it to being executed only once in next dev version. Pls let me know if it solves your issue as I cannot test it myself.

@arendst arendst self-assigned this Jan 15, 2019
arendst added a commit that referenced this issue Jan 15, 2019
6.4.1.9 20190115
 * Add support for Mi LED Desk Lamp with rotary switch (#4887)
 * Fix mDNS addService (#4938)
@arendst arendst added the awaiting feedback Action - Waiting for response or more information label Jan 15, 2019
@arendst arendst removed their assignment Jan 15, 2019
@araczkowski
Copy link
Contributor Author

@arendst

I guess it should have been executed only once in core 2.3.0 too.

according to the examples from MDNS + HTTP server sketch the MDNS.addService is called only on setup to advertise the service, after the wifi connection and HTTP server

then in the loop MDNS.update() is called many times

but I don't know if this was always like this or it is new approach...

Of course I will test this deeply, and I will try to dig this MDNS topic more - I really like this feature - thank you 👍

@ascillato

Another question. Have you tried the latest stage core from arduino repository? The one from today?

I did the test again, this time on Core/SDK | STAGE/3.0.0-dev(c0f7b44)
The same device, the same network, the same core but different results:
simple arduino sketch -> the device web service is correctly advertised in the network in the network
Tasmota -> no service is advertised

Thanks!

image

@arendst
Copy link
Owner

arendst commented Jan 15, 2019

Did you enable mDns with command SetOption55 1

@araczkowski
Copy link
Contributor Author

@arendst
I didn't tested this on Tasmota DEV yet
my last test (and comment) was on latest core 2.5.0 and Tasmota mater (Release 6.4.1)

I will check this deeply tomorrow on Tasmota DEV and I will let you know if is OK
Thanks and Regards

@araczkowski
Copy link
Contributor Author

Hi @arendst

I did a test:

Program Version | 6.4.1.9(sonoff)
Core/SDK Version | STAGE/3.0.0-dev(c0f7b44)
Hostname | my_device_to_test_mdns.local

it doesn't work, so I checked if the:

  1. MDNS_ENABLED / SetOption55 == 1
  2. MDNS.begin is executed
  3. MDNS.addService is executed

all above was correct

than I added these lines in support_wifi.ino WifiCheckIp

    if ((wifi_status == WL_CONNECTED) && (2 == mdns_begun)) {
      MDNS.update();
      AddLog_P(LOG_LEVEL_DEBUG_MORE, D_LOG_MDNS, "MDNS.update");
    }

in DEBUG_MORE we can see what is going on here

image

I don't know if this is a best way but it works :)

please see the screens below from avahi-discover, service browser on Android and browser

if you want I can submit a pull request with this code but I suppose that you have better idea how to write this full correctly :)
Of course I will retest this - just please let me know
Thanks a lot! 👍

image

image

image

@ascillato2
Copy link
Collaborator

Great, please do the PR. Thanks.

@ascillato2 ascillato2 added fixed Result - The work on the issue has ended and removed awaiting feedback Action - Waiting for response or more information labels Jan 16, 2019
arendst added a commit that referenced this issue Jan 17, 2019
 * Fix mDNS addService (#4938, #4951)
 * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (#3560, #4947)
 * Add SerialBridge command SSerialSend5 <hexdata>
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this issue Jan 27, 2019
6.4.1.9 20190115
 * Add support for Mi LED Desk Lamp with rotary switch (arendst#4887)
 * Fix mDNS addService (arendst#4938)
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this issue Jan 27, 2019
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this issue Jan 27, 2019
 * Fix mDNS addService (arendst#4938, arendst#4951)
 * Add (S)SerialSend3 escape sequence \x to allow hexadecimal byte value (arendst#3560, arendst#4947)
 * Add SerialBridge command SSerialSend5 <hexdata>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests

6 participants