Send price config to cloud

This commit is contained in:
Gunnar Skjold
2024-08-24 21:22:43 +02:00
parent c4736c730e
commit f5c10c1a50
2 changed files with 2 additions and 4 deletions

View File

@@ -37,7 +37,7 @@
#warning "Unsupported board type"
#endif
#define CC_BUF_SIZE 2048
#define CC_BUF_SIZE 4096
static const char CC_JSON_POWER[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu}";
static const char CC_JSON_POWER_LIST3[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu,\"tP\":%.3f,\"tQ\":%.3f}";

View File

@@ -257,7 +257,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
dns1.toString().c_str(),
dns2.toString().c_str()
);
sendData = pos > CC_BUF_SIZE - 768;
} else if(lastPriceConfig == 0) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"price\":{\"area\":\"%s\",\"currency\":\"%s\",\"modifiers\":["), priceConfig.area, priceConfig.currency);
if(ps != NULL) {
@@ -314,7 +313,7 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("]}"));
lastPriceConfig = now;
sendData = pos > CC_BUF_SIZE - 768;
sendData = false;
} else if(lastEac == 0) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"accounting\":{\"hours\":%d,\"thresholds\":[%d,%d,%d,%d,%d,%d,%d,%d,%d]}"),
eac.hours,
@@ -329,7 +328,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
eac.thresholds[8]
);
lastEac = now;
sendData = pos > CC_BUF_SIZE - 768;
}
if(sendData) {