|
6 | 6 | #include "ocpp.h" |
7 | 7 |
|
8 | 8 | #include <MicroOcpp.h> |
| 9 | +#include <MicroOcpp/Model/Diagnostics/DiagnosticsService.h> |
| 10 | +#include <MicroOcpp/Model/FirmwareManagement/FirmwareService.h> |
9 | 11 | #include <MongooseCore.h> |
10 | 12 |
|
11 | 13 | #include "app_config.h" |
@@ -274,17 +276,17 @@ void OcppTask::loadEvseBehavior() { |
274 | 276 | * Synchronize OpenEVSE data with OCPP-library data |
275 | 277 | */ |
276 | 278 |
|
277 | | - addMeterValueInput([this] () { |
278 | | - return evse->getAmps() * evse->getVoltage(); |
279 | | - }, |
280 | | - "Power.Active.Import", |
281 | | - "W"); |
282 | | - |
283 | | - addMeterValueInput([this] () { |
284 | | - return evse->getTotalEnergy() * 1000.; //convert kWh into Wh |
285 | | - }, |
286 | | - "Energy.Active.Import.Register", |
287 | | - "Wh"); |
| 279 | + //basic meter readings |
| 280 | + |
| 281 | + setEnergyMeterInput([this] () { |
| 282 | + return evse->getTotalEnergy() * 1000.; //convert kWh into Wh |
| 283 | + }); |
| 284 | + |
| 285 | + setPowerMeterInput([this] () { |
| 286 | + return evse->getAmps() * evse->getVoltage(); |
| 287 | + }); |
| 288 | + |
| 289 | + //further meter readings |
288 | 290 |
|
289 | 291 | addMeterValueInput([this] () { |
290 | 292 | return evse->getAmps(); |
@@ -525,6 +527,11 @@ void OcppTask::updateEvseClaim() { |
525 | 527 | evseState = EvseState::Disabled; |
526 | 528 | } |
527 | 529 |
|
| 530 | + //check further error condition not handled by Atmega |
| 531 | + if (rfid->communicationFails()) { |
| 532 | + evseState = EvseState::Disabled; |
| 533 | + } |
| 534 | + |
528 | 535 | evseProperties = evseState; |
529 | 536 |
|
530 | 537 | //OCPP Smart Charging? |
@@ -728,7 +735,7 @@ void OcppTask::initializeFwService() { |
728 | 735 |
|
729 | 736 | bool OcppTask::isConnected() { |
730 | 737 | if (instance && instance->connection) { |
731 | | - return instance->connection->isConnectionOpen(); |
| 738 | + return instance->connection->isConnected(); |
732 | 739 | } |
733 | 740 | return false; |
734 | 741 | } |
|
0 commit comments