diff --git a/src/custom/my_custom_template.cpp b/src/custom/my_custom_template.cpp index 453497fa..b2d65935 100644 --- a/src/custom/my_custom_template.cpp +++ b/src/custom/my_custom_template.cpp @@ -35,7 +35,7 @@ bool custom_pin_in_use(uint pin) return false; } -void custom_get_sensors(JsonObject& doc) +void custom_get_sensors(JsonDocument& doc) { /* Sensor Name */ JsonObject sensor = doc.createNestedObject(F("Custom")); diff --git a/src/custom/my_custom_template.h b/src/custom/my_custom_template.h index 21322f24..c7511791 100644 --- a/src/custom/my_custom_template.h +++ b/src/custom/my_custom_template.h @@ -22,8 +22,8 @@ void custom_every_5seconds(); /* return true if the pin used by the custom code */ bool custom_pin_in_use(uint pin); -/* Add a key which defines a JsonObject to add to the sensor JSON output */ -void custom_get_sensors(JsonObject& doc); +/* Add a key which defines a JsonObject to add to the sensor JSON document */ +void custom_get_sensors(JsonDocument& doc); #endif // HASP_USE_CUSTOM diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index fd629b6a..764e0ff6 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -36,6 +36,10 @@ #include "hasp_config.h" #endif +#if HASP_USE_CUSTOM > 0 +#include "custom/my_custom.h" +#endif + dispatch_conf_t dispatch_setings = {.teleperiod = 300}; uint16_t dispatchSecondsToNextTeleperiod = 0; @@ -895,6 +899,10 @@ void dispatch_send_sensordata(const char*, const char*) haspDevice.get_sensors(doc); +#if HASP_USE_CUSTOM > 0 + custom_get_sensors(doc); +#endif + // JsonObject input = doc.createNestedObject(F("input")); // JsonArray relay = doc.createNestedArray(F("power")); // JsonArray led = doc.createNestedArray(F("light"));