Merge branch 'hub-prices' into dev-v2.2

This commit is contained in:
Gunnar Skjold
2022-12-02 19:08:29 +01:00
13 changed files with 309 additions and 171 deletions

View File

@@ -200,15 +200,12 @@ void setup() {
hw.ledBlink(LED_GREEN, 1);
hw.ledBlink(LED_BLUE, 1);
#if defined(ESP32)
EntsoeConfig entsoe;
if(config.getEntsoeConfig(entsoe) && strlen(entsoe.token) > 0) {
if(config.getEntsoeConfig(entsoe) && strlen(entsoe.area) > 0) {
eapi = new EntsoeApi(&Debug);
eapi->setup(entsoe);
ws.setEntsoeApi(eapi);
}
#endif
bool shared = false;
config.getMeterConfig(meterConfig);
Serial.flush();
@@ -514,7 +511,6 @@ void loop() {
mqtt->disconnect();
}
#if defined(ESP32)
try {
if(eapi != NULL && ntpEnabled) {
if(eapi->loop() && mqtt != NULL && mqttHandler != NULL && mqtt->connected()) {
@@ -524,7 +520,7 @@ void loop() {
if(config.isEntsoeChanged()) {
EntsoeConfig entsoe;
if(config.getEntsoeConfig(entsoe) && strlen(entsoe.token) > 0) {
if(config.getEntsoeConfig(entsoe) && strlen(entsoe.area) > 0) {
if(eapi == NULL) {
eapi = new EntsoeApi(&Debug);
ea.setEapi(eapi);
@@ -541,7 +537,6 @@ void loop() {
} catch(const std::exception& e) {
debugE("Exception in ENTSO-E loop (%s)", e.what());
}
#endif
ws.loop();
}
if(mqtt != NULL) {

View File

@@ -0,0 +1,8 @@
#ifndef _PRICESCONTAINER_H
#define _PRICESCONTAINER_H
struct PricesContainer {
char currency[4];
char measurementUnit[4];
int32_t points[24];
};
#endif