first version of cron, does not read configuation from file
This commit is contained in:
19
src/main.cpp
19
src/main.cpp
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <commands.h>
|
||||
#include <cronjobs.h>
|
||||
#include <mqtt.h>
|
||||
|
||||
#include <devices.h>
|
||||
@@ -53,6 +54,24 @@ void loop()
|
||||
//////////////// NETWORK ////////////////
|
||||
auto mqtt = MQTTwrapper();
|
||||
//////////////// NETWORK ////////////////
|
||||
|
||||
|
||||
//////////////// CRONJOB ////////////////
|
||||
auto cron = Cron(devices);
|
||||
ArduinoJson::JsonDocument job;
|
||||
job["cmd"] = "setIrrigation";
|
||||
job["params"]["zone"] = "zone1";
|
||||
job["params"]["timeOn"] = 30;
|
||||
job["params"]["timePause"] = 2;
|
||||
|
||||
{
|
||||
std::string buf;
|
||||
serializeJson(job,buf);
|
||||
LOG_INFO("Example Cronjob -> ", buf.c_str());
|
||||
cron.addEvent("exampleCronEvent", buf, "0 */10 * * * *");
|
||||
cron.startCron();
|
||||
};
|
||||
//////////////// CRONJOB ////////////////
|
||||
|
||||
//////////////// MQTT ////////////////
|
||||
/////////////// CALLBACK //////////////
|
||||
|
||||
Reference in New Issue
Block a user