first version of cron, does not read configuation from file

This commit is contained in:
Emanuele Trabattoni
2025-07-26 16:05:03 +02:00
parent 91f4c5c750
commit 448e1bad15
8 changed files with 1129 additions and 9 deletions

View File

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