implement toJson for Component and Command to be used in webserver
responses
This commit is contained in:
parent
9d026b4aef
commit
6924775e02
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
|
||||
"name": "ha-mqtt",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"description": "Home Assistant classes for integration with MQTT auto discovery",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
10
src/ha.h
10
src/ha.h
@ -101,6 +101,12 @@ namespace Ha {
|
||||
publisher(configTopic, "");
|
||||
}
|
||||
|
||||
void toJson(JsonDocument& jsonDoc) {
|
||||
jsonDoc["id"] = id;
|
||||
jsonDoc["name"] = name;
|
||||
jsonDoc["type"] = type;
|
||||
}
|
||||
|
||||
protected:
|
||||
void buildConfig(JsonDocument& jsonDoc) override {
|
||||
if (mainDevice) mainDevice->buildConfig(jsonDoc);
|
||||
@ -149,6 +155,10 @@ namespace Ha {
|
||||
if (f) f(msg);
|
||||
}
|
||||
|
||||
void toJson(JsonDocument& jsonDoc) {
|
||||
cmp->toJson(jsonDoc);
|
||||
}
|
||||
|
||||
protected:
|
||||
char commandTopic[TOPIC_SIZE] = {};
|
||||
onMessage f;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user