From dfb96142671b81e5f7b5b86b356bbd028103d015 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 7 Dec 2022 21:10:20 +0100 Subject: [PATCH] Phoenix: Ignore invalid emeter values in some models --- phoenixconnect/integrationpluginphoenixconnect.cpp | 5 ++++- phoenixconnect/integrationpluginphoenixconnect.json | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/phoenixconnect/integrationpluginphoenixconnect.cpp b/phoenixconnect/integrationpluginphoenixconnect.cpp index 63cae37..5c435cd 100644 --- a/phoenixconnect/integrationpluginphoenixconnect.cpp +++ b/phoenixconnect/integrationpluginphoenixconnect.cpp @@ -191,7 +191,10 @@ void IntegrationPluginPhoenixConnect::setupThing(ThingSetupInfo *info) connect(connection, &PhoenixModbusTcpConnection::activePowerChanged, thing, [thing](quint32 activePower) { qCDebug(dcPhoenixConnect()) << "Active power consumption changed" << activePower; if (thing->hasState("currentPower")) { - thing->setStateValue("currentPower", activePower); + // Note: Explicitly casting to to signed integer as apparently in some setups the meter may + // occationally report negative energy flow by some 1 - 3 Watt causing the modbus controller + // register to underflow and report values like 0xFFFFFFFE (-2W) etc. + thing->setStateValue("currentPower", (qint32)activePower); } }); diff --git a/phoenixconnect/integrationpluginphoenixconnect.json b/phoenixconnect/integrationpluginphoenixconnect.json index 770a923..8e86b93 100644 --- a/phoenixconnect/integrationpluginphoenixconnect.json +++ b/phoenixconnect/integrationpluginphoenixconnect.json @@ -13,6 +13,7 @@ "displayName": "Wallbe ECO 2.0", "name": "wallbeEco2", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "connectable"], "paramTypes": [ { @@ -118,6 +119,7 @@ "displayName": "Wallbe Pro", "name": "wallbePro", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "smartmeterconsumer", "connectable"], "paramTypes": [ { @@ -239,6 +241,7 @@ "displayName": "Compleo ECO s", "name": "compleoEcoS", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "connectable"], "paramTypes": [ { @@ -344,6 +347,7 @@ "displayName": "Compleo PRO", "name": "compleoPro", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "smartmeterconsumer", "connectable"], "paramTypes": [ { @@ -465,6 +469,7 @@ "displayName": "Scapo Economy", "name": "scapoEco", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "connectable"], "paramTypes": [ { @@ -570,6 +575,7 @@ "displayName": "Scapo Vision", "name": "scapoVision", "createMethods": ["discovery", "user"], + "discoveryType": "weak", "interfaces": ["evcharger", "smartmeterconsumer", "connectable"], "paramTypes": [ {