Skip to content

Commit

Permalink
Send price config to cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
gskjold committed Aug 24, 2024
1 parent c4736c7 commit f5c10c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/CloudConnector/include/CloudConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
Expand Down
4 changes: 1 addition & 3 deletions lib/CloudConnector/src/CloudConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand All @@ -329,7 +328,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
eac.thresholds[8]
);
lastEac = now;
sendData = pos > CC_BUF_SIZE - 768;
}

if(sendData) {
Expand Down

0 comments on commit f5c10c1

Please sign in to comment.