From 8f51dc29fc24b7478f325fde6fbd76ace3ba32fd Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Tue, 14 May 2024 19:10:15 +0200 Subject: [PATCH 1/2] fix setup.html formular for tibber --- src/web/html/setup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 506bda2e..60b00b3e 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -1590,9 +1590,9 @@ divsToHide.childNodes[5].style.display = 'none'; divsToHide.childNodes[6].style.display = 'none'; } - else if(value == "Tibber") { + /*else if(value == "Tibber") { divsToHide.childNodes[4].style.display = 'none'; - } + }*/ else if(value == "Shrdzm") { divsToHide.childNodes[1].style.display = 'none'; divsToHide.childNodes[2].style.display = 'none'; From c5056cbaeebbee744df87816e21361e07898b858 Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Tue, 14 May 2024 19:11:16 +0200 Subject: [PATCH 2/2] fix tibber query and timer --- src/plugins/zeroExport/powermeter.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/plugins/zeroExport/powermeter.h b/src/plugins/zeroExport/powermeter.h index 20cbf4e1..0c68a4ae 100644 --- a/src/plugins/zeroExport/powermeter.h +++ b/src/plugins/zeroExport/powermeter.h @@ -103,8 +103,8 @@ class powermeter { 863.25 MHz - geht (ohne Tibber Probleme) => 3 & 4 Balken */ case zeroExportPowermeterType_t::Tibber: + if(mCfg->groups[group].pm_refresh < 3) mCfg->groups[group].pm_refresh = 3; result = getPowermeterWattsTibber(*mLog, group, &power); - mPreviousTsp += 2000; // Zusätzliche Pause break; #endif #if defined(ZEROEXPORT_POWERMETER_SHRDZM) @@ -114,15 +114,16 @@ class powermeter { #endif } - if (result) { + //if (mMqtt->isConnected()) mMqtt->publish(String("zero/state/groups/" + String(group) + "/result").c_str(), String(ret).c_str(), false); + + if (result) + { bufferWrite(power, group); // MQTT - Powermeter -// if (mCfg->debug) { - if (mMqtt->isConnected()) { - mMqtt->publish(String("zero/state/groups/" + String(group) + "/powermeter/P").c_str(), String(ah::round1(power)).c_str(), false); - } -// } + if (mMqtt->isConnected()) { + mMqtt->publish(String("zero/state/groups/" + String(group) + "/powermeter/P").c_str(), String(ah::round1(power)).c_str(), false); + } } } } @@ -181,7 +182,7 @@ class powermeter { } /** onMqttMessage - * + * This function is needed for all mqtt connections between ahoy and other devices. */ void onMqttMessage(JsonObject obj) { String topic = String(obj["topic"]); @@ -198,6 +199,7 @@ class powermeter { if (strcmp(mCfg->groups[group].pm_src, String(topic).c_str())) continue; float power = 0.0; + power = (uint16_t)obj["val"]; bufferWrite(power, group); @@ -479,20 +481,19 @@ class powermeter { {{0x01, 0x00, 0x02, 0x08, 0x00, 0xff}, &smlOBISWh, &_powerMeterExport}}; bool getPowermeterWattsTibber(JsonObject logObj, uint8_t group, float *power) { - mPreviousTsp = mPreviousTsp + 2000; // Zusätzliche Pause - bool result = false; logObj["mod"] = "getPowermeterWattsTibber"; String auth = mCfg->groups[group].pm_pass; - String url = String("http://") + mCfg->groups[group].pm_url + String("/") + String(mCfg->groups[group].pm_jsonPath); + String url = String("http://") + mCfg->groups[group].pm_src + String("/") + String(mCfg->groups[group].pm_jsonPath); setHeader(&http); http.begin(url); http.addHeader("Authorization", "Basic " + auth); - if (http.GET() == HTTP_CODE_OK && http.getSize() > 0) { + if (http.GET() == HTTP_CODE_OK && http.getSize() > 0) + { String myString = http.getString(); double readVal = 0; unsigned char c;