@@ -40,6 +40,9 @@ void Evse::setup() {
4040 snprintf (key, 30 , " evPlugged_cId_%u" , connectorId);
4141 trackEvPluggedKey = key;
4242 trackEvPluggedBool = MicroOcpp::declareConfiguration (trackEvPluggedKey.c_str (), false , SIMULATOR_FN, false , false , false );
43+ snprintf (key, 30 , " evsePlugged_cId_%u" , connectorId);
44+ trackEvsePluggedKey = key;
45+ trackEvsePluggedBool = MicroOcpp::declareConfiguration (trackEvsePluggedKey.c_str (), false , SIMULATOR_FN, false , false , false );
4346 snprintf (key, 30 , " evReady_cId_%u" , connectorId);
4447 trackEvReadyKey = key;
4548 trackEvReadyBool = MicroOcpp::declareConfiguration (trackEvReadyKey.c_str (), false , SIMULATOR_FN, false , false , false );
@@ -124,7 +127,7 @@ void Evse::loop() {
124127 status = MicroOcpp::cstrFromOcppEveState (curStatus);
125128 }
126129
127- bool simulate_isCharging = ocppPermitsCharge (connectorId) && trackEvPluggedBool->getBool () && trackEvReadyBool->getBool () && trackEvseReadyBool->getBool ();
130+ bool simulate_isCharging = ocppPermitsCharge (connectorId) && trackEvPluggedBool->getBool () && trackEvsePluggedBool-> getBool () && trackEvReadyBool->getBool () && trackEvseReadyBool->getBool ();
128131
129132 simulate_isCharging &= limit_power >= 720 .f ; // minimum charging current is 6A (720W for 120V grids) according to J1772
130133
@@ -189,6 +192,17 @@ bool Evse::getEvPlugged() {
189192 return trackEvPluggedBool->getBool ();
190193}
191194
195+ void Evse::setEvsePlugged (bool plugged) {
196+ if (!trackEvsePluggedBool) return ;
197+ trackEvsePluggedBool->setBool (plugged);
198+ MicroOcpp::configuration_save ();
199+ }
200+
201+ bool Evse::getEvsePlugged () {
202+ if (!trackEvsePluggedBool) return false ;
203+ return trackEvsePluggedBool->getBool ();
204+ }
205+
192206void Evse::setEvReady (bool ready) {
193207 if (!trackEvReadyBool) return ;
194208 trackEvReadyBool->setBool (ready);
0 commit comments