Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Thing.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ class ThingDevice {
String id;
String title;
String description;
JsonObject context;
const char **type;
#if !defined(WITHOUT_WS) && (defined(ESP8266) || defined(ESP32))
AsyncWebSocket *ws = nullptr;
Expand All @@ -481,6 +482,9 @@ class ThingDevice {
ThingEvent *firstEvent = nullptr;
ThingEventObject *eventQueue = nullptr;

ThingDevice(const char *_id, const char *_title, const char **_type, JsonObject _context)
: id(_id), title(_title), type(_type), context(_context) {}

ThingDevice(const char *_id, const char *_title, const char **_type)
: id(_id), title(_title), type(_type) {}

Expand Down Expand Up @@ -698,7 +702,11 @@ class ThingDevice {
void serialize(JsonObject descr, String ip, uint16_t port) {
descr["id"] = this->id;
descr["title"] = this->title;
descr["@context"] = "https://webthings.io/schemas";
if (this->context) {
descr["@context"] = this->context;
} else {
descr["@context"] = "https://webthings.io/schemas";
}

if (this->description != "") {
descr["description"] = this->description;
Expand Down