iobroker.zendure-solarflow 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -59,6 +59,10 @@ On a HUB 1200 / HUB 2000 / ACE 1500 combination you have to use '**setDeviceAuto
|
|
|
59
59
|
This adapter will now use the Cloud Authorization Code for authentication on the official mqtt servers, which you can generate in the Zendure app!
|
|
60
60
|
|
|
61
61
|
## Changelog
|
|
62
|
+
### 3.3.1 (2026-01-30)
|
|
63
|
+
|
|
64
|
+
- Fix caluclation issue
|
|
65
|
+
|
|
62
66
|
### 3.3.0 (2026-01-30)
|
|
63
67
|
|
|
64
68
|
- Fix 'has no existing object' messages on pvPower3 + 4
|
|
@@ -1073,14 +1073,20 @@ class ZenHaDevice {
|
|
|
1073
1073
|
stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower2`;
|
|
1074
1074
|
break;
|
|
1075
1075
|
case "pvPower3":
|
|
1076
|
-
|
|
1076
|
+
const pvPower3StateDef = this.states.find(
|
|
1077
|
+
(x) => x.title == "pvPower3"
|
|
1078
|
+
);
|
|
1079
|
+
if (pvPower3StateDef) {
|
|
1077
1080
|
stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodayWh`;
|
|
1078
1081
|
stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodaykWh`;
|
|
1079
1082
|
stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower3`;
|
|
1080
1083
|
}
|
|
1081
1084
|
break;
|
|
1082
1085
|
case "pvPower4":
|
|
1083
|
-
|
|
1086
|
+
const pvPower4StateDef = this.states.find(
|
|
1087
|
+
(x) => x.title == "pvPower4"
|
|
1088
|
+
);
|
|
1089
|
+
if (pvPower4StateDef) {
|
|
1084
1090
|
stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodayWh`;
|
|
1085
1091
|
stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodaykWh`;
|
|
1086
1092
|
stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower4`;
|
|
@@ -1092,43 +1098,48 @@ class ZenHaDevice {
|
|
|
1092
1098
|
stateNamePower = `${this.productKey}.${this.deviceKey}.${stateKey}Power`;
|
|
1093
1099
|
break;
|
|
1094
1100
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
true
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1101
|
+
if (stateNamePower != "") {
|
|
1102
|
+
this.adapter.log.debug(
|
|
1103
|
+
`[calculateEnergy] No stateNamePower found for ${stateKey}!`
|
|
1104
|
+
);
|
|
1105
|
+
const currentPowerState = await ((_a = this.adapter) == null ? void 0 : _a.getStateAsync(stateNamePower));
|
|
1106
|
+
const currentEnergyState = await ((_b = this.adapter) == null ? void 0 : _b.getStateAsync(stateNameEnergyWh));
|
|
1107
|
+
if (!(currentEnergyState == null ? void 0 : currentEnergyState.val) || (currentEnergyState == null ? void 0 : currentEnergyState.val) == 0) {
|
|
1108
|
+
await ((_c = this.adapter) == null ? void 0 : _c.setState(stateNameEnergyWh, 1e-6, true));
|
|
1109
|
+
} else if (currentEnergyState && currentEnergyState.lc && currentPowerState && currentPowerState.val != void 0 && currentPowerState.val != null) {
|
|
1110
|
+
const timeFrame = 3e4;
|
|
1111
|
+
const addEnergyValue = Number(currentPowerState.val) * timeFrame / 36e5;
|
|
1112
|
+
let newEnergyValue = Number(currentEnergyState.val) + addEnergyValue;
|
|
1113
|
+
if (newEnergyValue < 0) {
|
|
1114
|
+
newEnergyValue = 0;
|
|
1115
|
+
}
|
|
1116
|
+
await ((_d = this.adapter) == null ? void 0 : _d.setState(stateNameEnergyWh, newEnergyValue, true));
|
|
1117
|
+
await ((_e = this.adapter) == null ? void 0 : _e.setState(
|
|
1118
|
+
stateNameEnergykWh,
|
|
1119
|
+
Number((newEnergyValue / 1e3).toFixed(2)),
|
|
1120
|
+
true
|
|
1121
|
+
));
|
|
1122
|
+
if ((stateKey == "outputPack" || stateKey == "packInput") && addEnergyValue > 0) {
|
|
1123
|
+
await this.calculateSocAndEnergy(stateKey, addEnergyValue);
|
|
1124
|
+
} else {
|
|
1125
|
+
if (stateKey == "outputPack") {
|
|
1126
|
+
await ((_f = this.adapter) == null ? void 0 : _f.setState(
|
|
1127
|
+
`${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,
|
|
1128
|
+
"",
|
|
1129
|
+
true
|
|
1130
|
+
));
|
|
1131
|
+
} else if (stateKey == "packInput") {
|
|
1132
|
+
await ((_g = this.adapter) == null ? void 0 : _g.setState(
|
|
1133
|
+
`${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,
|
|
1134
|
+
"",
|
|
1135
|
+
true
|
|
1136
|
+
));
|
|
1137
|
+
}
|
|
1127
1138
|
}
|
|
1139
|
+
} else if (currentPowerState && currentEnergyState) {
|
|
1140
|
+
await ((_h = this.adapter) == null ? void 0 : _h.setState(stateNameEnergyWh, 0, true));
|
|
1141
|
+
await ((_i = this.adapter) == null ? void 0 : _i.setState(stateNameEnergykWh, 0, true));
|
|
1128
1142
|
}
|
|
1129
|
-
} else if (currentPowerState && currentEnergyState) {
|
|
1130
|
-
await ((_h = this.adapter) == null ? void 0 : _h.setState(stateNameEnergyWh, 0, true));
|
|
1131
|
-
await ((_i = this.adapter) == null ? void 0 : _i.setState(stateNameEnergykWh, 0, true));
|
|
1132
1143
|
}
|
|
1133
1144
|
});
|
|
1134
1145
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/ZenHaDevice.ts"],
|
|
4
|
-
"sourcesContent": ["import { createHash } from \"crypto\";\nimport { calculationStateKeys } from \"../../constants/constants\";\nimport { createCalculationStates } from \"../../helpers/createCalculationStates\";\nimport { toHoursAndMinutes } from \"../../helpers/timeHelper\";\nimport { ZendureSolarflow } from \"../../main\";\nimport {\n knownPackDataProperties,\n onSubscribeIotTopic,\n onSubscribeReportTopic,\n} from \"../../services/mqttSharedService\";\nimport { IDevicePack } from \"../IDevicePack\";\nimport { IPackData } from \"../IPackData\";\nimport { ISolarflowState } from \"../ISolarflowState\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\n\nexport class ZenHaDevice {\n public zenHaDeviceDetails?: IZenHaDeviceDetails;\n public adapter: ZendureSolarflow;\n\n public productKey: string;\n public deviceKey: string;\n public productName: string;\n public deviceName: string;\n public messageId: number = 0;\n public batteries: IDevicePack[] = [];\n\n public iotTopic: string = \"\";\n public functionTopic = \"\";\n public password: string = \"\";\n\n public maxInputLimit: number = 0;\n public maxOutputLimit: number = 0;\n\n public states: ISolarflowState[] = [];\n public controlStates: ISolarflowState[] = [];\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails,\n ) {\n this.zenHaDeviceDetails = _zenHaDeviceDetails;\n this.adapter = _adapter;\n this.productKey = _productKey;\n this.deviceKey = _deviceKey;\n\n this.deviceName = _deviceName;\n this.productName = _productName;\n\n this.iotTopic = `iot/${_productKey}/${_deviceKey}/properties/write`;\n this.functionTopic = `iot/${_productKey}/${_deviceKey}/function/invoke`;\n\n // Calculate device password\n this.password = createHash(\"md5\")\n .update(_deviceKey, \"utf8\")\n .digest(\"hex\")\n .toUpperCase()\n .substring(8, 24);\n\n // Create or update states\n this.createSolarFlowStates();\n\n // Subscribe to report topic (get telemetry)\n this.subscribeReportTopic();\n\n // Subscribe to Iot topic (push control values)\n this.subscribeIotTopic();\n\n // Get complete data from device after a timeout\n this.adapter.setTimeout(() => {\n this.triggerFullTelemetryUpdate();\n }, 5000);\n\n if (this.zenHaDeviceDetails?.online) {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n } else if (this.zenHaDeviceDetails?.online == false) {\n this.updateSolarFlowState(\"wifiState\", \"Disconnected\");\n }\n }\n\n private async createSolarFlowStates(): Promise<void> {\n const productKey = this.productKey.replace(\n this.adapter.FORBIDDEN_CHARS,\n \"\",\n );\n const deviceKey = this.deviceKey.replace(this.adapter.FORBIDDEN_CHARS, \"\");\n\n this.adapter.log.debug(\n `[createSolarFlowStates] Creating or updating SolarFlow states for ${this.productName} (${productKey}/${deviceKey}) and name '${this.deviceName}'.`,\n );\n\n // Create device (e.g. the product type -> SolarFlow)\n await this.adapter?.extendObject(productKey, {\n type: \"device\",\n common: {\n name: {\n de: `${this.productName} (${productKey})`,\n en: `${this.productName} (${productKey})`,\n },\n },\n native: {},\n });\n\n // Create channel (e.g. the device specific key)\n await this.adapter?.extendObject(productKey + \".\" + deviceKey, {\n type: \"channel\",\n common: {\n name: {\n de: `${this.deviceName} (${deviceKey})`,\n en: `${this.deviceName} (${deviceKey})`,\n },\n },\n native: {},\n });\n\n // Create pack data folder\n await this.adapter?.extendObject(`${productKey}.${deviceKey}.packData`, {\n type: \"channel\",\n common: {\n name: {\n de: \"Batterie Packs\",\n en: \"Battery packs\",\n },\n },\n native: {},\n });\n\n // Create report states\n this.states.forEach(async (state: ISolarflowState) => {\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.${state.title}`,\n {\n type: \"state\",\n common: {\n name: {\n de: state.nameDe,\n en: state.nameEn,\n },\n type: state.type,\n desc: state.title,\n role: state.role,\n read: true,\n write: false,\n unit: state.unit,\n states: state.states,\n },\n native: {},\n },\n );\n });\n\n // Create control folder\n await this.adapter?.extendObject(`${productKey}.${deviceKey}.control`, {\n type: \"channel\",\n common: {\n name: {\n de: \"Steuerung f\u00FCr Ger\u00E4t \" + deviceKey,\n en: \"Control for device \" + deviceKey,\n },\n },\n native: {},\n });\n\n this.controlStates.forEach(async (state: ISolarflowState) => {\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.control.${state.title}`,\n {\n type: \"state\",\n common: {\n name: {\n de: state.nameDe,\n en: state.nameEn,\n },\n type: state.type,\n desc: state.title,\n role: state.role,\n read: true,\n write: true,\n unit: state.unit,\n states: state.states,\n },\n native: {},\n },\n );\n\n // Subscribe to states to respond to changes\n this.adapter?.subscribeStates(\n `${productKey}.${deviceKey}.control.${state.title}`,\n );\n });\n\n if (this.adapter.config.useCalculation) {\n // Create calculations folder\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.calculations`,\n {\n type: \"channel\",\n common: {\n name: {\n de: \"Berechnungen f\u00FCr Ger\u00E4t \" + deviceKey,\n en: \"Calculations for Device \" + deviceKey,\n },\n },\n native: {},\n },\n );\n\n await createCalculationStates(this.adapter, productKey, deviceKey);\n }\n }\n\n public subscribeReportTopic(): void {\n const reportTopic = `/${this.productKey}/${this.deviceKey}/#`;\n\n if (this.adapter) {\n this.adapter.log.debug(\n `[subscribeReportTopic] Subscribing to MQTT Topic: ${reportTopic}`,\n );\n this.adapter.mqttClient?.subscribe(reportTopic, onSubscribeReportTopic);\n }\n }\n\n private subscribeIotTopic(): void {\n const iotTopic = `iot/${this.productKey}/${this.deviceKey}/#`;\n\n this.adapter?.log.debug(\n `[subscribeIotTopic] Subscribing to MQTT Topic: ${iotTopic}`,\n );\n this.adapter?.mqttClient?.subscribe(iotTopic, (error) => {\n onSubscribeIotTopic(error, this.productKey, this.deviceKey);\n });\n }\n\n public setDeviceAutomationInOutLimit(limit: number): void {\n this.adapter?.log.error(\n `[setAcMode] Method setDeviceAutomationInOutLimit (set to ${limit}) not defined in base class!`,\n );\n return;\n }\n\n public setAcMode(acMode: number): void {\n this.adapter?.log.error(\n `[setAcMode] Method setAcMode (set to ${acMode}) not defined in base class!`,\n );\n return;\n }\n\n public setDcSwitch(dcSwitch: boolean): void {\n this.adapter?.log.error(\n `[setAcMode] Method setDcSwitch (set to ${dcSwitch}) not defined in base class!`,\n );\n return;\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n this.adapter?.log.error(\n `[setAcMode] Method setAcSwitch (set to ${acSwitch}) not defined in base class!`,\n );\n return;\n }\n\n public setHubState(hubState: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (hubState == 0 || hubState == 1) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const socSetLimit = { properties: { hubState: hubState } };\n this.adapter.log.debug(\n `[setHubState] Setting Hub State for deviceKey ${this.deviceKey} to ${hubState}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(socSetLimit));\n } else {\n this.adapter.log.debug(`[setHubState] Hub state is not 0 or 1!`);\n }\n }\n }\n\n public setPassMode(passMode: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setPassModeContent = { properties: { passMode: passMode } };\n this.adapter.log.debug(\n `[setPassMode] Set passMode for deviceKey ${this.deviceKey} to ${passMode}!`,\n );\n this.adapter.mqttClient?.publish(\n topic,\n JSON.stringify(setPassModeContent),\n );\n }\n }\n\n public setAutoRecover(autoRecover: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setAutoRecoverContent = {\n properties: { autoRecover: autoRecover ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAutoRecover] Set autoRecover for deviceKey ${this.deviceKey} to ${autoRecover}!`,\n );\n this.adapter.mqttClient?.publish(\n topic,\n JSON.stringify(setAutoRecoverContent),\n );\n }\n }\n\n /**\n * Will set the discharge limit (minSoc)\n * @param socSet the desired minimum soc\n * @returns void\n */\n public setDischargeLimit(minSoc: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (minSoc >= 0 && minSoc <= 50) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const socSetLimit = { properties: { minSoc: minSoc * 10 } };\n this.adapter.log.debug(\n `[setDischargeLimit] Setting Discharge Limit for device key ${this.deviceKey} to ${minSoc}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(socSetLimit));\n } else {\n this.adapter.log.debug(\n `[setDischargeLimit] Discharge limit is not in range 0<>50!`,\n );\n }\n }\n }\n\n /**\n * Will set the maximum charge limit\n * @param socSet the desired max SOC\n * @returns void\n */\n public setChargeLimit(socSet: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (socSet >= 40 && socSet <= 100) {\n const socSetLimit = { properties: { socSet: socSet * 10 } };\n this.adapter.log.debug(\n `[setChargeLimit] Setting ChargeLimit for device key ${this.deviceKey} to ${socSet}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(socSetLimit),\n );\n } else {\n this.adapter.log.debug(\n `[setChargeLimit] Charge limit is not in range 40<>100!`,\n );\n }\n }\n }\n\n /**\n * Will set the 'energy plan'\n * @param autoModel autoModel value, like 8 for smart matching\n * @returns void\n */\n public setAutoModel(autoModel: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n let setAutoModelContent: any = { properties: { autoModel: autoModel } };\n\n switch (autoModel) {\n case 8: {\n // Smart Matching Modus\n setAutoModelContent = {\n properties: {\n autoModelProgram: 1,\n autoModelValue: {\n chargingType: 0,\n chargingPower: 0,\n outPower: 0,\n },\n msgType: 1,\n autoModel: 8,\n },\n };\n break;\n }\n case 9: // Smart CT Modus\n setAutoModelContent = {\n properties: {\n autoModelProgram: 2,\n autoModelValue: {\n chargingType: 3,\n chargingPower: 0,\n outPower: 0,\n },\n msgType: 1,\n autoModel: 9,\n },\n };\n break;\n }\n\n this.adapter.log.debug(\n `[setAutoModel] Setting autoModel for device key ${this.deviceKey} to ${autoModel}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAutoModelContent),\n );\n }\n }\n\n public async setOutputLimit(limit: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n // Check if autoModel is set to 0 (Nothing) or 8 (Smart Matching)\n const autoModel = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".autoModel\",\n )\n )?.val;\n\n if (autoModel != 0) {\n this.adapter.log.warn(\n \"Operation mode (autoModel) is not set to '0', we can't set the output limit!\",\n );\n return;\n }\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\n }\n\n // Limit to the device max limit\n if (limit > this.maxOutputLimit) {\n limit = this.maxOutputLimit;\n }\n\n if (\n limit < 100 &&\n limit != 90 &&\n limit != 60 &&\n limit != 30 &&\n limit != 0 &&\n (this.productKey == \"73bktv\" || this.productKey == \"a8yh63\")\n ) {\n // NUR Solarflow HUB: Das Limit kann unter 100 nur in 30er Schritten gesetzt werden, dH. 30/60/90/100, wir rechnen das also um\n if (limit < 100 && limit > 90) {\n limit = 90;\n } else if (limit > 60 && limit < 90) {\n limit = 60;\n } else if (limit > 30 && limit < 60) {\n limit = 30;\n } else if (limit < 30) {\n limit = 30;\n }\n }\n\n if (this.adapter.config.useLowVoltageBlock) {\n const lowVoltageBlockState = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.lowVoltageBlock\",\n );\n if (\n lowVoltageBlockState &&\n lowVoltageBlockState.val &&\n lowVoltageBlockState.val == true\n ) {\n limit = 0;\n }\n\n const fullChargeNeeded = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.fullChargeNeeded\",\n );\n\n if (\n fullChargeNeeded &&\n fullChargeNeeded.val &&\n fullChargeNeeded.val == true\n ) {\n limit = 0;\n }\n }\n\n const currentLimit = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".outputLimit\",\n )\n )?.val;\n\n if (currentLimit != null && currentLimit != undefined) {\n if (currentLimit != limit) {\n const outputlimit = { properties: { outputLimit: limit } };\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(outputlimit),\n );\n }\n }\n }\n }\n\n public setInputLimit(limit: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n // Limit has always to be positive!\n if (limit < 0) {\n this.adapter.log.debug(\n `[setInputLimit] limit ${limit} is negative, converting to positive!`,\n );\n limit = Math.abs(limit);\n }\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\n }\n\n if (limit < 0) {\n limit = 0;\n } else if (limit > 0 && limit <= 30) {\n limit = 30;\n } else if (limit > this.maxInputLimit) {\n limit = this.maxInputLimit;\n }\n\n if (this.productKey.includes(\"8bm93h\")) {\n // Das Limit kann beim ACE nur in 100er Schritten gesetzt werden\n limit = Math.ceil(limit / 100) * 100;\n }\n\n const inputLimitContent = { properties: { inputLimit: limit } };\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(inputLimitContent),\n );\n }\n }\n\n public setSmartMode(smartModeOn: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setSmartModeContent = {\n properties: { smartMode: smartModeOn ? 1 : 0 },\n };\n\n this.adapter.log.debug(\n `[setBuzzer] Setting Smart Mode for device key ${this.deviceKey} to ${smartModeOn}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setSmartModeContent),\n );\n }\n }\n\n public setBuzzerSwitch(buzzerOn: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setBuzzerSwitchContent = {\n properties: { buzzerSwitch: buzzerOn ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setBuzzer] Setting Buzzer for device key ${this.deviceKey} to ${buzzerOn}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setBuzzerSwitchContent),\n );\n }\n }\n\n public triggerFullTelemetryUpdate(): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/read`;\n\n const getAllContent = { properties: [\"getAll\"] };\n this.adapter.log.debug(\n `[triggerFullTelemetryUpdate] Triggering full telemetry update for device key ${this.deviceKey}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(getAllContent));\n }\n }\n\n public async updateSolarFlowState(\n state: string,\n val: number | string | boolean,\n ): Promise<void> {\n const currentValue = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.${state}`,\n );\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.${state}`,\n val,\n true,\n );\n\n if (currentValue?.val != val && state != \"wifiState\") {\n // Set lastUpdate for deviceKey if a value was changed!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n }\n\n public async updateSolarFlowControlState(\n state: string,\n val: number | string | boolean,\n ): Promise<void> {\n // First check if state exist\n const stateExist = await this.adapter?.objectExists(\n `${this.productKey}.${this.deviceKey}.control.${state}`,\n );\n\n // Update the control state\n if (stateExist) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.${state}`,\n val,\n true,\n );\n }\n }\n\n addOrUpdatePackData = async (\n packData: IPackData[],\n isSolarFlow: boolean,\n ): Promise<void> => {\n if (this.adapter && this.productKey && this.deviceKey) {\n await packData.forEach(async (x) => {\n // Process data only with a serial id!\n if (x.sn && this.adapter) {\n // Create channel (e.g. the device specific key)\n // We can determine the type of the battery by the SN number.\n let batType = \"\";\n if (this.productKey == \"yWF7hV\") {\n batType = \"AIO2400\";\n } else if (x.sn.startsWith(\"A\")) {\n batType = \"AB1000\";\n } else if (x.sn.startsWith(\"B\")) {\n batType = \"AB1000S\";\n } else if (x.sn.startsWith(\"C\")) {\n if (x.sn[3] == \"F\") {\n batType = \"AB2000S\";\n } else {\n batType = \"AB2000\";\n }\n } else if (x.sn.startsWith(\"F\")) {\n batType = \"AB3000X\";\n }\n\n // Check if is in Pack2device list\n if (!this.batteries.some((y) => y.packSn == x.sn)) {\n this.batteries.push({\n packSn: x.sn,\n type: batType,\n });\n\n this.adapter.log.debug(\n `[addOrUpdatePackData] Added battery ${batType} with SN ${x.sn} on deviceKey ${this.deviceKey} to batteries array!`,\n );\n }\n\n // create a state for the serial id\n const key = (\n this.productKey +\n \".\" +\n this.deviceKey +\n \".packData.\" +\n x.sn\n ).replace(this.adapter.FORBIDDEN_CHARS, \"\");\n\n await this.adapter?.extendObject(key, {\n type: \"channel\",\n common: {\n name: {\n de: batType,\n en: batType,\n },\n },\n native: {},\n });\n\n await this.adapter?.extendObject(key + \".model\", {\n type: \"state\",\n common: {\n name: {\n de: \"Batterietyp\",\n en: \"Battery type\",\n },\n type: \"string\",\n desc: \"model\",\n role: \"value\",\n read: true,\n write: false,\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".model\", batType, true);\n\n await this.adapter?.extendObject(key + \".sn\", {\n type: \"state\",\n common: {\n name: {\n de: \"Seriennummer\",\n en: \"Serial id\",\n },\n type: \"string\",\n desc: \"Serial ID\",\n role: \"value\",\n read: true,\n write: false,\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".sn\", x.sn, true);\n\n if (x.socLevel) {\n // State f\u00FCr socLevel\n await this.adapter?.extendObject(key + \".socLevel\", {\n type: \"state\",\n common: {\n name: {\n de: \"SOC der Batterie\",\n en: \"soc of battery\",\n },\n type: \"number\",\n desc: \"SOC Level\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"%\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".socLevel\", x.socLevel, true);\n }\n\n if (x.maxTemp) {\n const maxTempCelsius = x.maxTemp / 10 - 273.15;\n const maxTempState = await this.adapter?.getStateAsync(\n key + \".maxTemp\",\n );\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (\n maxTempState &&\n maxTempState.val &&\n maxTempCelsius != maxTempState.val\n ) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n // State f\u00FCr maxTemp\n await this.adapter?.extendObject(key + \".maxTemp\", {\n type: \"state\",\n common: {\n name: {\n de: \"Max. Temperatur der Batterie\",\n en: \"max temp. of battery\",\n },\n type: \"number\",\n desc: \"Max. Temp\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"\u00B0C\",\n },\n native: {},\n });\n\n // Convert Kelvin to Celsius\n await this.adapter?.setState(\n key + \".maxTemp\",\n maxTempCelsius,\n true,\n );\n }\n\n if (x.minVol) {\n const minVol = x.minVol / 100;\n const minVolState = await this.adapter?.getStateAsync(\n key + \".minVol\",\n );\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (minVolState && minVolState.val && minVol != minVolState.val) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".minVol\", {\n type: \"state\",\n common: {\n name: \"minVol\",\n type: \"number\",\n desc: \"minVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".minVol\", minVol, true);\n }\n\n if (x.batcur) {\n await this.adapter?.extendObject(key + \".batcur\", {\n type: \"state\",\n common: {\n name: \"batcur\",\n type: \"number\",\n desc: \"batcur\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"A\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".batcur\", x.batcur / 10, true);\n }\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (x.maxVol) {\n const maxVol = x.maxVol / 100;\n const maxVolState = await this.adapter?.getStateAsync(\n key + \".maxVol\",\n );\n\n if (maxVolState && maxVolState.val && maxVol != maxVolState.val) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".maxVol\", {\n type: \"state\",\n common: {\n name: \"maxVol\",\n type: \"number\",\n desc: \"maxVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".maxVol\", maxVol, true);\n }\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (x.totalVol) {\n const totalVol = x.totalVol / 100;\n\n const totalVolState = await this.adapter?.getStateAsync(\n key + \".totalVol\",\n );\n\n if (\n totalVolState &&\n totalVolState.val &&\n totalVol != totalVolState.val\n ) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".totalVol\", {\n type: \"state\",\n common: {\n name: \"totalVol\",\n type: \"number\",\n desc: \"totalVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".totalVol\", totalVol, true);\n\n // Send Voltage to checkVoltage Method (only if is Solarflow device)\n if (isSolarFlow) {\n this.checkVoltage(totalVol);\n }\n }\n\n if (x.soh) {\n await this.adapter?.extendObject(key + \".soh\", {\n type: \"state\",\n common: {\n name: {\n de: \"Gesundheitszustand\",\n en: \"State of Health\",\n },\n type: \"number\",\n desc: \"State of Health\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"%\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".soh\", x.soh / 10, true);\n }\n\n if (x.power) {\n await this.adapter?.extendObject(key + \".power\", {\n type: \"state\",\n common: {\n name: {\n de: \"Energie\",\n en: \"Power\",\n },\n type: \"number\",\n desc: \"Power\",\n read: true,\n write: false,\n role: \"value.power\",\n unit: \"W\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".power\", x.power, true);\n }\n\n // Debug, send message if property is unknown!\n let found = false;\n\n Object.entries(x).forEach(([key, value]) => {\n knownPackDataProperties.forEach((property: string) => {\n if (property == key) {\n found = true;\n }\n });\n\n if (found) {\n //console.log(\n // `${productName?.val}: ${key} with value ${value} is a KNOWN Mqtt Prop!`\n //);\n } else {\n this.adapter?.log.debug(\n `[addOrUpdatePackData] ${key} with value ${value} is a UNKNOWN PackData Mqtt Property!`,\n );\n }\n });\n }\n });\n }\n };\n\n public async checkVoltage(voltage: number): Promise<void> {\n if (voltage < 46.1) {\n if (this.adapter.config.useCalculation) {\n this.setSocToZero();\n }\n\n if (this.adapter.config.useLowVoltageBlock) {\n // Activate Low Voltage Block\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n true,\n true,\n );\n\n // Low Voltage Block activated, stop power input immediately\n const autoModel = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".autoModel\",\n )\n )?.val;\n if (autoModel == 8) {\n this.setDeviceAutomationInOutLimit(0);\n } else {\n this.setOutputLimit(0);\n }\n\n if (this.adapter.config.forceShutdownOnLowVoltage) {\n const currentSoc = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.electricLevel`,\n );\n\n if (currentSoc && Number(currentSoc.val) > 50) {\n // We can't shut down the device. Full charge needed!\n if (this.adapter.config.fullChargeIfNeeded) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.fullChargeNeeded`,\n true,\n true,\n );\n }\n } else {\n if (currentSoc && currentSoc.val) {\n this.setDischargeLimit(Number(currentSoc.val));\n }\n\n // Check if device setting is correct\n const hubState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.hubState`,\n );\n\n if (!hubState || Number(hubState.val) != 1) {\n this.adapter.log.warn(\n `[checkVoltage] hubState is not set to 'Stop output and shut down', device will NOT go offline!`,\n );\n }\n }\n }\n }\n } else if (voltage >= 47.5) {\n // Deactivate Low Voltage Block\n const lowVoltageBlock = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n );\n\n if (lowVoltageBlock && lowVoltageBlock.val == true) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n false,\n true,\n );\n\n if (\n this.adapter.config.useLowVoltageBlock &&\n this.adapter.config.forceShutdownOnLowVoltage\n ) {\n this.setDischargeLimit(\n this.adapter.config.dischargeLimit\n ? this.adapter.config.dischargeLimit\n : 5,\n );\n }\n }\n }\n }\n\n /**\n * Calculates the energy for all items in 'calculationStateKeys'.\n *\n * @returns Promise<void>\n *\n * @beta\n */\n public calculateEnergy(): void {\n calculationStateKeys.forEach(async (stateKey) => {\n let stateNameEnergyWh = \"\";\n let stateNameEnergykWh = \"\";\n let stateNamePower = \"\";\n\n switch (stateKey) {\n case \"pvPower1\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower1`;\n break;\n case \"pvPower2\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower2`;\n break;\n case \"pvPower3\":\n if (this.states.find((x) => x.title == \"pvPower3\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower3`;\n }\n break;\n case \"pvPower4\":\n if (this.states.find((x) => x.title == \"pvPower4\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower4`;\n }\n break;\n default:\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.${stateKey}Power`;\n break;\n }\n\n const currentPowerState =\n await this.adapter?.getStateAsync(stateNamePower);\n\n const currentEnergyState =\n await this.adapter?.getStateAsync(stateNameEnergyWh);\n\n if (!currentEnergyState?.val || currentEnergyState?.val == 0) {\n // Workaround, set Val to very low value to avoid Jump in data...\n await this.adapter?.setState(stateNameEnergyWh, 0.000001, true);\n } else if (\n currentEnergyState &&\n currentEnergyState.lc &&\n currentPowerState &&\n currentPowerState.val != undefined &&\n currentPowerState.val != null\n ) {\n // Timeframe = 30000ms, Job runs every 30 seconds...\n const timeFrame = 30000;\n\n // Calculate Energy value (Wh) from current power in the timeframe from last run...\n const addEnergyValue =\n (Number(currentPowerState.val) * timeFrame) / 3600000; // Wh\n\n /* // Use efficiency factor (used the one from Youtube Channel VoltAmpereLux - thanks!)\n const chargingFactor = 0.96; // Efficiency 96%\n const dischargingFactor = 1.08 - addEnergyValue / 10000; // Efficiency 92% - 98% (92% + Energy / 10000 = 600W -> +6%)\n\n // Calculate energy from efficiency factor if value for charging or discharging\n addEnergyValue =\n stateKey == \"outputPack\" && addEnergyValue > 0\n ? addEnergyValue * chargingFactor\n : addEnergyValue;\n addEnergyValue =\n stateKey == \"packInput\" && addEnergyValue > 0\n ? addEnergyValue * dischargingFactor\n : addEnergyValue; */\n\n let newEnergyValue = Number(currentEnergyState.val) + addEnergyValue;\n\n // Fix negative value\n if (newEnergyValue < 0) {\n newEnergyValue = 0;\n }\n\n await this.adapter?.setState(stateNameEnergyWh, newEnergyValue, true);\n await this.adapter?.setState(\n stateNameEnergykWh,\n Number((newEnergyValue / 1000).toFixed(2)),\n true,\n );\n\n // SOC and energy in batteries\n if (\n (stateKey == \"outputPack\" || stateKey == \"packInput\") &&\n addEnergyValue > 0\n ) {\n await this.calculateSocAndEnergy(stateKey, addEnergyValue);\n } else {\n if (stateKey == \"outputPack\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n } else if (stateKey == \"packInput\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n }\n }\n } else if (currentPowerState && currentEnergyState) {\n await this.adapter?.setState(stateNameEnergyWh, 0, true);\n await this.adapter?.setState(stateNameEnergykWh, 0, true);\n }\n });\n }\n\n public calculateSocAndEnergy = async (\n stateKey: string,\n value: number,\n ): Promise<void> => {\n this.adapter.log.debug(\n `[calculateSocAndEnergy] Calculating for: ${this.productKey}.${this.deviceKey} and stateKey ${stateKey}!`,\n );\n\n let energyWhMax: number | undefined = undefined;\n\n const minSoc = (\n await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.minSoc`,\n )\n )?.val;\n const currentSoc = (\n await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.electricLevel`,\n )\n )?.val;\n\n if (currentSoc && minSoc && Number(currentSoc) < Number(minSoc)) {\n // Don't calculate if current SOC is lower then minimum\n this.adapter.log.debug(\n `[calculateSocAndEnergy] Don't calculate, currentSoc (${Number(currentSoc)}) is lower than minSoc (${Number(minSoc)})!`,\n );\n\n return;\n }\n\n const currentEnergyState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWh\",\n );\n\n const currentEnergyMaxState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWhMax\",\n );\n\n const lowVoltageBlock = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.lowVoltageBlock\",\n );\n\n const currentMaxValue = Number(\n currentEnergyMaxState ? currentEnergyMaxState.val : 0,\n );\n\n let currentEnergyWh = currentEnergyState?.val\n ? Number(currentEnergyState?.val)\n : 0;\n\n if (\n currentEnergyWh == null ||\n currentEnergyWh == undefined ||\n currentEnergyWh <= 0\n ) {\n currentEnergyWh = 0;\n }\n\n if (this.productKey == \"yWF7hV\") {\n // The device is an AIO 2400, so set maximum Wh to 2400!\n energyWhMax = 2400;\n } else {\n // Iterate over all batteries!\n for (let i = 0; i < this.batteries.length; i++) {\n if (this.batteries[i].type == \"AB1000\") {\n energyWhMax = (energyWhMax ? energyWhMax : 0) + 960;\n } else if (this.batteries[i].type == \"AB2000\") {\n energyWhMax = (energyWhMax ? energyWhMax : 0) + 1920;\n }\n }\n }\n\n // newValue is the current available energy in the batteries. If outputPack (charging) add value, if packInput (discharging) subtract value.\n let newEnergyWh =\n stateKey == \"outputPack\"\n ? currentEnergyWh + value\n : currentEnergyWh - value;\n\n // If greater than Max of batteries, set it to this value.\n if (\n stateKey == \"outputPack\" &&\n energyWhMax != undefined &&\n newEnergyWh > energyWhMax\n ) {\n newEnergyWh = energyWhMax;\n\n this.adapter.log.debug(\n `[calculateSocAndEnergy] newEnergyWh (${newEnergyWh}) is greater than energyWhMax (${energyWhMax}), don't extend value!`,\n );\n }\n\n if (newEnergyWh > 0) {\n this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n newEnergyWh,\n true,\n );\n\n this.adapter.log.debug(\n `[calculateSocAndEnergy] set '${this.productKey}.${this.deviceKey}.calculations.energyWh' to ${newEnergyWh}!`,\n );\n\n if (currentEnergyMaxState) {\n const soc = Number(((newEnergyWh / currentMaxValue) * 100).toFixed(1));\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.soc`,\n soc > 100.0 ? 100 : soc,\n true,\n );\n\n if (newEnergyWh > currentMaxValue && !lowVoltageBlock?.val) {\n // Extend maxVal\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n newEnergyWh,\n true,\n );\n }\n\n const currentOutputPackPower = await this.adapter?.getStateAsync(\n `${this.productKey}.${this.deviceKey}.outputPackPower`,\n );\n\n const currentPackInputPower = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".packInputPower\",\n );\n\n if (\n stateKey == \"outputPack\" &&\n currentOutputPackPower?.val != null &&\n currentOutputPackPower != undefined\n ) {\n // Charging, calculate remaining charging time\n const toCharge = currentMaxValue - newEnergyWh;\n\n const remainHoursAsDecimal =\n toCharge / Number(currentOutputPackPower.val);\n\n if (remainHoursAsDecimal < 48.0) {\n const remainFormatted = toHoursAndMinutes(\n Math.round(remainHoursAsDecimal * 60),\n );\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n remainFormatted,\n true,\n );\n } else {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n }\n } else if (\n stateKey == \"packInput\" &&\n currentPackInputPower != null &&\n currentPackInputPower != undefined\n ) {\n // Discharging, calculate remaining discharge time\n const remainHoursAsDecimal =\n newEnergyWh / Number(currentPackInputPower.val);\n const remainFormatted = toHoursAndMinutes(\n Math.round(remainHoursAsDecimal * 60),\n );\n\n if (remainHoursAsDecimal < 48.0) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n remainFormatted,\n true,\n );\n } else {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n }\n }\n }\n } else if (newEnergyWh <= 0 && stateKey == \"outputPack\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n } else if (newEnergyWh <= 0 && stateKey == \"packInput\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n\n // TEST: if SOC == 0, add newValue as positive to energyWhMax\n const newEnergyWhPositive = Math.abs(newEnergyWh);\n\n if (energyWhMax && currentMaxValue + newEnergyWhPositive <= energyWhMax) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n currentMaxValue + newEnergyWhPositive,\n true,\n );\n }\n }\n };\n\n public async setSocToZero(): Promise<void> {\n // Set SOC to 0\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.soc`,\n 0,\n true,\n );\n\n // Calculate new Wh Max Value\n const energyWhState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n );\n const energyWhMaxState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n );\n\n const newMax = Number(energyWhMaxState?.val) - Number(energyWhState?.val);\n\n // Set Max Energy to value minus current energy\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n newMax,\n true,\n );\n\n // Set Energy in Battery to 0\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n 0,\n true,\n );\n }\n\n public async setEnergyWhMax(): Promise<void> {\n const currentEnergyState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWh\",\n );\n\n if (currentEnergyState) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n currentEnergyState?.val,\n true,\n );\n }\n }\n\n public resetValuesForDevice(): void {\n calculationStateKeys.forEach(async (stateKey: string) => {\n let stateNameEnergyWh = \"\";\n let stateNameEnergykWh = \"\";\n\n switch (stateKey) {\n case \"pvPower1\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodaykWh`;\n break;\n case \"pvPower2\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodaykWh`;\n break;\n case \"pvPower3\":\n if (this.states.find((x) => x.title == \"pvPower3\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodaykWh`;\n }\n break;\n case \"pvPower4\":\n if (this.states.find((x) => x.title == \"pvPower4\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodaykWh`;\n }\n break;\n default:\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodaykWh`;\n break;\n }\n\n await this.adapter?.setState(stateNameEnergyWh, 0, true);\n await this.adapter?.setState(stateNameEnergykWh, 0, true);\n });\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAC3B,uBAAqC;AACrC,qCAAwC;AACxC,wBAAkC;AAElC,+BAIO;AAMA,MAAM,YAAY;AAAA,EAqBhB,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AApBF,SAAO,YAAoB;AAC3B,SAAO,YAA2B,CAAC;AAEnC,SAAO,WAAmB;AAC1B,SAAO,gBAAgB;AACvB,SAAO,WAAmB;AAE1B,SAAO,gBAAwB;AAC/B,SAAO,iBAAyB;AAEhC,SAAO,SAA4B,CAAC;AACpC,SAAO,gBAAmC,CAAC;AA6lB3C,+BAAsB,OACpB,UACA,gBACkB;AAClB,UAAI,KAAK,WAAW,KAAK,cAAc,KAAK,WAAW;AACrD,cAAM,SAAS,QAAQ,OAAO,MAAM;AApoB1C;AAsoBQ,cAAI,EAAE,MAAM,KAAK,SAAS;AAGxB,gBAAI,UAAU;AACd,gBAAI,KAAK,cAAc,UAAU;AAC/B,wBAAU;AAAA,YACZ,WAAW,EAAE,GAAG,WAAW,GAAG,GAAG;AAC/B,wBAAU;AAAA,YACZ,WAAW,EAAE,GAAG,WAAW,GAAG,GAAG;AAC/B,wBAAU;AAAA,YACZ,WAAW,EAAE,GAAG,WAAW,GAAG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F,KAAK;AACH,8BAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AACxD,+BAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AACzD;AAAA,QACF,KAAK;AACH,cAAI,KAAK,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU,GAAG;AAClD,gCAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AACxD,iCAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AAAA,UAC3D;AACA;AAAA,QACF,KAAK;AACH,cAAI,KAAK,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU,GAAG;AAClD,gCAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AACxD,iCAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AAAA,UAC3D;AACA;AAAA,QACF;AACE,8BAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS,iBAAiB,QAAQ;AACjF,+BAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS,iBAAiB,QAAQ;AAClF;AAAA,MACJ;AAEA,cAAM,UAAK,YAAL,mBAAc,SAAS,mBAAmB,GAAG;AACnD,cAAM,UAAK,YAAL,mBAAc,SAAS,oBAAoB,GAAG;AAAA,IACtD,CAAC;AAAA,EACH;AACF;",
|
|
4
|
+
"sourcesContent": ["import { createHash } from \"crypto\";\nimport { calculationStateKeys } from \"../../constants/constants\";\nimport { createCalculationStates } from \"../../helpers/createCalculationStates\";\nimport { toHoursAndMinutes } from \"../../helpers/timeHelper\";\nimport { ZendureSolarflow } from \"../../main\";\nimport {\n knownPackDataProperties,\n onSubscribeIotTopic,\n onSubscribeReportTopic,\n} from \"../../services/mqttSharedService\";\nimport { IDevicePack } from \"../IDevicePack\";\nimport { IPackData } from \"../IPackData\";\nimport { ISolarflowState } from \"../ISolarflowState\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\n\nexport class ZenHaDevice {\n public zenHaDeviceDetails?: IZenHaDeviceDetails;\n public adapter: ZendureSolarflow;\n\n public productKey: string;\n public deviceKey: string;\n public productName: string;\n public deviceName: string;\n public messageId: number = 0;\n public batteries: IDevicePack[] = [];\n\n public iotTopic: string = \"\";\n public functionTopic = \"\";\n public password: string = \"\";\n\n public maxInputLimit: number = 0;\n public maxOutputLimit: number = 0;\n\n public states: ISolarflowState[] = [];\n public controlStates: ISolarflowState[] = [];\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails,\n ) {\n this.zenHaDeviceDetails = _zenHaDeviceDetails;\n this.adapter = _adapter;\n this.productKey = _productKey;\n this.deviceKey = _deviceKey;\n\n this.deviceName = _deviceName;\n this.productName = _productName;\n\n this.iotTopic = `iot/${_productKey}/${_deviceKey}/properties/write`;\n this.functionTopic = `iot/${_productKey}/${_deviceKey}/function/invoke`;\n\n // Calculate device password\n this.password = createHash(\"md5\")\n .update(_deviceKey, \"utf8\")\n .digest(\"hex\")\n .toUpperCase()\n .substring(8, 24);\n\n // Create or update states\n this.createSolarFlowStates();\n\n // Subscribe to report topic (get telemetry)\n this.subscribeReportTopic();\n\n // Subscribe to Iot topic (push control values)\n this.subscribeIotTopic();\n\n // Get complete data from device after a timeout\n this.adapter.setTimeout(() => {\n this.triggerFullTelemetryUpdate();\n }, 5000);\n\n if (this.zenHaDeviceDetails?.online) {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n } else if (this.zenHaDeviceDetails?.online == false) {\n this.updateSolarFlowState(\"wifiState\", \"Disconnected\");\n }\n }\n\n private async createSolarFlowStates(): Promise<void> {\n const productKey = this.productKey.replace(\n this.adapter.FORBIDDEN_CHARS,\n \"\",\n );\n const deviceKey = this.deviceKey.replace(this.adapter.FORBIDDEN_CHARS, \"\");\n\n this.adapter.log.debug(\n `[createSolarFlowStates] Creating or updating SolarFlow states for ${this.productName} (${productKey}/${deviceKey}) and name '${this.deviceName}'.`,\n );\n\n // Create device (e.g. the product type -> SolarFlow)\n await this.adapter?.extendObject(productKey, {\n type: \"device\",\n common: {\n name: {\n de: `${this.productName} (${productKey})`,\n en: `${this.productName} (${productKey})`,\n },\n },\n native: {},\n });\n\n // Create channel (e.g. the device specific key)\n await this.adapter?.extendObject(productKey + \".\" + deviceKey, {\n type: \"channel\",\n common: {\n name: {\n de: `${this.deviceName} (${deviceKey})`,\n en: `${this.deviceName} (${deviceKey})`,\n },\n },\n native: {},\n });\n\n // Create pack data folder\n await this.adapter?.extendObject(`${productKey}.${deviceKey}.packData`, {\n type: \"channel\",\n common: {\n name: {\n de: \"Batterie Packs\",\n en: \"Battery packs\",\n },\n },\n native: {},\n });\n\n // Create report states\n this.states.forEach(async (state: ISolarflowState) => {\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.${state.title}`,\n {\n type: \"state\",\n common: {\n name: {\n de: state.nameDe,\n en: state.nameEn,\n },\n type: state.type,\n desc: state.title,\n role: state.role,\n read: true,\n write: false,\n unit: state.unit,\n states: state.states,\n },\n native: {},\n },\n );\n });\n\n // Create control folder\n await this.adapter?.extendObject(`${productKey}.${deviceKey}.control`, {\n type: \"channel\",\n common: {\n name: {\n de: \"Steuerung f\u00FCr Ger\u00E4t \" + deviceKey,\n en: \"Control for device \" + deviceKey,\n },\n },\n native: {},\n });\n\n this.controlStates.forEach(async (state: ISolarflowState) => {\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.control.${state.title}`,\n {\n type: \"state\",\n common: {\n name: {\n de: state.nameDe,\n en: state.nameEn,\n },\n type: state.type,\n desc: state.title,\n role: state.role,\n read: true,\n write: true,\n unit: state.unit,\n states: state.states,\n },\n native: {},\n },\n );\n\n // Subscribe to states to respond to changes\n this.adapter?.subscribeStates(\n `${productKey}.${deviceKey}.control.${state.title}`,\n );\n });\n\n if (this.adapter.config.useCalculation) {\n // Create calculations folder\n await this.adapter?.extendObject(\n `${productKey}.${deviceKey}.calculations`,\n {\n type: \"channel\",\n common: {\n name: {\n de: \"Berechnungen f\u00FCr Ger\u00E4t \" + deviceKey,\n en: \"Calculations for Device \" + deviceKey,\n },\n },\n native: {},\n },\n );\n\n await createCalculationStates(this.adapter, productKey, deviceKey);\n }\n }\n\n public subscribeReportTopic(): void {\n const reportTopic = `/${this.productKey}/${this.deviceKey}/#`;\n\n if (this.adapter) {\n this.adapter.log.debug(\n `[subscribeReportTopic] Subscribing to MQTT Topic: ${reportTopic}`,\n );\n this.adapter.mqttClient?.subscribe(reportTopic, onSubscribeReportTopic);\n }\n }\n\n private subscribeIotTopic(): void {\n const iotTopic = `iot/${this.productKey}/${this.deviceKey}/#`;\n\n this.adapter?.log.debug(\n `[subscribeIotTopic] Subscribing to MQTT Topic: ${iotTopic}`,\n );\n this.adapter?.mqttClient?.subscribe(iotTopic, (error) => {\n onSubscribeIotTopic(error, this.productKey, this.deviceKey);\n });\n }\n\n public setDeviceAutomationInOutLimit(limit: number): void {\n this.adapter?.log.error(\n `[setAcMode] Method setDeviceAutomationInOutLimit (set to ${limit}) not defined in base class!`,\n );\n return;\n }\n\n public setAcMode(acMode: number): void {\n this.adapter?.log.error(\n `[setAcMode] Method setAcMode (set to ${acMode}) not defined in base class!`,\n );\n return;\n }\n\n public setDcSwitch(dcSwitch: boolean): void {\n this.adapter?.log.error(\n `[setAcMode] Method setDcSwitch (set to ${dcSwitch}) not defined in base class!`,\n );\n return;\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n this.adapter?.log.error(\n `[setAcMode] Method setAcSwitch (set to ${acSwitch}) not defined in base class!`,\n );\n return;\n }\n\n public setHubState(hubState: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (hubState == 0 || hubState == 1) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const socSetLimit = { properties: { hubState: hubState } };\n this.adapter.log.debug(\n `[setHubState] Setting Hub State for deviceKey ${this.deviceKey} to ${hubState}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(socSetLimit));\n } else {\n this.adapter.log.debug(`[setHubState] Hub state is not 0 or 1!`);\n }\n }\n }\n\n public setPassMode(passMode: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setPassModeContent = { properties: { passMode: passMode } };\n this.adapter.log.debug(\n `[setPassMode] Set passMode for deviceKey ${this.deviceKey} to ${passMode}!`,\n );\n this.adapter.mqttClient?.publish(\n topic,\n JSON.stringify(setPassModeContent),\n );\n }\n }\n\n public setAutoRecover(autoRecover: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setAutoRecoverContent = {\n properties: { autoRecover: autoRecover ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAutoRecover] Set autoRecover for deviceKey ${this.deviceKey} to ${autoRecover}!`,\n );\n this.adapter.mqttClient?.publish(\n topic,\n JSON.stringify(setAutoRecoverContent),\n );\n }\n }\n\n /**\n * Will set the discharge limit (minSoc)\n * @param socSet the desired minimum soc\n * @returns void\n */\n public setDischargeLimit(minSoc: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (minSoc >= 0 && minSoc <= 50) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const socSetLimit = { properties: { minSoc: minSoc * 10 } };\n this.adapter.log.debug(\n `[setDischargeLimit] Setting Discharge Limit for device key ${this.deviceKey} to ${minSoc}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(socSetLimit));\n } else {\n this.adapter.log.debug(\n `[setDischargeLimit] Discharge limit is not in range 0<>50!`,\n );\n }\n }\n }\n\n /**\n * Will set the maximum charge limit\n * @param socSet the desired max SOC\n * @returns void\n */\n public setChargeLimit(socSet: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (socSet >= 40 && socSet <= 100) {\n const socSetLimit = { properties: { socSet: socSet * 10 } };\n this.adapter.log.debug(\n `[setChargeLimit] Setting ChargeLimit for device key ${this.deviceKey} to ${socSet}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(socSetLimit),\n );\n } else {\n this.adapter.log.debug(\n `[setChargeLimit] Charge limit is not in range 40<>100!`,\n );\n }\n }\n }\n\n /**\n * Will set the 'energy plan'\n * @param autoModel autoModel value, like 8 for smart matching\n * @returns void\n */\n public setAutoModel(autoModel: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n let setAutoModelContent: any = { properties: { autoModel: autoModel } };\n\n switch (autoModel) {\n case 8: {\n // Smart Matching Modus\n setAutoModelContent = {\n properties: {\n autoModelProgram: 1,\n autoModelValue: {\n chargingType: 0,\n chargingPower: 0,\n outPower: 0,\n },\n msgType: 1,\n autoModel: 8,\n },\n };\n break;\n }\n case 9: // Smart CT Modus\n setAutoModelContent = {\n properties: {\n autoModelProgram: 2,\n autoModelValue: {\n chargingType: 3,\n chargingPower: 0,\n outPower: 0,\n },\n msgType: 1,\n autoModel: 9,\n },\n };\n break;\n }\n\n this.adapter.log.debug(\n `[setAutoModel] Setting autoModel for device key ${this.deviceKey} to ${autoModel}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAutoModelContent),\n );\n }\n }\n\n public async setOutputLimit(limit: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n // Check if autoModel is set to 0 (Nothing) or 8 (Smart Matching)\n const autoModel = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".autoModel\",\n )\n )?.val;\n\n if (autoModel != 0) {\n this.adapter.log.warn(\n \"Operation mode (autoModel) is not set to '0', we can't set the output limit!\",\n );\n return;\n }\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\n }\n\n // Limit to the device max limit\n if (limit > this.maxOutputLimit) {\n limit = this.maxOutputLimit;\n }\n\n if (\n limit < 100 &&\n limit != 90 &&\n limit != 60 &&\n limit != 30 &&\n limit != 0 &&\n (this.productKey == \"73bktv\" || this.productKey == \"a8yh63\")\n ) {\n // NUR Solarflow HUB: Das Limit kann unter 100 nur in 30er Schritten gesetzt werden, dH. 30/60/90/100, wir rechnen das also um\n if (limit < 100 && limit > 90) {\n limit = 90;\n } else if (limit > 60 && limit < 90) {\n limit = 60;\n } else if (limit > 30 && limit < 60) {\n limit = 30;\n } else if (limit < 30) {\n limit = 30;\n }\n }\n\n if (this.adapter.config.useLowVoltageBlock) {\n const lowVoltageBlockState = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.lowVoltageBlock\",\n );\n if (\n lowVoltageBlockState &&\n lowVoltageBlockState.val &&\n lowVoltageBlockState.val == true\n ) {\n limit = 0;\n }\n\n const fullChargeNeeded = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.fullChargeNeeded\",\n );\n\n if (\n fullChargeNeeded &&\n fullChargeNeeded.val &&\n fullChargeNeeded.val == true\n ) {\n limit = 0;\n }\n }\n\n const currentLimit = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".outputLimit\",\n )\n )?.val;\n\n if (currentLimit != null && currentLimit != undefined) {\n if (currentLimit != limit) {\n const outputlimit = { properties: { outputLimit: limit } };\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(outputlimit),\n );\n }\n }\n }\n }\n\n public setInputLimit(limit: number): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n // Limit has always to be positive!\n if (limit < 0) {\n this.adapter.log.debug(\n `[setInputLimit] limit ${limit} is negative, converting to positive!`,\n );\n limit = Math.abs(limit);\n }\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\n }\n\n if (limit < 0) {\n limit = 0;\n } else if (limit > 0 && limit <= 30) {\n limit = 30;\n } else if (limit > this.maxInputLimit) {\n limit = this.maxInputLimit;\n }\n\n if (this.productKey.includes(\"8bm93h\")) {\n // Das Limit kann beim ACE nur in 100er Schritten gesetzt werden\n limit = Math.ceil(limit / 100) * 100;\n }\n\n const inputLimitContent = { properties: { inputLimit: limit } };\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(inputLimitContent),\n );\n }\n }\n\n public setSmartMode(smartModeOn: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setSmartModeContent = {\n properties: { smartMode: smartModeOn ? 1 : 0 },\n };\n\n this.adapter.log.debug(\n `[setBuzzer] Setting Smart Mode for device key ${this.deviceKey} to ${smartModeOn}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setSmartModeContent),\n );\n }\n }\n\n public setBuzzerSwitch(buzzerOn: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setBuzzerSwitchContent = {\n properties: { buzzerSwitch: buzzerOn ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setBuzzer] Setting Buzzer for device key ${this.deviceKey} to ${buzzerOn}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setBuzzerSwitchContent),\n );\n }\n }\n\n public triggerFullTelemetryUpdate(): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/read`;\n\n const getAllContent = { properties: [\"getAll\"] };\n this.adapter.log.debug(\n `[triggerFullTelemetryUpdate] Triggering full telemetry update for device key ${this.deviceKey}!`,\n );\n this.adapter.mqttClient?.publish(topic, JSON.stringify(getAllContent));\n }\n }\n\n public async updateSolarFlowState(\n state: string,\n val: number | string | boolean,\n ): Promise<void> {\n const currentValue = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.${state}`,\n );\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.${state}`,\n val,\n true,\n );\n\n if (currentValue?.val != val && state != \"wifiState\") {\n // Set lastUpdate for deviceKey if a value was changed!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n }\n\n public async updateSolarFlowControlState(\n state: string,\n val: number | string | boolean,\n ): Promise<void> {\n // First check if state exist\n const stateExist = await this.adapter?.objectExists(\n `${this.productKey}.${this.deviceKey}.control.${state}`,\n );\n\n // Update the control state\n if (stateExist) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.${state}`,\n val,\n true,\n );\n }\n }\n\n addOrUpdatePackData = async (\n packData: IPackData[],\n isSolarFlow: boolean,\n ): Promise<void> => {\n if (this.adapter && this.productKey && this.deviceKey) {\n await packData.forEach(async (x) => {\n // Process data only with a serial id!\n if (x.sn && this.adapter) {\n // Create channel (e.g. the device specific key)\n // We can determine the type of the battery by the SN number.\n let batType = \"\";\n if (this.productKey == \"yWF7hV\") {\n batType = \"AIO2400\";\n } else if (x.sn.startsWith(\"A\")) {\n batType = \"AB1000\";\n } else if (x.sn.startsWith(\"B\")) {\n batType = \"AB1000S\";\n } else if (x.sn.startsWith(\"C\")) {\n if (x.sn[3] == \"F\") {\n batType = \"AB2000S\";\n } else {\n batType = \"AB2000\";\n }\n } else if (x.sn.startsWith(\"F\")) {\n batType = \"AB3000X\";\n }\n\n // Check if is in Pack2device list\n if (!this.batteries.some((y) => y.packSn == x.sn)) {\n this.batteries.push({\n packSn: x.sn,\n type: batType,\n });\n\n this.adapter.log.debug(\n `[addOrUpdatePackData] Added battery ${batType} with SN ${x.sn} on deviceKey ${this.deviceKey} to batteries array!`,\n );\n }\n\n // create a state for the serial id\n const key = (\n this.productKey +\n \".\" +\n this.deviceKey +\n \".packData.\" +\n x.sn\n ).replace(this.adapter.FORBIDDEN_CHARS, \"\");\n\n await this.adapter?.extendObject(key, {\n type: \"channel\",\n common: {\n name: {\n de: batType,\n en: batType,\n },\n },\n native: {},\n });\n\n await this.adapter?.extendObject(key + \".model\", {\n type: \"state\",\n common: {\n name: {\n de: \"Batterietyp\",\n en: \"Battery type\",\n },\n type: \"string\",\n desc: \"model\",\n role: \"value\",\n read: true,\n write: false,\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".model\", batType, true);\n\n await this.adapter?.extendObject(key + \".sn\", {\n type: \"state\",\n common: {\n name: {\n de: \"Seriennummer\",\n en: \"Serial id\",\n },\n type: \"string\",\n desc: \"Serial ID\",\n role: \"value\",\n read: true,\n write: false,\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".sn\", x.sn, true);\n\n if (x.socLevel) {\n // State f\u00FCr socLevel\n await this.adapter?.extendObject(key + \".socLevel\", {\n type: \"state\",\n common: {\n name: {\n de: \"SOC der Batterie\",\n en: \"soc of battery\",\n },\n type: \"number\",\n desc: \"SOC Level\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"%\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".socLevel\", x.socLevel, true);\n }\n\n if (x.maxTemp) {\n const maxTempCelsius = x.maxTemp / 10 - 273.15;\n const maxTempState = await this.adapter?.getStateAsync(\n key + \".maxTemp\",\n );\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (\n maxTempState &&\n maxTempState.val &&\n maxTempCelsius != maxTempState.val\n ) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n // State f\u00FCr maxTemp\n await this.adapter?.extendObject(key + \".maxTemp\", {\n type: \"state\",\n common: {\n name: {\n de: \"Max. Temperatur der Batterie\",\n en: \"max temp. of battery\",\n },\n type: \"number\",\n desc: \"Max. Temp\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"\u00B0C\",\n },\n native: {},\n });\n\n // Convert Kelvin to Celsius\n await this.adapter?.setState(\n key + \".maxTemp\",\n maxTempCelsius,\n true,\n );\n }\n\n if (x.minVol) {\n const minVol = x.minVol / 100;\n const minVolState = await this.adapter?.getStateAsync(\n key + \".minVol\",\n );\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (minVolState && minVolState.val && minVol != minVolState.val) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".minVol\", {\n type: \"state\",\n common: {\n name: \"minVol\",\n type: \"number\",\n desc: \"minVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".minVol\", minVol, true);\n }\n\n if (x.batcur) {\n await this.adapter?.extendObject(key + \".batcur\", {\n type: \"state\",\n common: {\n name: \"batcur\",\n type: \"number\",\n desc: \"batcur\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"A\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".batcur\", x.batcur / 10, true);\n }\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (x.maxVol) {\n const maxVol = x.maxVol / 100;\n const maxVolState = await this.adapter?.getStateAsync(\n key + \".maxVol\",\n );\n\n if (maxVolState && maxVolState.val && maxVol != maxVolState.val) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".maxVol\", {\n type: \"state\",\n common: {\n name: \"maxVol\",\n type: \"number\",\n desc: \"maxVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".maxVol\", maxVol, true);\n }\n\n // Check if Value exist and changed, if so update lastUpdate!\n if (x.totalVol) {\n const totalVol = x.totalVol / 100;\n\n const totalVolState = await this.adapter?.getStateAsync(\n key + \".totalVol\",\n );\n\n if (\n totalVolState &&\n totalVolState.val &&\n totalVol != totalVolState.val\n ) {\n // Value exist and value changed, update last update!\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.lastUpdate`,\n new Date().getTime(),\n true,\n );\n\n // Check current wifiState, if Disconnected set it to Connected!\n const currentWifiState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.wifiState`,\n );\n\n if (currentWifiState && currentWifiState.val == \"Disconnected\") {\n this.updateSolarFlowState(\"wifiState\", \"Connected\");\n }\n }\n\n await this.adapter?.extendObject(key + \".totalVol\", {\n type: \"state\",\n common: {\n name: \"totalVol\",\n type: \"number\",\n desc: \"totalVol\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"V\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".totalVol\", totalVol, true);\n\n // Send Voltage to checkVoltage Method (only if is Solarflow device)\n if (isSolarFlow) {\n this.checkVoltage(totalVol);\n }\n }\n\n if (x.soh) {\n await this.adapter?.extendObject(key + \".soh\", {\n type: \"state\",\n common: {\n name: {\n de: \"Gesundheitszustand\",\n en: \"State of Health\",\n },\n type: \"number\",\n desc: \"State of Health\",\n role: \"value\",\n read: true,\n write: false,\n unit: \"%\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".soh\", x.soh / 10, true);\n }\n\n if (x.power) {\n await this.adapter?.extendObject(key + \".power\", {\n type: \"state\",\n common: {\n name: {\n de: \"Energie\",\n en: \"Power\",\n },\n type: \"number\",\n desc: \"Power\",\n read: true,\n write: false,\n role: \"value.power\",\n unit: \"W\",\n },\n native: {},\n });\n\n await this.adapter?.setState(key + \".power\", x.power, true);\n }\n\n // Debug, send message if property is unknown!\n let found = false;\n\n Object.entries(x).forEach(([key, value]) => {\n knownPackDataProperties.forEach((property: string) => {\n if (property == key) {\n found = true;\n }\n });\n\n if (found) {\n //console.log(\n // `${productName?.val}: ${key} with value ${value} is a KNOWN Mqtt Prop!`\n //);\n } else {\n this.adapter?.log.debug(\n `[addOrUpdatePackData] ${key} with value ${value} is a UNKNOWN PackData Mqtt Property!`,\n );\n }\n });\n }\n });\n }\n };\n\n public async checkVoltage(voltage: number): Promise<void> {\n if (voltage < 46.1) {\n if (this.adapter.config.useCalculation) {\n this.setSocToZero();\n }\n\n if (this.adapter.config.useLowVoltageBlock) {\n // Activate Low Voltage Block\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n true,\n true,\n );\n\n // Low Voltage Block activated, stop power input immediately\n const autoModel = (\n await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".autoModel\",\n )\n )?.val;\n if (autoModel == 8) {\n this.setDeviceAutomationInOutLimit(0);\n } else {\n this.setOutputLimit(0);\n }\n\n if (this.adapter.config.forceShutdownOnLowVoltage) {\n const currentSoc = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.electricLevel`,\n );\n\n if (currentSoc && Number(currentSoc.val) > 50) {\n // We can't shut down the device. Full charge needed!\n if (this.adapter.config.fullChargeIfNeeded) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.fullChargeNeeded`,\n true,\n true,\n );\n }\n } else {\n if (currentSoc && currentSoc.val) {\n this.setDischargeLimit(Number(currentSoc.val));\n }\n\n // Check if device setting is correct\n const hubState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.hubState`,\n );\n\n if (!hubState || Number(hubState.val) != 1) {\n this.adapter.log.warn(\n `[checkVoltage] hubState is not set to 'Stop output and shut down', device will NOT go offline!`,\n );\n }\n }\n }\n }\n } else if (voltage >= 47.5) {\n // Deactivate Low Voltage Block\n const lowVoltageBlock = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n );\n\n if (lowVoltageBlock && lowVoltageBlock.val == true) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.control.lowVoltageBlock`,\n false,\n true,\n );\n\n if (\n this.adapter.config.useLowVoltageBlock &&\n this.adapter.config.forceShutdownOnLowVoltage\n ) {\n this.setDischargeLimit(\n this.adapter.config.dischargeLimit\n ? this.adapter.config.dischargeLimit\n : 5,\n );\n }\n }\n }\n }\n\n /**\n * Calculates the energy for all items in 'calculationStateKeys'.\n *\n * @returns Promise<void>\n *\n * @beta\n */\n public calculateEnergy(): void {\n calculationStateKeys.forEach(async (stateKey) => {\n let stateNameEnergyWh = \"\";\n let stateNameEnergykWh = \"\";\n let stateNamePower = \"\";\n\n switch (stateKey) {\n case \"pvPower1\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower1`;\n break;\n case \"pvPower2\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower2`;\n break;\n case \"pvPower3\":\n const pvPower3StateDef = this.states.find(\n (x) => x.title == \"pvPower3\",\n );\n if (pvPower3StateDef) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower3`;\n }\n break;\n case \"pvPower4\":\n const pvPower4StateDef = this.states.find(\n (x) => x.title == \"pvPower4\",\n );\n if (pvPower4StateDef) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.pvPower4`;\n }\n break;\n default:\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodaykWh`;\n stateNamePower = `${this.productKey}.${this.deviceKey}.${stateKey}Power`;\n break;\n }\n\n if (stateNamePower != \"\") {\n // If stateNamePower found, proceed with calculation, otherwise skip this stateKey\n this.adapter.log.debug(\n `[calculateEnergy] No stateNamePower found for ${stateKey}!`,\n );\n const currentPowerState =\n await this.adapter?.getStateAsync(stateNamePower);\n\n const currentEnergyState =\n await this.adapter?.getStateAsync(stateNameEnergyWh);\n\n if (!currentEnergyState?.val || currentEnergyState?.val == 0) {\n // Workaround, set Val to very low value to avoid Jump in data...\n await this.adapter?.setState(stateNameEnergyWh, 0.000001, true);\n } else if (\n currentEnergyState &&\n currentEnergyState.lc &&\n currentPowerState &&\n currentPowerState.val != undefined &&\n currentPowerState.val != null\n ) {\n // Timeframe = 30000ms, Job runs every 30 seconds...\n const timeFrame = 30000;\n\n // Calculate Energy value (Wh) from current power in the timeframe from last run...\n const addEnergyValue =\n (Number(currentPowerState.val) * timeFrame) / 3600000; // Wh\n\n /* // Use efficiency factor (used the one from Youtube Channel VoltAmpereLux - thanks!)\n const chargingFactor = 0.96; // Efficiency 96%\n const dischargingFactor = 1.08 - addEnergyValue / 10000; // Efficiency 92% - 98% (92% + Energy / 10000 = 600W -> +6%)\n\n // Calculate energy from efficiency factor if value for charging or discharging\n addEnergyValue =\n stateKey == \"outputPack\" && addEnergyValue > 0\n ? addEnergyValue * chargingFactor\n : addEnergyValue;\n addEnergyValue =\n stateKey == \"packInput\" && addEnergyValue > 0\n ? addEnergyValue * dischargingFactor\n : addEnergyValue; */\n\n let newEnergyValue = Number(currentEnergyState.val) + addEnergyValue;\n\n // Fix negative value\n if (newEnergyValue < 0) {\n newEnergyValue = 0;\n }\n\n await this.adapter?.setState(stateNameEnergyWh, newEnergyValue, true);\n await this.adapter?.setState(\n stateNameEnergykWh,\n Number((newEnergyValue / 1000).toFixed(2)),\n true,\n );\n\n // SOC and energy in batteries\n if (\n (stateKey == \"outputPack\" || stateKey == \"packInput\") &&\n addEnergyValue > 0\n ) {\n await this.calculateSocAndEnergy(stateKey, addEnergyValue);\n } else {\n if (stateKey == \"outputPack\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n } else if (stateKey == \"packInput\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n }\n }\n } else if (currentPowerState && currentEnergyState) {\n await this.adapter?.setState(stateNameEnergyWh, 0, true);\n await this.adapter?.setState(stateNameEnergykWh, 0, true);\n }\n }\n });\n }\n\n public calculateSocAndEnergy = async (\n stateKey: string,\n value: number,\n ): Promise<void> => {\n this.adapter.log.debug(\n `[calculateSocAndEnergy] Calculating for: ${this.productKey}.${this.deviceKey} and stateKey ${stateKey}!`,\n );\n\n let energyWhMax: number | undefined = undefined;\n\n const minSoc = (\n await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.minSoc`,\n )\n )?.val;\n const currentSoc = (\n await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.electricLevel`,\n )\n )?.val;\n\n if (currentSoc && minSoc && Number(currentSoc) < Number(minSoc)) {\n // Don't calculate if current SOC is lower then minimum\n this.adapter.log.debug(\n `[calculateSocAndEnergy] Don't calculate, currentSoc (${Number(currentSoc)}) is lower than minSoc (${Number(minSoc)})!`,\n );\n\n return;\n }\n\n const currentEnergyState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWh\",\n );\n\n const currentEnergyMaxState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWhMax\",\n );\n\n const lowVoltageBlock = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.lowVoltageBlock\",\n );\n\n const currentMaxValue = Number(\n currentEnergyMaxState ? currentEnergyMaxState.val : 0,\n );\n\n let currentEnergyWh = currentEnergyState?.val\n ? Number(currentEnergyState?.val)\n : 0;\n\n if (\n currentEnergyWh == null ||\n currentEnergyWh == undefined ||\n currentEnergyWh <= 0\n ) {\n currentEnergyWh = 0;\n }\n\n if (this.productKey == \"yWF7hV\") {\n // The device is an AIO 2400, so set maximum Wh to 2400!\n energyWhMax = 2400;\n } else {\n // Iterate over all batteries!\n for (let i = 0; i < this.batteries.length; i++) {\n if (this.batteries[i].type == \"AB1000\") {\n energyWhMax = (energyWhMax ? energyWhMax : 0) + 960;\n } else if (this.batteries[i].type == \"AB2000\") {\n energyWhMax = (energyWhMax ? energyWhMax : 0) + 1920;\n }\n }\n }\n\n // newValue is the current available energy in the batteries. If outputPack (charging) add value, if packInput (discharging) subtract value.\n let newEnergyWh =\n stateKey == \"outputPack\"\n ? currentEnergyWh + value\n : currentEnergyWh - value;\n\n // If greater than Max of batteries, set it to this value.\n if (\n stateKey == \"outputPack\" &&\n energyWhMax != undefined &&\n newEnergyWh > energyWhMax\n ) {\n newEnergyWh = energyWhMax;\n\n this.adapter.log.debug(\n `[calculateSocAndEnergy] newEnergyWh (${newEnergyWh}) is greater than energyWhMax (${energyWhMax}), don't extend value!`,\n );\n }\n\n if (newEnergyWh > 0) {\n this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n newEnergyWh,\n true,\n );\n\n this.adapter.log.debug(\n `[calculateSocAndEnergy] set '${this.productKey}.${this.deviceKey}.calculations.energyWh' to ${newEnergyWh}!`,\n );\n\n if (currentEnergyMaxState) {\n const soc = Number(((newEnergyWh / currentMaxValue) * 100).toFixed(1));\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.soc`,\n soc > 100.0 ? 100 : soc,\n true,\n );\n\n if (newEnergyWh > currentMaxValue && !lowVoltageBlock?.val) {\n // Extend maxVal\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n newEnergyWh,\n true,\n );\n }\n\n const currentOutputPackPower = await this.adapter?.getStateAsync(\n `${this.productKey}.${this.deviceKey}.outputPackPower`,\n );\n\n const currentPackInputPower = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".packInputPower\",\n );\n\n if (\n stateKey == \"outputPack\" &&\n currentOutputPackPower?.val != null &&\n currentOutputPackPower != undefined\n ) {\n // Charging, calculate remaining charging time\n const toCharge = currentMaxValue - newEnergyWh;\n\n const remainHoursAsDecimal =\n toCharge / Number(currentOutputPackPower.val);\n\n if (remainHoursAsDecimal < 48.0) {\n const remainFormatted = toHoursAndMinutes(\n Math.round(remainHoursAsDecimal * 60),\n );\n\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n remainFormatted,\n true,\n );\n } else {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n }\n } else if (\n stateKey == \"packInput\" &&\n currentPackInputPower != null &&\n currentPackInputPower != undefined\n ) {\n // Discharging, calculate remaining discharge time\n const remainHoursAsDecimal =\n newEnergyWh / Number(currentPackInputPower.val);\n const remainFormatted = toHoursAndMinutes(\n Math.round(remainHoursAsDecimal * 60),\n );\n\n if (remainHoursAsDecimal < 48.0) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n remainFormatted,\n true,\n );\n } else {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n }\n }\n }\n } else if (newEnergyWh <= 0 && stateKey == \"outputPack\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainInputTime`,\n \"\",\n true,\n );\n } else if (newEnergyWh <= 0 && stateKey == \"packInput\") {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.remainOutTime`,\n \"\",\n true,\n );\n\n // TEST: if SOC == 0, add newValue as positive to energyWhMax\n const newEnergyWhPositive = Math.abs(newEnergyWh);\n\n if (energyWhMax && currentMaxValue + newEnergyWhPositive <= energyWhMax) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n currentMaxValue + newEnergyWhPositive,\n true,\n );\n }\n }\n };\n\n public async setSocToZero(): Promise<void> {\n // Set SOC to 0\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.soc`,\n 0,\n true,\n );\n\n // Calculate new Wh Max Value\n const energyWhState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n );\n const energyWhMaxState = await this.adapter.getStateAsync(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n );\n\n const newMax = Number(energyWhMaxState?.val) - Number(energyWhState?.val);\n\n // Set Max Energy to value minus current energy\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n newMax,\n true,\n );\n\n // Set Energy in Battery to 0\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWh`,\n 0,\n true,\n );\n }\n\n public async setEnergyWhMax(): Promise<void> {\n const currentEnergyState = await this.adapter?.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".calculations.energyWh\",\n );\n\n if (currentEnergyState) {\n await this.adapter?.setState(\n `${this.productKey}.${this.deviceKey}.calculations.energyWhMax`,\n currentEnergyState?.val,\n true,\n );\n }\n }\n\n public resetValuesForDevice(): void {\n calculationStateKeys.forEach(async (stateKey: string) => {\n let stateNameEnergyWh = \"\";\n let stateNameEnergykWh = \"\";\n\n switch (stateKey) {\n case \"pvPower1\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv1EnergyTodaykWh`;\n break;\n case \"pvPower2\":\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv2EnergyTodaykWh`;\n break;\n case \"pvPower3\":\n if (this.states.find((x) => x.title == \"pvPower3\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv3EnergyTodaykWh`;\n }\n break;\n case \"pvPower4\":\n if (this.states.find((x) => x.title == \"pvPower4\")) {\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.solarInputPv4EnergyTodaykWh`;\n }\n break;\n default:\n stateNameEnergyWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodayWh`;\n stateNameEnergykWh = `${this.productKey}.${this.deviceKey}.calculations.${stateKey}EnergyTodaykWh`;\n break;\n }\n\n await this.adapter?.setState(stateNameEnergyWh, 0, true);\n await this.adapter?.setState(stateNameEnergykWh, 0, true);\n });\n }\n}\n"],
|
|
5
|
+
"mapp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S;AACxD,iCAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AAAA,UAC3D;AACA;AAAA,QACF,KAAK;AACH,cAAI,KAAK,OAAO,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU,GAAG;AAClD,gCAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AACxD,iCAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS;AAAA,UAC3D;AACA;AAAA,QACF;AACE,8BAAoB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS,iBAAiB,QAAQ;AACjF,+BAAqB,GAAG,KAAK,UAAU,IAAI,KAAK,SAAS,iBAAiB,QAAQ;AAClF;AAAA,MACJ;AAEA,cAAM,UAAK,YAAL,mBAAc,SAAS,mBAAmB,GAAG;AACnD,cAAM,UAAK,YAAL,mBAAc,SAAS,oBAAoB,GAAG;AAAA,IACtD,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["key", "_a", "_b"]
|
|
7
7
|
}
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "zendure-solarflow",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.3.1": {
|
|
7
|
+
"en": "Fix caluclation issue",
|
|
8
|
+
"de": "Problem der Calucation behoben",
|
|
9
|
+
"ru": "Исправьте проблему калькуляции",
|
|
10
|
+
"pt": "Corrigir a questão da calulação",
|
|
11
|
+
"nl": "Repareer het probleem van de kalibratie",
|
|
12
|
+
"fr": "Correction du problème de caluclation",
|
|
13
|
+
"it": "Risolvere la questione del calcolo",
|
|
14
|
+
"es": "Cuestión de la calusión fija",
|
|
15
|
+
"pl": "Napraw problem kalkulacji",
|
|
16
|
+
"uk": "Фіксований випуск калорій",
|
|
17
|
+
"zh-cn": "修正计算问题"
|
|
18
|
+
},
|
|
6
19
|
"3.3.0": {
|
|
7
20
|
"en": "Fix 'has no existing object' messages on pvPower3 + 4\nFix AC input limit of SF 800 Pro",
|
|
8
21
|
"de": "Fix 'has no existing object'-Nachrichten auf pvPower3 + 4\nFix AC Eingangsgrenze von SF 800 Pro",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "Fix Uppercase 'a4ss5p' in helpers.ts",
|
|
81
94
|
"uk": "Фіксація Верхній регістр 'a4ss5p' в помічниках.ts",
|
|
82
95
|
"zh-cn": "在助手.ts中修正大写“ a4ss5p ”"
|
|
83
|
-
},
|
|
84
|
-
"3.1.0": {
|
|
85
|
-
"en": "Fix setInputLimit (always use positive value!)\nAdd calculation states for PV3 & PV4 (used by SF 800 Pro)\nFix Uppercase 'a4ss5p' in helpers.ts",
|
|
86
|
-
"de": "Fix setInputLimit (verwendet immer positiven Wert!)\nBerechnungszustände für PV3 & PV4 (verwendet durch SF 800 Pro) hinzufügen\nGroßbuchstaben 'a4ss5p' in helpers.ts",
|
|
87
|
-
"ru": "Исправьте набор InputLimit (всегда используйте положительное значение!)\nДобавить расчетные состояния для PV3 и PV4 (используется SF 800 Pro)\nИсправьте Uppercase 'a4ss5p' в helpers.ts",
|
|
88
|
-
"pt": "Corrigir setInputLimit (sempre use valor positivo!)\nAdicionar estados de cálculo para PV3 & PV4 (utilizado pelo SF 800 Pro)\nCorrigir 'a4ss5p' em helpers.ts",
|
|
89
|
-
"nl": "Fix setInputLimit (gebruik altijd positieve waarde!)\nBerekeningstoestanden toevoegen voor PV3 & PV4 (gebruikt door SF 800 Pro)\nFix Uppercase 'a4ss5p' in helpers.ts",
|
|
90
|
-
"fr": "Correction setInputLimit (utilisez toujours une valeur positive!)\nAjouter les états de calcul pour PV3 et PV4 (utilisés par SF 800 Pro)\nCorrection de la case supérieure 'a4ss5p' dans aideurs.ts",
|
|
91
|
-
"it": "Fix setInputLimit (sempre utilizzare il valore positivo!)\nAggiungi stati di calcolo per PV3 & PV4 (usati da SF 800 Pro)\nFissare Uppercase 'a4ss5p' in helpers.ts",
|
|
92
|
-
"es": "Fijar setInputLimit (siempre usa valor positivo!)\nAñadir estados de cálculo para PV3 & PV4 (utilizado por SF 800 Pro)\nFijar maleta superior 'a4s5p' en helpers.ts",
|
|
93
|
-
"pl": "Fix settInputLimit (zawsze używaj wartości dodatniej!)\nDodaj stany obliczeniowe dla PV3 i PV4 (używane przez SF 800 Pro)\nFix Uppercase 'a4ss5p' in helpers.ts",
|
|
94
|
-
"uk": "Виправлення setInputLimit (посередини використовують позитивне значення!)\nДодайте розрахункові стани для PV3 та PV4 (використані SF 800 Pro)\nФіксація Верхній регістр 'a4ss5p' в помічниках.ts",
|
|
95
|
-
"zh-cn": "修复设置 InputLimit( 总是使用正值 !)\n添加PV3 & PV4的计算状态(由SF 800 Pro使用)\n在助手.ts中修正大写“ a4ss5p ”"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|