Add HASP_USE_CUSTOM

This commit is contained in:
fvanroie 2021-07-12 04:09:37 +02:00
parent 3b377c8814
commit 0cb5588199
3 changed files with 11 additions and 3 deletions

View File

@ -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"));

View File

@ -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

View File

@ -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"));