Skip to content

Commit 6aa4cbb

Browse files
committed
Fix mDNS on Ethernet port.
1 parent e0f43af commit 6aa4cbb

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

EthernetWebThingAdapter.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ class WebThingAdapter {
9393
void begin() {
9494
name.toLowerCase();
9595
#ifdef CONFIG_MDNS
96+
String serviceName = name + "._webthing";
9697
mdns.begin(Ethernet.localIP(), name.c_str());
97-
98-
mdns.addServiceRecord("_webthing", port, MDNSServiceTCP, "\x06path=/");
98+
// \x06 is the length of the record
99+
mdns.addServiceRecord(serviceName.c_str(), port, MDNSServiceTCP,
100+
"\x06path=/");
99101
#endif
100102
server.begin();
101103
}

WiFi101WebThingAdapter.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <WiFiUdp.h>
2424
#include <ArduinoMDNS.h>
25+
2526
#include <ArduinoJson.h>
2627

2728
#define WITHOUT_WS 1
@@ -81,9 +82,11 @@ class WebThingAdapter {
8182
void begin() {
8283
name.toLowerCase();
8384

85+
String serviceName = name + "._webthing";
8486
mdns.begin(WiFi.localIP(), name.c_str());
85-
86-
mdns.addServiceRecord("_webthing", port, MDNSServiceTCP, "\x06path=/");
87+
// \x06 is the length of the record
88+
mdns.addServiceRecord(serviceName.c_str(), port, MDNSServiceTCP,
89+
"\x06path=/");
8790

8891
server.begin();
8992
}

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "webthing-arduino",
33
"description": "A library for creating Web Things using the Web of Things API. Runs on ESP8266, ESP32, Ethernet, and WiFi101-compatible boards. Compatible with the Mozilla WebThings Gateway.",
44
"keywords": "Communication",
5-
"version": "0.11.0",
5+
"version": "0.11.1",
66
"authors": {
77
"name": "Mozilla IoT <[email protected]>"
88
},

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=webthing-arduino
2-
version=0.11.0
2+
version=0.11.1
33
author=Mozilla IoT <[email protected]>
44
maintainer=James Hobin <[email protected]>
55
sentence=A library for creating Web Things using the Web of Things API

0 commit comments

Comments
 (0)