iobroker.zendure-solarflow 1.13.1 → 1.14.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 +10 -2
- package/admin/build/index.js +76 -55
- package/admin/build/index.js.map +4 -4
- package/build/constants/ac2400ControlStates.js +187 -0
- package/build/constants/ac2400ControlStates.js.map +7 -0
- package/build/constants/ac2400States.js +120 -0
- package/build/constants/ac2400States.js.map +7 -0
- package/build/constants/aceControlStates.js +196 -0
- package/build/constants/aceControlStates.js.map +7 -0
- package/build/constants/aceStates.js +7 -1
- package/build/constants/aceStates.js.map +2 -2
- package/build/constants/aioControlStates.js +173 -0
- package/build/constants/aioControlStates.js.map +7 -0
- package/build/constants/hubControlStates.js +188 -0
- package/build/constants/hubControlStates.js.map +7 -0
- package/build/constants/hyperControlStates.js +186 -0
- package/build/constants/hyperControlStates.js.map +7 -0
- package/build/constants/solarflow800ControlStates.js +187 -0
- package/build/constants/solarflow800ControlStates.js.map +7 -0
- package/build/constants/solarflow800ProControlStates.js +187 -0
- package/build/constants/solarflow800ProControlStates.js.map +7 -0
- package/build/constants/solarflow800ProStates.js +95 -0
- package/build/constants/solarflow800ProStates.js.map +7 -0
- package/build/constants/solarflow800States.js +95 -0
- package/build/constants/solarflow800States.js.map +7 -0
- package/build/helpers/createCalculationStates.js +37 -39
- package/build/helpers/createCalculationStates.js.map +2 -2
- package/build/helpers/createControlStates.js +47 -316
- package/build/helpers/createControlStates.js.map +2 -2
- package/build/helpers/createSolarFlowLocalStates.js +23 -30
- package/build/helpers/createSolarFlowLocalStates.js.map +2 -2
- package/build/helpers/createSolarFlowStates.js +42 -23
- package/build/helpers/createSolarFlowStates.js.map +2 -2
- package/build/main.js +64 -56
- package/build/main.js.map +2 -2
- package/build/models/ISolarflowState.js.map +1 -1
- package/build/services/adapterService.js +1 -1
- package/build/services/adapterService.js.map +2 -2
- package/build/services/fallbackMqttService.js +2 -2
- package/build/services/fallbackMqttService.js.map +2 -2
- package/build/services/mqttService.js +51 -68
- package/build/services/mqttService.js.map +2 -2
- package/io-package.json +41 -41
- package/package.json +9 -9
|
@@ -21,47 +21,45 @@ __export(createCalculationStates_exports, {
|
|
|
21
21
|
createCalculationStates: () => createCalculationStates
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(createCalculationStates_exports);
|
|
24
|
-
const createCalculationStates = async (adapter, productKey, deviceKey
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
en: "Charged by AC (Wh)"
|
|
34
|
-
},
|
|
35
|
-
type: "number",
|
|
36
|
-
desc: "gridInputEnergyTodayWh",
|
|
37
|
-
role: "value.energy",
|
|
38
|
-
read: true,
|
|
39
|
-
write: false,
|
|
40
|
-
unit: "Wh"
|
|
24
|
+
const createCalculationStates = async (adapter, productKey, deviceKey) => {
|
|
25
|
+
await (adapter == null ? void 0 : adapter.extendObject(
|
|
26
|
+
`${productKey}.${deviceKey}.calculations.gridInputEnergyTodayWh`,
|
|
27
|
+
{
|
|
28
|
+
type: "state",
|
|
29
|
+
common: {
|
|
30
|
+
name: {
|
|
31
|
+
de: "Heutige Ladung per AC (Wh)",
|
|
32
|
+
en: "Charged by AC (Wh)"
|
|
41
33
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
type: "number",
|
|
35
|
+
desc: "gridInputEnergyTodayWh",
|
|
36
|
+
role: "value.energy",
|
|
37
|
+
read: true,
|
|
38
|
+
write: false,
|
|
39
|
+
unit: "Wh"
|
|
40
|
+
},
|
|
41
|
+
native: {}
|
|
42
|
+
}
|
|
43
|
+
));
|
|
44
|
+
await (adapter == null ? void 0 : adapter.extendObject(
|
|
45
|
+
`${productKey}.${deviceKey}.calculations.gridInputEnergyTodaykWh`,
|
|
46
|
+
{
|
|
47
|
+
type: "state",
|
|
48
|
+
common: {
|
|
49
|
+
name: {
|
|
50
|
+
de: "Heutige Ladung per AC (kWh)",
|
|
51
|
+
en: "Charged by AC (kWh)"
|
|
60
52
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
type: "number",
|
|
54
|
+
desc: "gridInputEnergyTodaykWh",
|
|
55
|
+
role: "value.energy",
|
|
56
|
+
read: true,
|
|
57
|
+
write: false,
|
|
58
|
+
unit: "kWh"
|
|
59
|
+
},
|
|
60
|
+
native: {}
|
|
61
|
+
}
|
|
62
|
+
));
|
|
65
63
|
await (adapter == null ? void 0 : adapter.extendObject(
|
|
66
64
|
`${productKey}.${deviceKey}.calculations.solarInputEnergyTodayWh`,
|
|
67
65
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/createCalculationStates.ts"],
|
|
4
|
-
"sourcesContent": ["import { ZendureSolarflow } from \"../main\";\r\n\r\n/* eslint-disable @typescript-eslint/indent */\r\nexport const createCalculationStates = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n type: string\r\n): Promise<void> => {\r\n if (\r\n type == \"aio\" ||\r\n type == \"hyper\" ||\r\n type == \"ace\" ||\r\n type == \"solarflow\"\r\n ) {\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.gridInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung per AC (Wh)\",\r\n en: \"Charged by AC (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"gridInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.gridInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung per AC (kWh)\",\r\n en: \"Charged by AC (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"gridInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n }\r\n\r\n /*\r\n Start Solar Input Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag (Wh)\",\r\n en: \"Todays solar input (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag (kWh)\",\r\n en: \"Todays solar input (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv1EnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV1 (Wh)\",\r\n en: \"Todays solar input PV1 (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv1EnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV1 (kWh)\",\r\n en: \"Todays solar input PV1 (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv2EnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV2 (Wh)\",\r\n en: \"Todays solar input PV2 (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv2EnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV2 (kWh)\",\r\n en: \"Todays solar input PV2 (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start output pack Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputPackEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung zu Batterie (Wh)\",\r\n en: \"Todays charge energy to battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputPackEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputPackEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung zur Batterie (kWh)\",\r\n en: \"todays charge energy to battery (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputPackEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start Pack Input Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.packInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung aus Batterie (Wh)\",\r\n en: \"Todays discharge energy from battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"packInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.packInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung aus Batterie (kWh)\",\r\n en: \"Todays discharge energy from battery (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"packInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start outputHome Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputHomeEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung ins Haus (Wh)\",\r\n en: \"Todays input energy to home (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputHomeEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputHomeEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung ins Haus (kWh)\",\r\n en: \"Todays input energy to home (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputHomeEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n /*\r\n End Energy states\r\n */\r\n\r\n // Calculation input time\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.remainInputTime`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Erwartete Ladedauer (hh:mm)\",\r\n en: \"remaining charge time (hh:mm)\",\r\n },\r\n type: \"string\",\r\n desc: \"calcRemainInputTime\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Calculation remainOutTime\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.remainOutTime`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Erwartete Entladedauer (hh:mm)\",\r\n en: \"remaining discharge time (hh:mm)\",\r\n },\r\n type: \"string\",\r\n desc: \"calcRemainOutTime\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Calculation SOC\r\n await adapter?.extendObject(`${productKey}.${deviceKey}.calculations.soc`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Ladezustand in % (der nutzbaren Energie)\",\r\n en: \"State of Charge % (of usable energy)\",\r\n },\r\n type: \"number\",\r\n desc: \"soc\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n unit: \"%\",\r\n },\r\n native: {},\r\n });\r\n\r\n // Energy Wh\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.energyWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Nutzbare Energie in den Batterien (Wh)\",\r\n en: \"Usable energy in battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"energyWh\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Max. Energy for alle batteries Wh\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.energyWhMax`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Max. nutzbare Energie in allen Batterien (Wh)\",\r\n en: \"Max. usable energy in battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"energyWhMax\",\r\n role: \"value\",\r\n read: true,\r\n write: true,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n};\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,0BAA0B,OACrC,SACA,YACA,
|
|
4
|
+
"sourcesContent": ["import { ZendureSolarflow } from \"../main\";\r\n\r\n/* eslint-disable @typescript-eslint/indent */\r\nexport const createCalculationStates = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string\r\n): Promise<void> => {\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.gridInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung per AC (Wh)\",\r\n en: \"Charged by AC (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"gridInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.gridInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung per AC (kWh)\",\r\n en: \"Charged by AC (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"gridInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start Solar Input Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag (Wh)\",\r\n en: \"Todays solar input (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag (kWh)\",\r\n en: \"Todays solar input (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv1EnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV1 (Wh)\",\r\n en: \"Todays solar input PV1 (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv1EnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV1 (kWh)\",\r\n en: \"Todays solar input PV1 (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv2EnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV2 (Wh)\",\r\n en: \"Todays solar input PV2 (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.solarInputPv2EnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutiger Solarertrag PV2 (kWh)\",\r\n en: \"Todays solar input PV2 (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"solarInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start output pack Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputPackEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung zu Batterie (Wh)\",\r\n en: \"Todays charge energy to battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputPackEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputPackEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Ladung zur Batterie (kWh)\",\r\n en: \"todays charge energy to battery (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputPackEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start Pack Input Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.packInputEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung aus Batterie (Wh)\",\r\n en: \"Todays discharge energy from battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"packInputEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.packInputEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung aus Batterie (kWh)\",\r\n en: \"Todays discharge energy from battery (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"packInputEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n /*\r\n Start outputHome Energy states\r\n */\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputHomeEnergyTodayWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung ins Haus (Wh)\",\r\n en: \"Todays input energy to home (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputHomeEnergyTodayWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.outputHomeEnergyTodaykWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Heutige Einspeisung ins Haus (kWh)\",\r\n en: \"Todays input energy to home (kWh)\",\r\n },\r\n type: \"number\",\r\n desc: \"outputHomeEnergyTodaykWh\",\r\n role: \"value.energy\",\r\n read: true,\r\n write: false,\r\n unit: \"kWh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n /*\r\n End Energy states\r\n */\r\n\r\n // Calculation input time\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.remainInputTime`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Erwartete Ladedauer (hh:mm)\",\r\n en: \"remaining charge time (hh:mm)\",\r\n },\r\n type: \"string\",\r\n desc: \"calcRemainInputTime\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Calculation remainOutTime\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.remainOutTime`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Erwartete Entladedauer (hh:mm)\",\r\n en: \"remaining discharge time (hh:mm)\",\r\n },\r\n type: \"string\",\r\n desc: \"calcRemainOutTime\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Calculation SOC\r\n await adapter?.extendObject(`${productKey}.${deviceKey}.calculations.soc`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Ladezustand in % (der nutzbaren Energie)\",\r\n en: \"State of Charge % (of usable energy)\",\r\n },\r\n type: \"number\",\r\n desc: \"soc\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n unit: \"%\",\r\n },\r\n native: {},\r\n });\r\n\r\n // Energy Wh\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.energyWh`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Nutzbare Energie in den Batterien (Wh)\",\r\n en: \"Usable energy in battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"energyWh\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Max. Energy for alle batteries Wh\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.calculations.energyWhMax`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Max. nutzbare Energie in allen Batterien (Wh)\",\r\n en: \"Max. usable energy in battery (Wh)\",\r\n },\r\n type: \"number\",\r\n desc: \"energyWhMax\",\r\n role: \"value\",\r\n read: true,\r\n write: true,\r\n unit: \"Wh\",\r\n },\r\n native: {},\r\n }\r\n );\r\n};\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,0BAA0B,OACrC,SACA,YACA,cACkB;AAClB,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,SAAS;AAAA,IAC1B;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,IACX;AAAA;AAGF,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,SAAS;AAAA,IAC1B;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,IACX;AAAA;AAMF,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,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N,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,IACX;AAAA;AAIF,SAAM,mCAAS;AAAA,IACb,GAAG,UAAU,IAAI,SAAS;AAAA,IAC1B;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,QACN,MAAM;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN;AAAA,QACA,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,IACX;AAAA;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -18,10 +18,40 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var createControlStates_exports = {};
|
|
20
20
|
__export(createControlStates_exports, {
|
|
21
|
-
createControlStates: () => createControlStates
|
|
21
|
+
createControlStates: () => createControlStates,
|
|
22
|
+
getControlStateDefinition: () => getControlStateDefinition
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(createControlStates_exports);
|
|
24
|
-
|
|
25
|
+
var import_ac2400ControlStates = require("../constants/ac2400ControlStates");
|
|
26
|
+
var import_aceControlStates = require("../constants/aceControlStates");
|
|
27
|
+
var import_aioControlStates = require("../constants/aioControlStates");
|
|
28
|
+
var import_hubControlStates = require("../constants/hubControlStates");
|
|
29
|
+
var import_hyperControlStates = require("../constants/hyperControlStates");
|
|
30
|
+
var import_solarflow800ControlStates = require("../constants/solarflow800ControlStates");
|
|
31
|
+
var import_solarflow800ProControlStates = require("../constants/solarflow800ProControlStates");
|
|
32
|
+
const getControlStateDefinition = (productName) => {
|
|
33
|
+
switch (productName.toLocaleLowerCase()) {
|
|
34
|
+
case "hyper 2000":
|
|
35
|
+
return import_hyperControlStates.hyperControlStates;
|
|
36
|
+
case "solarflow 800":
|
|
37
|
+
return import_solarflow800ControlStates.solarflow800ControlStates;
|
|
38
|
+
case "solarflow2.0":
|
|
39
|
+
return import_hubControlStates.hubControlStates;
|
|
40
|
+
case "solarflow hub 2000":
|
|
41
|
+
return import_hubControlStates.hubControlStates;
|
|
42
|
+
case "solarflow aio zy":
|
|
43
|
+
return import_aioControlStates.aioControlStates;
|
|
44
|
+
case "ace 1500":
|
|
45
|
+
return import_aceControlStates.aceControlStates;
|
|
46
|
+
case "solarflow 800 pro":
|
|
47
|
+
return import_solarflow800ProControlStates.solarflow800ProControlStates;
|
|
48
|
+
case "solarflow 2400 ac":
|
|
49
|
+
return import_ac2400ControlStates.ac2400ControlStates;
|
|
50
|
+
default:
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const createControlStates = async (adapter, productKey, deviceKey, productName) => {
|
|
25
55
|
await (adapter == null ? void 0 : adapter.extendObject(`${productKey}.${deviceKey}.control`, {
|
|
26
56
|
type: "channel",
|
|
27
57
|
common: {
|
|
@@ -32,335 +62,36 @@ const createControlStates = async (adapter, productKey, deviceKey, type) => {
|
|
|
32
62
|
},
|
|
33
63
|
native: {}
|
|
34
64
|
}));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`${productKey}.${deviceKey}.control.autoModel`,
|
|
38
|
-
{
|
|
39
|
-
type: "state",
|
|
40
|
-
common: {
|
|
41
|
-
name: {
|
|
42
|
-
de: "Energieplan-Einstellung",
|
|
43
|
-
en: "Energyplan"
|
|
44
|
-
},
|
|
45
|
-
type: "number",
|
|
46
|
-
desc: "autoModel",
|
|
47
|
-
role: "value",
|
|
48
|
-
read: true,
|
|
49
|
-
write: true,
|
|
50
|
-
states: {
|
|
51
|
-
0: "Nothing",
|
|
52
|
-
6: "Battery priority mode",
|
|
53
|
-
7: "Appointment mode",
|
|
54
|
-
8: "Smart Matching Mode",
|
|
55
|
-
9: "Smart CT Mode",
|
|
56
|
-
10: "Electricity Price"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
native: {}
|
|
60
|
-
}
|
|
61
|
-
));
|
|
62
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.autoModel`);
|
|
65
|
+
const controlStateDefinitions = getControlStateDefinition(productName);
|
|
66
|
+
controlStateDefinitions.forEach(async (state) => {
|
|
63
67
|
await (adapter == null ? void 0 : adapter.extendObject(
|
|
64
|
-
`${productKey}.${deviceKey}.control.
|
|
68
|
+
`${productKey}.${deviceKey}.control.${state.title}`,
|
|
65
69
|
{
|
|
66
70
|
type: "state",
|
|
67
71
|
common: {
|
|
68
72
|
name: {
|
|
69
|
-
de:
|
|
70
|
-
en:
|
|
73
|
+
de: state.nameDe,
|
|
74
|
+
en: state.nameEn
|
|
71
75
|
},
|
|
72
|
-
type:
|
|
73
|
-
desc:
|
|
74
|
-
role:
|
|
76
|
+
type: state.type,
|
|
77
|
+
desc: state.title,
|
|
78
|
+
role: state.role,
|
|
75
79
|
read: true,
|
|
76
|
-
write:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
unit: "%"
|
|
80
|
-
},
|
|
81
|
-
native: {}
|
|
82
|
-
}
|
|
83
|
-
));
|
|
84
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.chargeLimit`);
|
|
85
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
86
|
-
`${productKey}.${deviceKey}.control.dischargeLimit`,
|
|
87
|
-
{
|
|
88
|
-
type: "state",
|
|
89
|
-
common: {
|
|
90
|
-
name: {
|
|
91
|
-
de: "Setzen des Entlade-Limits",
|
|
92
|
-
en: "Control of the discharge limit"
|
|
93
|
-
},
|
|
94
|
-
type: "number",
|
|
95
|
-
desc: "dischargeLimit",
|
|
96
|
-
role: "value.battery",
|
|
97
|
-
read: true,
|
|
98
|
-
write: true,
|
|
99
|
-
min: 0,
|
|
100
|
-
max: 50,
|
|
101
|
-
unit: "%"
|
|
80
|
+
write: false,
|
|
81
|
+
unit: state.unit,
|
|
82
|
+
states: state.states
|
|
102
83
|
},
|
|
103
84
|
native: {}
|
|
104
85
|
}
|
|
105
86
|
));
|
|
106
87
|
adapter == null ? void 0 : adapter.subscribeStates(
|
|
107
|
-
`${productKey}.${deviceKey}.control.
|
|
88
|
+
`${productKey}.${deviceKey}.control.${state.title}`
|
|
108
89
|
);
|
|
109
|
-
|
|
110
|
-
`${productKey}.${deviceKey}.control.buzzerSwitch`,
|
|
111
|
-
{
|
|
112
|
-
type: "state",
|
|
113
|
-
common: {
|
|
114
|
-
name: {
|
|
115
|
-
de: "Sounds am HUB aktivieren",
|
|
116
|
-
en: "Enable buzzer on HUB"
|
|
117
|
-
},
|
|
118
|
-
type: "boolean",
|
|
119
|
-
desc: "buzzerSwitch",
|
|
120
|
-
role: "switch",
|
|
121
|
-
read: true,
|
|
122
|
-
write: true
|
|
123
|
-
},
|
|
124
|
-
native: {}
|
|
125
|
-
}
|
|
126
|
-
));
|
|
127
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.buzzerSwitch`);
|
|
128
|
-
if (type == "aio" || type == "solarflow" || type == "hyper" || type == "ace") {
|
|
129
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
130
|
-
`${productKey}.${deviceKey}.control.setOutputLimit`,
|
|
131
|
-
{
|
|
132
|
-
type: "state",
|
|
133
|
-
common: {
|
|
134
|
-
name: {
|
|
135
|
-
de: "Einzustellende Ausgangsleistung",
|
|
136
|
-
en: "Control of the output limit"
|
|
137
|
-
},
|
|
138
|
-
type: "number",
|
|
139
|
-
desc: "setOutputLimit",
|
|
140
|
-
role: "value.power",
|
|
141
|
-
read: true,
|
|
142
|
-
write: true,
|
|
143
|
-
min: 0,
|
|
144
|
-
unit: "W"
|
|
145
|
-
},
|
|
146
|
-
native: {}
|
|
147
|
-
}
|
|
148
|
-
));
|
|
149
|
-
adapter == null ? void 0 : adapter.subscribeStates(
|
|
150
|
-
`${productKey}.${deviceKey}.control.setOutputLimit`
|
|
151
|
-
);
|
|
152
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
153
|
-
`${productKey}.${deviceKey}.control.passMode`,
|
|
154
|
-
{
|
|
155
|
-
type: "state",
|
|
156
|
-
common: {
|
|
157
|
-
name: {
|
|
158
|
-
de: "Einstellung des Bypass Modus",
|
|
159
|
-
en: "Setting of bypass mode"
|
|
160
|
-
},
|
|
161
|
-
type: "number",
|
|
162
|
-
desc: "passMode",
|
|
163
|
-
role: "switch",
|
|
164
|
-
read: true,
|
|
165
|
-
write: true,
|
|
166
|
-
states: {
|
|
167
|
-
0: "Automatic",
|
|
168
|
-
1: "Always off",
|
|
169
|
-
2: "Always on"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
native: {}
|
|
173
|
-
}
|
|
174
|
-
));
|
|
175
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.passMode`);
|
|
176
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
177
|
-
`${productKey}.${deviceKey}.control.autoRecover`,
|
|
178
|
-
{
|
|
179
|
-
type: "state",
|
|
180
|
-
common: {
|
|
181
|
-
name: {
|
|
182
|
-
de: "Am n\xE4chsten Tag Bypass auf Automatik",
|
|
183
|
-
en: "Automatic recovery of bypass"
|
|
184
|
-
},
|
|
185
|
-
type: "boolean",
|
|
186
|
-
desc: "autoRecover",
|
|
187
|
-
role: "switch",
|
|
188
|
-
read: true,
|
|
189
|
-
write: true
|
|
190
|
-
},
|
|
191
|
-
native: {}
|
|
192
|
-
}
|
|
193
|
-
));
|
|
194
|
-
adapter == null ? void 0 : adapter.subscribeStates(
|
|
195
|
-
`${productKey}.${deviceKey}.control.autoRecover`
|
|
196
|
-
);
|
|
197
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
198
|
-
`${productKey}.${deviceKey}.control.hubState`,
|
|
199
|
-
{
|
|
200
|
-
type: "state",
|
|
201
|
-
common: {
|
|
202
|
-
name: {
|
|
203
|
-
de: "Verhalten wenn minimale reservierte Ladung erreicht",
|
|
204
|
-
en: "Behavior when minimum reserved charge is reached"
|
|
205
|
-
},
|
|
206
|
-
type: "number",
|
|
207
|
-
desc: "hubState",
|
|
208
|
-
read: true,
|
|
209
|
-
write: true,
|
|
210
|
-
min: 0,
|
|
211
|
-
max: 1,
|
|
212
|
-
states: {
|
|
213
|
-
0: "Stop output and standby",
|
|
214
|
-
1: "Stop output and shut down"
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
native: {}
|
|
218
|
-
}
|
|
219
|
-
));
|
|
220
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.hubState`);
|
|
221
|
-
if (type == "solarflow" || type == "hyper" || type == "ace") {
|
|
222
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
223
|
-
`${productKey}.${deviceKey}.control.setInputLimit`,
|
|
224
|
-
{
|
|
225
|
-
type: "state",
|
|
226
|
-
common: {
|
|
227
|
-
name: {
|
|
228
|
-
de: "Einzustellende Eingangsleistung",
|
|
229
|
-
en: "Control of the input limit"
|
|
230
|
-
},
|
|
231
|
-
type: "number",
|
|
232
|
-
desc: "setInputLimit",
|
|
233
|
-
role: "value.power",
|
|
234
|
-
read: true,
|
|
235
|
-
write: true,
|
|
236
|
-
min: 0,
|
|
237
|
-
max: type == "ace" || type == "solarflow" ? 900 : 1200,
|
|
238
|
-
step: type == "ace" || type == "solarflow" ? 100 : 1,
|
|
239
|
-
unit: "W"
|
|
240
|
-
},
|
|
241
|
-
native: {}
|
|
242
|
-
}
|
|
243
|
-
));
|
|
244
|
-
adapter == null ? void 0 : adapter.subscribeStates(
|
|
245
|
-
`${productKey}.${deviceKey}.control.setInputLimit`
|
|
246
|
-
);
|
|
247
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
248
|
-
`${productKey}.${deviceKey}.control.acSwitch`,
|
|
249
|
-
{
|
|
250
|
-
type: "state",
|
|
251
|
-
common: {
|
|
252
|
-
name: {
|
|
253
|
-
de: "AC Schalter",
|
|
254
|
-
en: "AC switch"
|
|
255
|
-
},
|
|
256
|
-
type: "boolean",
|
|
257
|
-
desc: "acSwitch",
|
|
258
|
-
role: "switch",
|
|
259
|
-
read: true,
|
|
260
|
-
write: true
|
|
261
|
-
},
|
|
262
|
-
native: {}
|
|
263
|
-
}
|
|
264
|
-
));
|
|
265
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.acSwitch`);
|
|
266
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
267
|
-
`${productKey}.${deviceKey}.control.acMode`,
|
|
268
|
-
{
|
|
269
|
-
type: "state",
|
|
270
|
-
common: {
|
|
271
|
-
name: {
|
|
272
|
-
de: "AC Modus",
|
|
273
|
-
en: "AC mode"
|
|
274
|
-
},
|
|
275
|
-
type: "number",
|
|
276
|
-
desc: "acMode",
|
|
277
|
-
role: "switch",
|
|
278
|
-
min: 0,
|
|
279
|
-
max: 2,
|
|
280
|
-
step: 1,
|
|
281
|
-
read: true,
|
|
282
|
-
write: true,
|
|
283
|
-
states: {
|
|
284
|
-
0: "Nothing",
|
|
285
|
-
1: "AC input mode",
|
|
286
|
-
2: "AC output mode"
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
native: {}
|
|
290
|
-
}
|
|
291
|
-
));
|
|
292
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.acMode`);
|
|
293
|
-
}
|
|
294
|
-
if (adapter.config.useLowVoltageBlock) {
|
|
295
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
296
|
-
`${productKey}.${deviceKey}.control.lowVoltageBlock`,
|
|
297
|
-
{
|
|
298
|
-
type: "state",
|
|
299
|
-
common: {
|
|
300
|
-
name: {
|
|
301
|
-
de: "Niedrige Batteriespannung erkannt",
|
|
302
|
-
en: "Low Voltage on battery detected"
|
|
303
|
-
},
|
|
304
|
-
type: "boolean",
|
|
305
|
-
desc: "lowVoltageBlock",
|
|
306
|
-
role: "indicator.lowbat",
|
|
307
|
-
read: true,
|
|
308
|
-
write: false
|
|
309
|
-
},
|
|
310
|
-
native: {}
|
|
311
|
-
}
|
|
312
|
-
));
|
|
313
|
-
adapter == null ? void 0 : adapter.subscribeStates(
|
|
314
|
-
`${productKey}.${deviceKey}.control.lowVoltageBlock`
|
|
315
|
-
);
|
|
316
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
317
|
-
`${productKey}.${deviceKey}.control.fullChargeNeeded`,
|
|
318
|
-
{
|
|
319
|
-
type: "state",
|
|
320
|
-
common: {
|
|
321
|
-
name: {
|
|
322
|
-
de: "Auf 100% laden, Akku muss kalibriert werden!",
|
|
323
|
-
en: "Charge to 100%, battery needs to be calibrated"
|
|
324
|
-
},
|
|
325
|
-
type: "boolean",
|
|
326
|
-
desc: "fullChargeNeeded",
|
|
327
|
-
role: "indicator.lowbat",
|
|
328
|
-
read: true,
|
|
329
|
-
write: false
|
|
330
|
-
},
|
|
331
|
-
native: {}
|
|
332
|
-
}
|
|
333
|
-
));
|
|
334
|
-
adapter == null ? void 0 : adapter.subscribeStates(
|
|
335
|
-
`${productKey}.${deviceKey}.control.fullChargeNeeded`
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (type == "ace") {
|
|
340
|
-
await (adapter == null ? void 0 : adapter.extendObject(
|
|
341
|
-
`${productKey}.${deviceKey}.control.dcSwitch`,
|
|
342
|
-
{
|
|
343
|
-
type: "state",
|
|
344
|
-
common: {
|
|
345
|
-
name: {
|
|
346
|
-
de: "DC Schalter",
|
|
347
|
-
en: "DC switch"
|
|
348
|
-
},
|
|
349
|
-
type: "boolean",
|
|
350
|
-
desc: "dcSwitch",
|
|
351
|
-
role: "switch",
|
|
352
|
-
read: true,
|
|
353
|
-
write: true
|
|
354
|
-
},
|
|
355
|
-
native: {}
|
|
356
|
-
}
|
|
357
|
-
));
|
|
358
|
-
adapter == null ? void 0 : adapter.subscribeStates(`${productKey}.${deviceKey}.control.dcSwitch`);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
90
|
+
});
|
|
361
91
|
};
|
|
362
92
|
// Annotate the CommonJS export names for ESM import in node:
|
|
363
93
|
0 && (module.exports = {
|
|
364
|
-
createControlStates
|
|
94
|
+
createControlStates,
|
|
95
|
+
getControlStateDefinition
|
|
365
96
|
});
|
|
366
97
|
//# sourceMappingURL=createControlStates.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/helpers/createControlStates.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/indent */\r\n\r\nimport { ZendureSolarflow } from \"../main\";\r\n\r\nexport const createControlStates = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n type: string\r\n): Promise<void> => {\r\n // Create control folder\r\n await adapter?.extendObject(`${productKey}.${deviceKey}.control`, {\r\n type: \"channel\",\r\n common: {\r\n name: {\r\n de: \"Steuerung f\u00FCr Ger\u00E4t \" + deviceKey,\r\n en: \"Control for device \" + deviceKey,\r\n },\r\n },\r\n native: {},\r\n });\r\n\r\n if (type != \"smartPlug\") {\r\n // State zum Setzen des Betriebsmodus\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.autoModel`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Energieplan-Einstellung\",\r\n en: \"Energyplan\",\r\n },\r\n type: \"number\",\r\n desc: \"autoModel\",\r\n role: \"value\",\r\n read: true,\r\n write: true,\r\n states: {\r\n 0: \"Nothing\",\r\n 6: \"Battery priority mode\",\r\n 7: \"Appointment mode\",\r\n 8: \"Smart Matching Mode\",\r\n 9: \"Smart CT Mode\",\r\n 10: \"Electricity Price\",\r\n },\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.autoModel`);\r\n\r\n // State zum Setzen des Charge Limit\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.chargeLimit`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Setzen des Lade-Limits\",\r\n en: \"Control of the charge limit\",\r\n },\r\n type: \"number\",\r\n desc: \"chargeLimit\",\r\n role: \"value.battery\",\r\n read: true,\r\n write: true,\r\n min: 40,\r\n max: 100,\r\n unit: \"%\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.chargeLimit`);\r\n\r\n // State zum Setzen des Discharge Limit\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.dischargeLimit`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Setzen des Entlade-Limits\",\r\n en: \"Control of the discharge limit\",\r\n },\r\n type: \"number\",\r\n desc: \"dischargeLimit\",\r\n role: \"value.battery\",\r\n read: true,\r\n write: true,\r\n min: 0,\r\n max: 50,\r\n unit: \"%\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.dischargeLimit`\r\n );\r\n\r\n // State zum Setzen des Buzzers\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.buzzerSwitch`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Sounds am HUB aktivieren\",\r\n en: \"Enable buzzer on HUB\",\r\n },\r\n type: \"boolean\",\r\n desc: \"buzzerSwitch\",\r\n role: \"switch\",\r\n read: true,\r\n write: true,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.buzzerSwitch`);\r\n\r\n if (\r\n type == \"aio\" ||\r\n type == \"solarflow\" ||\r\n type == \"hyper\" ||\r\n type == \"ace\"\r\n ) {\r\n // State zum Setzen des Output Limit\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.setOutputLimit`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Einzustellende Ausgangsleistung\",\r\n en: \"Control of the output limit\",\r\n },\r\n type: \"number\",\r\n desc: \"setOutputLimit\",\r\n role: \"value.power\",\r\n read: true,\r\n write: true,\r\n min: 0,\r\n unit: \"W\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Subcribe to control states\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.setOutputLimit`\r\n );\r\n\r\n // State zum Setzen des Bypass Modus\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.passMode`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Einstellung des Bypass Modus\",\r\n en: \"Setting of bypass mode\",\r\n },\r\n type: \"number\",\r\n desc: \"passMode\",\r\n role: \"switch\",\r\n read: true,\r\n write: true,\r\n states: {\r\n 0: \"Automatic\",\r\n 1: \"Always off\",\r\n 2: \"Always on\",\r\n },\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.passMode`);\r\n\r\n // State zum Setzen des Auto-Modus vom Bypass\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.autoRecover`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Am n\u00E4chsten Tag Bypass auf Automatik\",\r\n en: \"Automatic recovery of bypass\",\r\n },\r\n type: \"boolean\",\r\n desc: \"autoRecover\",\r\n role: \"switch\",\r\n read: true,\r\n write: true,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.autoRecover`\r\n );\r\n\r\n // State zum Setzen des Input Limit (AC)\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.hubState`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Verhalten wenn minimale reservierte Ladung erreicht\",\r\n en: \"Behavior when minimum reserved charge is reached\",\r\n },\r\n type: \"number\",\r\n desc: \"hubState\",\r\n read: true,\r\n write: true,\r\n min: 0,\r\n max: 1,\r\n states: {\r\n 0: \"Stop output and standby\",\r\n 1: \"Stop output and shut down\",\r\n },\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.hubState`);\r\n\r\n if (type == \"solarflow\" || type == \"hyper\" || type == \"ace\") {\r\n // State zum Setzen des Input Limit (AC)\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.setInputLimit`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Einzustellende Eingangsleistung\",\r\n en: \"Control of the input limit\",\r\n },\r\n type: \"number\",\r\n desc: \"setInputLimit\",\r\n role: \"value.power\",\r\n read: true,\r\n write: true,\r\n min: 0,\r\n max: type == \"ace\" || type == \"solarflow\" ? 900 : 1200,\r\n step: type == \"ace\" || type == \"solarflow\" ? 100 : 1,\r\n unit: \"W\",\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.setInputLimit`\r\n );\r\n\r\n // State zum Setzen des AC Schalters\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.acSwitch`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"AC Schalter\",\r\n en: \"AC switch\",\r\n },\r\n type: \"boolean\",\r\n desc: \"acSwitch\",\r\n role: \"switch\",\r\n read: true,\r\n write: true,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.acSwitch`);\r\n\r\n // State zum Setzen des AC Modus\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.acMode`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"AC Modus\",\r\n en: \"AC mode\",\r\n },\r\n type: \"number\",\r\n desc: \"acMode\",\r\n role: \"switch\",\r\n min: 0,\r\n max: 2,\r\n step: 1,\r\n read: true,\r\n write: true,\r\n states: {\r\n 0: \"Nothing\",\r\n 1: \"AC input mode\",\r\n 2: \"AC output mode\",\r\n },\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.acMode`);\r\n }\r\n\r\n // States for controlling the low voltage block\r\n if (adapter.config.useLowVoltageBlock) {\r\n // State zum Setzen des Output Limit\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Niedrige Batteriespannung erkannt\",\r\n en: \"Low Voltage on battery detected\",\r\n },\r\n type: \"boolean\",\r\n desc: \"lowVoltageBlock\",\r\n role: \"indicator.lowbat\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.lowVoltageBlock`\r\n );\r\n\r\n // State zum Setzen des Output Limit\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.fullChargeNeeded`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Auf 100% laden, Akku muss kalibriert werden!\",\r\n en: \"Charge to 100%, battery needs to be calibrated\",\r\n },\r\n type: \"boolean\",\r\n desc: \"fullChargeNeeded\",\r\n role: \"indicator.lowbat\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.fullChargeNeeded`\r\n );\r\n }\r\n }\r\n\r\n // States only for ACE 1500\r\n if (type == \"ace\") {\r\n // State zum Setzen des DC Schalters\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.dcSwitch`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"DC Schalter\",\r\n en: \"DC switch\",\r\n },\r\n type: \"boolean\",\r\n desc: \"dcSwitch\",\r\n role: \"switch\",\r\n read: true,\r\n write: true,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n adapter?.subscribeStates(`${productKey}.${deviceKey}.control.dcSwitch`);\r\n }\r\n }\r\n};\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/indent */\r\n\r\nimport { ac2400ControlStates } from \"../constants/ac2400ControlStates\";\r\nimport { aceControlStates } from \"../constants/aceControlStates\";\r\nimport { aioControlStates } from \"../constants/aioControlStates\";\r\nimport { hubControlStates } from \"../constants/hubControlStates\";\r\nimport { hyperControlStates } from \"../constants/hyperControlStates\";\r\nimport { solarflow800ControlStates } from \"../constants/solarflow800ControlStates\";\r\nimport { solarflow800ProControlStates } from \"../constants/solarflow800ProControlStates\";\r\nimport { ZendureSolarflow } from \"../main\";\r\nimport { ISolarflowState } from \"../models/ISolarflowState\";\r\n\r\nexport const getControlStateDefinition = (\r\n productName: string\r\n): ISolarflowState[] => {\r\n switch (productName.toLocaleLowerCase()) {\r\n case \"hyper 2000\":\r\n return hyperControlStates;\r\n case \"solarflow 800\":\r\n return solarflow800ControlStates;\r\n case \"solarflow2.0\":\r\n return hubControlStates;\r\n case \"solarflow hub 2000\":\r\n return hubControlStates;\r\n case \"solarflow aio zy\":\r\n return aioControlStates;\r\n case \"ace 1500\":\r\n return aceControlStates;\r\n case \"solarflow 800 pro\":\r\n return solarflow800ProControlStates;\r\n case \"solarflow 2400 ac\":\r\n return ac2400ControlStates;\r\n default:\r\n return [];\r\n }\r\n};\r\n\r\nexport const createControlStates = async (\r\n adapter: ZendureSolarflow,\r\n productKey: string,\r\n deviceKey: string,\r\n productName: string\r\n): Promise<void> => {\r\n // Create control folder\r\n await adapter?.extendObject(`${productKey}.${deviceKey}.control`, {\r\n type: \"channel\",\r\n common: {\r\n name: {\r\n de: \"Steuerung f\u00FCr Ger\u00E4t \" + deviceKey,\r\n en: \"Control for device \" + deviceKey,\r\n },\r\n },\r\n native: {},\r\n });\r\n\r\n const controlStateDefinitions = getControlStateDefinition(productName);\r\n\r\n controlStateDefinitions.forEach(async (state: ISolarflowState) => {\r\n await adapter?.extendObject(\r\n `${productKey}.${deviceKey}.control.${state.title}`,\r\n {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: state.nameDe,\r\n en: state.nameEn,\r\n },\r\n type: state.type,\r\n desc: state.title,\r\n role: state.role,\r\n read: true,\r\n write: false,\r\n unit: state.unit,\r\n states: state.states,\r\n },\r\n native: {},\r\n }\r\n );\r\n\r\n // Subscribe to state\r\n adapter?.subscribeStates(\r\n `${productKey}.${deviceKey}.control.${state.title}`\r\n );\r\n });\r\n};\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iCAAoC;AACpC,8BAAiC;AACjC,8BAAiC;AACjC,8BAAiC;AACjC,gCAAmC;AACnC,uCAA0C;AAC1C,0CAA6C;AAItC,MAAM,4BAA4B,CACvC,gBACsB;AACtB,UAAQ,YAAY,kBAAkB,GAAG;AAAA,IACvC,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,CAAC;AAAA,EACZ;AACF;AAEO,MAAM,sBAAsB,OACjC,SACA,YACA,WACA,gBACkB;AAElB,SAAM,mCAAS,aAAa,GAAG,UAAU,IAAI,SAAS,YAAY;AAAA,IAChE,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,IAAI,+BAAyB;AAAA,QAC7B,IAAI,wBAAwB;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,EACX;AAEA,QAAM,0BAA0B,0BAA0B,WAAW;AAErE,0BA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