File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 77#include " time_man.h"
88#include " emonesp.h"
99#include " app_config.h"
10+ #include " event.h"
1011
1112#include < algorithm>
1213#include < vector>
@@ -159,7 +160,9 @@ Scheduler::Scheduler(EvseManager &evse) :
159160 _firstEvent(),
160161 _activeEvent(),
161162 _loading(false ),
162- _timeChangeListener(this )
163+ _timeChangeListener(this ),
164+ _version(0 ),
165+ _plan_version(0 )
163166{
164167
165168}
@@ -224,6 +227,10 @@ unsigned long Scheduler::loop(MicroTasks::WakeReason reason)
224227 }
225228
226229 _activeEvent = currentEvent;
230+
231+ StaticJsonDocument<128 > doc;
232+ doc[" schedule_plan_version" ] = ++_plan_version;
233+ event_send (doc);
227234 }
228235
229236 int currentDay;
@@ -349,6 +356,10 @@ void Scheduler::buildSchedule()
349356 #endif // ENABLE_DEBUG
350357 }
351358
359+ StaticJsonDocument<128 > doc;
360+ doc[" schedule_version" ] = ++_version;
361+ event_send (doc);
362+
352363 // wake the main task to see if we actually need to do something
353364 MicroTask.wakeTask (this );
354365}
@@ -802,6 +813,10 @@ bool Scheduler::serializePlan(DynamicJsonDocument &doc)
802813 e = &e->getNext ();
803814 object = root.createNestedObject (" next_event" );
804815 serializeEventInstance (object, e, true );
816+ } else {
817+ root[" next_event_delay" ] = false ;
818+ root[" current_event" ] = false ;
819+ root[" next_event" ] = false ;
805820 }
806821
807822 e = &_firstEvent;
Original file line number Diff line number Diff line change @@ -232,6 +232,9 @@ class Scheduler : public MicroTasks::Task
232232
233233 MicroTasks::EventListener _timeChangeListener;
234234
235+ uint32_t _version;
236+ uint32_t _plan_version;
237+
235238 void buildSchedule ();
236239 bool commit ();
237240 EventInstance &getCurrentEvent ();
@@ -283,6 +286,13 @@ class Scheduler : public MicroTasks::Task
283286
284287 void notifyConfigChanged ();
285288
289+ uint32_t getVersion () {
290+ return _version;
291+ };
292+ uint32_t getPlanVersion () {
293+ return _plan_version;
294+ };
295+
286296 static void getCurrentTime (int &day, int32_t &offset);
287297};
288298
Original file line number Diff line number Diff line change @@ -624,7 +624,9 @@ handleStatus(MongooseHttpServerRequest *request) {
624624 doc[" time" ] = String (time);
625625 doc[" offset" ] = String (offset);
626626
627- doc[" config_version" ] = String (config_version);
627+ doc[" config_version" ] = config_version;
628+ doc[" schedule_version" ] = scheduler.getVersion ();
629+ doc[" schedule_plan_version" ] = scheduler.getPlanVersion ();
628630
629631 doc[" vehicle_state_update" ] = (millis () - evse.getVehicleLastUpdated ()) / 1000 ;
630632 if (teslaClient.getVehicleCnt () > 0 ) {
You can’t perform that action at this time.
0 commit comments