API - Json keys rename
Signed-off-by: Martin Kolací <martin.kolaci@lmc.eu>
This commit is contained in:
@@ -34,10 +34,8 @@ typedef struct {
|
|||||||
time_t currentTime;
|
time_t currentTime;
|
||||||
time_t chargingStartTime;
|
time_t chargingStartTime;
|
||||||
time_t automaticShutdownTimer;
|
time_t automaticShutdownTimer;
|
||||||
#ifdef SIM800L_ENABLED
|
|
||||||
time_t lastDataSent;
|
time_t lastDataSent;
|
||||||
bool sim800l_enabled;
|
bool sim800l_enabled;
|
||||||
#endif //SIM800L_ENABLED
|
|
||||||
bool ignitionOn;
|
bool ignitionOn;
|
||||||
bool ignitionOnPrevious;
|
bool ignitionOnPrevious;
|
||||||
bool forwardDriveMode;
|
bool forwardDriveMode;
|
||||||
|
|||||||
2
config.h
2
config.h
@@ -53,7 +53,7 @@
|
|||||||
#define SIM800L_RX 16
|
#define SIM800L_RX 16
|
||||||
#define SIM800L_TX 17
|
#define SIM800L_TX 17
|
||||||
#define SIM800L_RST 5
|
#define SIM800L_RST 5
|
||||||
#define SIM800L_TIMER 120
|
#define SIM800L_TIMER 60
|
||||||
#endif //SIM800L_ENABLED
|
#endif //SIM800L_ENABLED
|
||||||
|
|
||||||
// MENU ITEM
|
// MENU ITEM
|
||||||
|
|||||||
37
evDash.ino
37
evDash.ino
@@ -467,23 +467,24 @@ bool sendDataViaGPRS() {
|
|||||||
|
|
||||||
Serial.println("Start HTTP POST...");
|
Serial.println("Start HTTP POST...");
|
||||||
|
|
||||||
StaticJsonDocument<250> jsonData;
|
StaticJsonDocument<450> jsonData;
|
||||||
|
|
||||||
jsonData["akey"] = liveData->settings.remoteApiKey;
|
jsonData["apikey"] = liveData->settings.remoteApiKey;
|
||||||
jsonData["soc"] = liveData->params.socPerc;
|
jsonData["carType"] = liveData->settings.carType;
|
||||||
jsonData["soh"] = liveData->params.sohPerc;
|
jsonData["socPerc"] = liveData->params.socPerc;
|
||||||
jsonData["batK"] = liveData->params.batPowerKw;
|
jsonData["sohPerc"] = liveData->params.sohPerc;
|
||||||
jsonData["batA"] = liveData->params.batPowerAmp;
|
jsonData["batPowerKw"] = liveData->params.batPowerKw;
|
||||||
jsonData["batV"] = liveData->params.batVoltage;
|
jsonData["batPowerAmp"] = liveData->params.batPowerAmp;
|
||||||
jsonData["auxV"] = liveData->params.auxVoltage;
|
jsonData["batVoltage"] = liveData->params.batVoltage;
|
||||||
jsonData["MinC"] = liveData->params.batMinC;
|
jsonData["auxVoltage"] = liveData->params.auxVoltage;
|
||||||
jsonData["MaxC"] = liveData->params.batMaxC;
|
jsonData["batMinC"] = liveData->params.batMinC;
|
||||||
jsonData["InlC"] = liveData->params.batInletC;
|
jsonData["batMaxC"] = liveData->params.batMaxC;
|
||||||
jsonData["fan"] = liveData->params.batFanStatus;
|
jsonData["batInletC"] = liveData->params.batInletC;
|
||||||
jsonData["cumCh"] = liveData->params.cumulativeEnergyChargedKWh;
|
jsonData["batFanStatus"] = liveData->params.batFanStatus;
|
||||||
jsonData["cumD"] = liveData->params.cumulativeEnergyDischargedKWh;
|
jsonData["cumulativeEnergyChargedKWh"] = liveData->params.cumulativeEnergyChargedKWh;
|
||||||
|
jsonData["cumulativeEnergyDischargedKWh"] = liveData->params.cumulativeEnergyDischargedKWh;
|
||||||
|
|
||||||
char payload[200];
|
char payload[450];
|
||||||
serializeJson(jsonData, payload);
|
serializeJson(jsonData, payload);
|
||||||
|
|
||||||
Serial.print("Sending payload: ");
|
Serial.print("Sending payload: ");
|
||||||
@@ -492,12 +493,12 @@ bool sendDataViaGPRS() {
|
|||||||
Serial.print("Remote API server: ");
|
Serial.print("Remote API server: ");
|
||||||
Serial.println(liveData->settings.remoteApiUrl);
|
Serial.println(liveData->settings.remoteApiUrl);
|
||||||
|
|
||||||
uint16_t rc = sim800l->doPost(liveData->settings.remoteApiSrvr, "application/json", payload, 10000, 10000);
|
uint16_t rc = sim800l->doPost(liveData->settings.remoteApiUrl, "application/json", payload, 10000, 10000);
|
||||||
if(rc == 200) {
|
if(rc == 200) {
|
||||||
Serial.println(F("HTTP POST successful"));
|
Serial.println("HTTP POST successful");
|
||||||
} else {
|
} else {
|
||||||
// Failed...
|
// Failed...
|
||||||
Serial.print(F("HTTP POST error: "));
|
Serial.print("HTTP POST error: ");
|
||||||
Serial.println(rc);
|
Serial.println(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user