PCE: Add missing default values for modbus registers in firmware >= 0.25

master
Simon Stürz 2026-02-19 11:37:13 +01:00
parent 169875344c
commit 362c5f5db2
3 changed files with 59 additions and 44 deletions

View File

@ -331,9 +331,10 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Actual charging power (Since firmware version: 0.25)", "description": "Actual charging power (>= 0.25)",
"unit": "W", "unit": "W",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "digitalInputFlag", "id": "digitalInputFlag",
@ -341,8 +342,9 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Actual digital input (Since firmware version: 0.25)", "description": "Actual digital input (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "modeR37", "id": "modeR37",
@ -351,8 +353,9 @@
"type": "uint16", "type": "uint16",
"enum": "R37Mode", "enum": "R37Mode",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Monitoring mode for the R37 regulation (Since firmware version: 0.25)", "description": "Monitoring mode for the R37 regulation (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "R37ModeNoMonitoring"
}, },
{ {
"id": "phasesR37", "id": "phasesR37",
@ -360,8 +363,9 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "1 or 3 phases which get monitored, depends on the DIP switch (Since firmware version: 0.25)", "description": "1 or 3 phases which get monitored, depends on the DIP switch (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "deplayR37", "id": "deplayR37",
@ -370,8 +374,9 @@
"type": "uint16", "type": "uint16",
"unit": "s", "unit": "s",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Delay until undevoltage error triggers in R37 meter monitoring mode, default 3 seconds (Since firmware version: 0.25)", "description": "Delay until undevoltage error triggers in R37 meter monitoring mode, default 3 seconds (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "3"
}, },
{ {
"id": "undervoltageLimitR37", "id": "undervoltageLimitR37",
@ -380,8 +385,9 @@
"type": "uint16", "type": "uint16",
"unit": "V", "unit": "V",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Undevoltage limit for the error trigger in R37 meter monitoring mode, default 184 V (Since firmware version: 0.25)", "description": "Undevoltage limit for the error trigger in R37 meter monitoring mode, default 184 V (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "184"
}, },
{ {
"id": "voltageL1", "id": "voltageL1",
@ -391,8 +397,9 @@
"unit": "V", "unit": "V",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Voltage L1 (Since firmware version: 0.25)", "description": "Voltage L1 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "voltageL2", "id": "voltageL2",
@ -402,8 +409,9 @@
"unit": "V", "unit": "V",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Voltage L2 (Since firmware version: 0.25)", "description": "Voltage L2 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "voltageL3", "id": "voltageL3",
@ -413,8 +421,9 @@
"unit": "V", "unit": "V",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Voltage L3 (Since firmware version: 0.25)", "description": "Voltage L3 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "currentL1", "id": "currentL1",
@ -424,8 +433,9 @@
"unit": "A", "unit": "A",
"staticScaleFactor": -3, "staticScaleFactor": -3,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Current L1 (Since firmware version: 0.25)", "description": "Current L1 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "currentL2", "id": "currentL2",
@ -435,8 +445,9 @@
"unit": "A", "unit": "A",
"staticScaleFactor": -3, "staticScaleFactor": -3,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Current L2 (Since firmware version: 0.25)", "description": "Current L2 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "currentL3", "id": "currentL3",
@ -446,8 +457,9 @@
"unit": "A", "unit": "A",
"staticScaleFactor": -3, "staticScaleFactor": -3,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Current L3 (Since firmware version: 0.25)", "description": "Current L3 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "activePowerL1", "id": "activePowerL1",
@ -457,8 +469,9 @@
"unit": "W", "unit": "W",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Active power L1 (Since firmware version: 0.25)", "description": "Active power L1 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "activePowerL2", "id": "activePowerL2",
@ -468,8 +481,9 @@
"unit": "W", "unit": "W",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Active power L2 (Since firmware version: 0.25)", "description": "Active power L2 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "activePowerL3", "id": "activePowerL3",
@ -479,8 +493,9 @@
"unit": "W", "unit": "W",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Active power L3 (Since firmware version: 0.25)", "description": "Active power L3 (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
}, },
{ {
"id": "totalEnergyConsumed", "id": "totalEnergyConsumed",
@ -490,8 +505,9 @@
"unit": "kWh", "unit": "kWh",
"staticScaleFactor": -1, "staticScaleFactor": -1,
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Total energy consumed (Since firmware version: 0.25)", "description": "Total energy consumed (>= 0.25)",
"access": "RO" "access": "RO",
"defaultValue": "0"
} }
] ]
} }
@ -544,7 +560,8 @@
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "LED brightness", "description": "LED brightness",
"unit": "%", "unit": "%",
"access": "RW" "access": "RW",
"defaultValue": "50"
}, },
{ {
"id": "digitalInputMode", "id": "digitalInputMode",
@ -554,7 +571,8 @@
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Digital input mode", "description": "Digital input mode",
"enum": "DigitalInputMode", "enum": "DigitalInputMode",
"access": "RW" "access": "RW",
"defaultValue": "DigitalInputModeEnableCharging"
}, },
{ {
"id": "phaseAutoSwitchPause", "id": "phaseAutoSwitchPause",
@ -562,7 +580,7 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Phase auto switch pause (Since firmware version: 0.25)", "description": "Phase auto switch pause (>= 0.25)",
"unit": "s", "unit": "s",
"defaultValue": "6", "defaultValue": "6",
"access": "RW" "access": "RW"
@ -573,7 +591,7 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Phase auto switch min charging time (Since firmware version: 0.25)", "description": "Phase auto switch min charging time (>= 0.25)",
"unit": "s", "unit": "s",
"defaultValue": "120", "defaultValue": "120",
"access": "RW" "access": "RW"
@ -584,7 +602,7 @@
"size": 1, "size": 1,
"type": "uint16", "type": "uint16",
"registerType": "holdingRegister", "registerType": "holdingRegister",
"description": "Force charging resume (Since firmware version: 0.25)", "description": "Force charging resume (>= 0.25)",
"defaultValue": "0", "defaultValue": "0",
"access": "RW" "access": "RW"
} }

View File

@ -60,7 +60,6 @@ void IntegrationPluginPcElectric::discoverThings(ThingDiscoveryInfo *info)
PcElectricDiscovery *discovery = new PcElectricDiscovery(hardwareManager()->networkDeviceDiscovery(), 502, 1, info); PcElectricDiscovery *discovery = new PcElectricDiscovery(hardwareManager()->networkDeviceDiscovery(), 502, 1, info);
connect(discovery, &PcElectricDiscovery::discoveryFinished, info, [=]() { connect(discovery, &PcElectricDiscovery::discoveryFinished, info, [=]() {
foreach (const PcElectricDiscovery::Result &result, discovery->results()) { foreach (const PcElectricDiscovery::Result &result, discovery->results()) {
if (info->thingClassId() != result.thingClassId) if (info->thingClassId() != result.thingClassId)
continue; continue;
@ -116,7 +115,7 @@ void IntegrationPluginPcElectric::setupThing(ThingSetupInfo *info)
m_monitors.insert(thing, monitor); m_monitors.insert(thing, monitor);
connect(info, &ThingSetupInfo::aborted, monitor, [=]() { connect(info, &ThingSetupInfo::aborted, monitor, [this, thing]() {
if (m_monitors.contains(thing)) { if (m_monitors.contains(thing)) {
qCDebug(dcPcElectric()) << "Unregistering monitor because setup has been aborted."; qCDebug(dcPcElectric()) << "Unregistering monitor because setup has been aborted.";
hardwareManager()->networkDeviceDiscovery()->unregisterMonitor(m_monitors.take(thing)); hardwareManager()->networkDeviceDiscovery()->unregisterMonitor(m_monitors.take(thing));
@ -272,10 +271,9 @@ void IntegrationPluginPcElectric::executeAction(ThingActionInfo *info)
uint desiredPhaseCount = 1; uint desiredPhaseCount = 1;
if (info->action().actionTypeId() == ev11DesiredPhaseCountActionTypeId) { if (info->action().actionTypeId() == ev11DesiredPhaseCountActionTypeId) {
desiredPhaseCount = info->action().paramValue(ev11DesiredPhaseCountActionDesiredPhaseCountParamTypeId).toUInt(); desiredPhaseCount = info->action().paramValue(ev11DesiredPhaseCountActionDesiredPhaseCountParamTypeId).toUInt();
;
} else if (info->action().actionTypeId() == ev11NoMeterDesiredPhaseCountActionTypeId) { } else if (info->action().actionTypeId() == ev11NoMeterDesiredPhaseCountActionTypeId) {
desiredPhaseCount = info->action().paramValue(ev11NoMeterDesiredPhaseCountActionDesiredPhaseCountParamTypeId).toUInt(); desiredPhaseCount = info->action().paramValue(ev11NoMeterDesiredPhaseCountActionDesiredPhaseCountParamTypeId).toUInt();
;
} }
qCDebug(dcPcElectric()) << "Set desried phase count to" << desiredPhaseCount; qCDebug(dcPcElectric()) << "Set desried phase count to" << desiredPhaseCount;
@ -318,7 +316,7 @@ void IntegrationPluginPcElectric::setupConnection(ThingSetupInfo *info)
connection->modbusTcpMaster()->setHostAddress(monitor->networkDeviceInfo().address()); connection->modbusTcpMaster()->setHostAddress(monitor->networkDeviceInfo().address());
// Monitor reachability // Monitor reachability
connect(monitor, &NetworkDeviceMonitor::reachableChanged, thing, [=](bool reachable) { connect(monitor, &NetworkDeviceMonitor::reachableChanged, thing, [thing, connection, monitor](bool reachable) {
if (!thing->setupComplete()) if (!thing->setupComplete())
return; return;
@ -618,7 +616,7 @@ void IntegrationPluginPcElectric::setupConnection(ThingSetupInfo *info)
m_connections.insert(thing, connection); m_connections.insert(thing, connection);
info->finish(Thing::ThingErrorNoError); info->finish(Thing::ThingErrorNoError);
// Connect reight the way if the monitor indicates reachable, otherwise the connect will handle the connect later // Connect right the way if the monitor indicates reachable, otherwise the connect will handle the connect later
if (monitor->reachable()) if (monitor->reachable())
connection->connectDevice(); connection->connectDevice();
} }

View File

@ -71,7 +71,6 @@ private:
QHash<ThingClassId, ParamTypeId> m_macParamTypes; QHash<ThingClassId, ParamTypeId> m_macParamTypes;
QHash<ThingClassId, ParamTypeId> m_serialNumberParamTypes; QHash<ThingClassId, ParamTypeId> m_serialNumberParamTypes;
void setupConnection(ThingSetupInfo *info); void setupConnection(ThingSetupInfo *info);
}; };