-
• #2
Oh wow, nice - so there's an
AT+MDNS
command? Is that in the standard 0.40 firmware?That could be rolled into the existing AT command drivers for Espruino really easily.
-
• #3
- AT+MDNS – Set MDNS function
ESP8266 softAP mode can not support MDNS. Do not contain special characters (for example, "."
character), or use a protocol name (for example, "http"), when defining "host_name" and
"server_name" for MDNS.
AT+WPS – Set WPS function
Example
AT+CWMODE=1
AT+WPS=1
Command AT+WPS=
Response OK or ERROR
Parameter
1 : start WPS function
0 : stop WPS function
AT+MDNS – Set MDNS function
Example AT+MDNS=1, "espressif", "iot", 8080
Command AT+MDNS=, , ,
Response OK or ERROR
Parameter
1 : enable MDNS function
0 : disable MDNS function
MDNS host name
MDNS server name
MDNS server port
http://bbs.espressif.com/viewtopic.php?t=1714
https://cdn.sparkfun.com/assets/learn_tutorials/4/0/3/4A-ESP8266AT_Instruction_SetEN_v0.30.pdf
https://espressif.com/en/support/download/sdks-demos
https://espressif.com/en/support/download/overview?keys=&field_type_tid%5B%5D=14
http://bbs.espressif.com/ - AT+MDNS – Set MDNS function
-
• #4
Using AT+GMR my ESP8266 reports the following:
AT version:0.60.0.0(Jan 29 2016 15:10:17)
SDK version:1.5.2(7eee54f4) -
• #5
Ahh, nice! Looks like an addition in 0.60.
Shame, as the Espruino WiFi boards currently ship with 0.40, and while it's possible to update firmware, it's a bit of a pain.
-
• #6
Latest AT document 2.0
https://espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf37. AT+MDNS – Set MDNS function ESP8266 softAP mode cannot support MDNS. Please do not use special characters (for example, "." character), or use a protocol name (for example, "http"), when defining "host_name" and "server_name" for MDNS. AT+WPS – Set WPS function Example AT+CWMODE=1 AT+WPS=1 Command AT+WPS=<enable> Response OK Parameter <enable> 1 : start WPS function 0 : stop WPS function AT+MDNS – Set MDNS function Example AT+MDNS=1, "espressif", "iot", 8080 Command AT+MDNS=<enable>, <hostname>, <server_name>, <server_port> Response OK Parameter <enable> 1 : enable MDNS function 0 : disable MDNS function <hostname> MDNS host name <server_name> MDNS server name <server_port> MDNS server port
-
• #7
I know this thread is quite old, but in a previous comment Gordon mentioned updating the AT firmware was a bit of a pain... as such the Espruino Wifi v2.04 still ships with AT 0.40. Are there plans to upgrade it to a more recent version?
-
• #8
The next batch of WiFi boards I get made will probably have a newer version on but that's some way off given the sales volume and stock I have.
In the past I've had a lot of success updating the ESP8266 without any need for soldering. I'll have a go now and see what happens.
-
• #9
Ok, try this out:
https://www.espruino.com/WiFi#updating-esp8266-firmware
Let me know if you have any issues - tried this on my Linux dev PC just now and it worked first time. Only trick was finding a firmware that worked :)
-
• #10
Did work on first try (Win10) 👏
Did you look at Espressif's releases? -
• #11
Did work on first try (Win10)
Fantastic! Anything I should change in the docs for Win10 users?
Did you look at Espressif's releases?
I did, but the first one I tried didn't work so I went with an AI-Thinker specific one I found online that works. I feel happier with the full images (that you write to address 0) because then they blow away any saved config data that might potentially brick the device.
If you get one that works I'm more than happy to update the instructions though!
-
• #12
Fantastic! Anything I should change in the docs for Win10 users?
Just copy-pasted the relevant commands, and it did work. IIRC installation of esptool wasn't terribly difficult either.
Saw a couple of "probably won't work on windows" remarks, especially in the BLE parts, but seem to work just fine in with the built-in Bluetooth. Web bluetooth works with chrome.I did, but the first one I tried didn't work
Didn't try it, but that was my guess :)
-
• #13
Rather than create a new post, I'll add on to this old one...
So is mDNS implemented on the Espruino Wifi? In short, what functionality is currently available to discover services via mDNS or mDNS-SD, and to be discovered? And what code do I need to write? Thanks!
-
• #14
Sun 2019.10.20
'So is mDNS implemented on the Espruino Wifi?'
See post #8 "next batch of WiFi boards . . . "
My take on this would be not yet, that is boards currently ship with 0v40, given the comment is only three months ago.
But, the link in #9 suggests the 8266 may be upgraded to 1v54 using esptool following the instructions there.
'what functionality is currently available'
I searched the 'Reference' page and found a note beneath:
If one clicks on the Right-Facing arrow to the right of the heading there, that hyperlinks to the source which is at:
https://github.com/espruino/Espruino/blob/master/libs/network/jswrap_wifi.c#L483
The notes within the source, mirror the note beneath the above heading. I observe the conflicting comment and conditional #if also.
-
• #15
Thanks, @Robin. Funny, I did a search on the espruino website for "mDNS" and got zero results. Yet that string exists in wifi.getHostname and wifi.setHostname. But I digress...
I inserted that into the code and didn't notice anything happen when I ran mDNS discovery, but I'm at the learning stage. Anyway, I'm guessing that the code will respond only when in access point mode - as a response to network devices looking for a DHCP server. I'm not using it in AP mode - I'm just trying to use zeroconf to discover other devices and to be discovered. So far adding .setHostname() didn't help. I imagine there are other steps I need to accomplish, but I don't know what they are.
-
• #16
Our posts may have crossed, did you follow the link in #9 above?
'I did a search on the espruino website for "mDNS"'
It is usually best to load up a fresh Google page and use the 'site:' keyword qualifier.
ex: mDNS wifi
site:espruino.com
-
• #17
oh wait, that's not Espruino fw (2v04), it's ESP8266 firmware, I totally blew past that. Thanks I'll give that try.
-
• #18
I got the ESP8266 fw update installed, validated it was 1.5.4, but still no difference. So here's what I'm doing:
I'm calling wifi.setHostname() in the wifi 'connected' callback, and I get a success on that.
Then I call 'dns-sd -B _http._tcp' from the Mac Terminal to browse for the device, not using Windows.
I fear that I need to do more, but I don't know what it would be.
-
• #19
Ok, so I think now you've got the 1.5.4 firmware MDNS should work, but it needs turning on - it's not in the Espruino drivers because the ESP8266 they ship with doesn't have it.
The actual command handbook is here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
wifi.setHostname
callsAT+CWHOSTNAME
, which is to do with WiFi rather than DNS, so I don't think is what you want.I believe this will work:
wifi.enableMDNS = function(hostname, callback) { turnOn(MODE.CLIENT, function(err) { if (err) return callback(err); at.cmd("AT+MDNS=1,"+JSON.stringify(hostname)+',"http",80\r\n',500,function(d) { callback(d=="OK"?null:d); }); }); }; /// then wifi is connected do wifi.enableMDNS("foobar",function() { ... done });
And you should be able to find your Espruino WiFi as
foobar.local
-
• #21
Oh, sorry - that's my mistake copy/pasting. Try:
wifi.enableMDNS = function(hostname, callback) { this.at.cmd("AT+MDNS=1,"+JSON.stringify(hostname)+',"http",80\r\n',500,function(d) { callback(d=="OK"?null:d); }); };
-
• #22
it works!
The device can now be discovered. Any pointers on how to discover other devices? I think I need to send a UDP packet on 224.0.0.251:5353, but (a) I don't know what data to send to that destination, or (b) if that's the right thing to do. -
• #23
I tweaked Gordon's example code snippet for flexibility:
wifi.enableMDNS = function(hostname, serviceType, port, callback) { let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n"; this.at.cmd(mdns, 500, function(d) { callback(d); }); };
Now you can specify the service type and port, like this:
wifi.enableMDNS("esp-livingroom", "iot", 80, function(result) { console.log("result is " + result); });
-
• #24
Do you have any examples of changing the service type? I left it out because I couldn't really see what it'd be used for :)
I'm afraid I don't know how you'd use MDNS to find other devices though - I'd have hoped the ESP8266 (or your router) would be able to do that for you automatically. Usually I can just request
mydevice
ormydevice.local
and it's fine with that. -
• #25
From what I can tell, it's used mainly for filtering out services you don't care about discovering. For example, Apple uses a service type called something like "_daap" (digital audio something player) from iTunes to find compatible players. So it won't find your printers or web servers or home automation devices, because it's filtering by that service type. So I can create my own service type and then discover only the devices I created, ignoring everything else on the network.
I don't think it's a very big deal when you have only a few discoverable devices on your network, but if you had hundreds, filtering by service type is kinda cool.
What is mDNS?
It gives a name to your ESP8266 server that the Apple Bonjour browser add in can use to access your server.
https://www.youtube.com/watch?v=G_gCfi3MdoU
In this example code I named the server “bob”.
I downloaded and installed Bonjour from this site and installed it on my Windows 7 system.
http://download.cnet.com/Bonjour-for-Windows/3000-18507_4-93550.html
On the IE browser command line I enter
“bob.local”
Or
http://bob.local:8080/
https://en.wikipedia.org/wiki/Multicast_DNS
Problems with older ESP8266 SDKs
http://internetofhomethings.com/homethings/?p=426
1 Attachment