improved responses content for commands and cronjobs

This commit is contained in:
Emanuele Trabattoni
2025-07-31 16:16:06 +02:00
parent fc2316b0f2
commit abe0cb0839
3 changed files with 45 additions and 27 deletions

View File

@@ -222,7 +222,13 @@ const bool Cron::processEvents()
next = cron::cron_next(cronexrp, nowTm); // update next execution time only if event was executed
// otherwise time tracking is lost
LOG_INFO("Cron running event [", eventName.c_str(), "] next execution time [", drivers::PCF85063::tm2str(next).c_str(), "]");
auto resp = commands::s_commandMap.at(cmd)(m_dev, cmdParams); // here the magic happens
auto action = commands::s_commandMap.at(cmd)(m_dev, cmdParams); // here the magic happens
ArduinoJson::JsonDocument resp;
resp["cmd"] = "logCronJob";
resp["values"]["name"] = eventName;
resp["values"]["now"] = drivers::PCF85063::tm2str(nowTm).c_str();
resp["values"]["next"] = drivers::PCF85063::tm2str(next).c_str();
resp["values"]["action"] = action;
if (m_callback)
{
m_callback(resp);