File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,7 @@ class ThingDevice {
470
470
String id;
471
471
String title;
472
472
String description;
473
+ JsonObject context;
473
474
const char **type;
474
475
#if !defined(WITHOUT_WS) && (defined(ESP8266) || defined(ESP32))
475
476
AsyncWebSocket *ws = nullptr ;
@@ -484,6 +485,9 @@ class ThingDevice {
484
485
ThingDevice (const char *_id, const char *_title, const char **_type)
485
486
: id(_id), title(_title), type(_type) {}
486
487
488
+ ThingDevice (const char *_id, const char *_title, const char **_type, JsonObject _context)
489
+ : id(_id), title(_title), type(_type), context(_context) {}
490
+
487
491
~ThingDevice () {
488
492
#if !defined(WITHOUT_WS) && (defined(ESP8266) || defined(ESP32))
489
493
if (ws)
@@ -698,7 +702,11 @@ class ThingDevice {
698
702
void serialize (JsonObject descr, String ip, uint16_t port) {
699
703
descr[" id" ] = this ->id ;
700
704
descr[" title" ] = this ->title ;
701
- descr[" @context" ] = " https://webthings.io/schemas" ;
705
+ if (this ->context ) {
706
+ descr[" @context" ] = this ->context ;
707
+ } else {
708
+ descr[" @context" ] = " https://webthings.io/schemas" ;
709
+ }
702
710
703
711
if (this ->description != " " ) {
704
712
descr[" description" ] = this ->description ;
You can’t perform that action at this time.
0 commit comments