iobroker.zendure-solarflow 3.2.2 → 3.3.0
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/LICENSE +1 -1
- package/README.md +6 -1
- package/build/main.js +0 -1
- package/build/main.js.map +2 -2
- package/build/models/deviceModels/Ace1500.js +57 -0
- package/build/models/deviceModels/Ace1500.js.map +2 -2
- package/build/models/deviceModels/Aio2400.js +2 -2
- package/build/models/deviceModels/Aio2400.js.map +2 -2
- package/build/models/deviceModels/Hyper2000.js +2 -2
- package/build/models/deviceModels/Hyper2000.js.map +2 -2
- package/build/models/deviceModels/Sf2400Ac.js +2 -2
- package/build/models/deviceModels/Sf2400Ac.js.map +2 -2
- package/build/models/deviceModels/Sf800.js +2 -2
- package/build/models/deviceModels/Sf800.js.map +2 -2
- package/build/models/deviceModels/Sf800Pro.js +3 -3
- package/build/models/deviceModels/Sf800Pro.js.map +2 -2
- package/build/models/deviceModels/SfHub1200.js +2 -2
- package/build/models/deviceModels/SfHub1200.js.map +2 -2
- package/build/models/deviceModels/SfHub2000.js +2 -2
- package/build/models/deviceModels/SfHub2000.js.map +2 -2
- package/build/models/deviceModels/ZenHaDevice.js +20 -11
- package/build/models/deviceModels/ZenHaDevice.js.map +2 -2
- package/io-package.json +27 -27
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Peter Frommert <peter.frommert@outlook.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -59,6 +59,11 @@ 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.0 (2026-01-30)
|
|
63
|
+
|
|
64
|
+
- Fix 'has no existing object' messages on pvPower3 + 4
|
|
65
|
+
- Fix AC input limit of SF 800 Pro
|
|
66
|
+
|
|
62
67
|
### 3.2.2 (2025-12-21)
|
|
63
68
|
|
|
64
69
|
- Fix reset of calculation states if PV3+4 (SF 800 Pro)
|
|
@@ -170,7 +175,7 @@ This adapter will now use the Cloud Authorization Code for authentication on the
|
|
|
170
175
|
|
|
171
176
|
MIT License
|
|
172
177
|
|
|
173
|
-
Copyright (c)
|
|
178
|
+
Copyright (c) 2026 Peter Frommert
|
|
174
179
|
|
|
175
180
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
176
181
|
of this software and associated documentation files (the "Software"), to deal
|
package/build/main.js
CHANGED
|
@@ -46,7 +46,6 @@ class ZendureSolarflow extends utils.Adapter {
|
|
|
46
46
|
this.zenHaDeviceList = [];
|
|
47
47
|
// All found devices for this instance will be in this array
|
|
48
48
|
this.mqttSettings = void 0;
|
|
49
|
-
this.msgCounter = 7e5;
|
|
50
49
|
this.lastLogin = void 0;
|
|
51
50
|
this.mqttClient = void 0;
|
|
52
51
|
this.resetValuesJob = void 0;
|
package/build/main.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/indent */\r\n/*\r\n * Created with @iobroker/create-adapter v2.5.0\r\n */\r\n\r\n// The adapter-core module gives you access to the core ioBroker functions\r\n// you need to create an adapter\r\nimport * as utils from \"@iobroker/adapter-core\";\r\n\r\nimport { zenLogin } from \"./services/zenWebService\";\r\nimport { Job } from \"node-schedule\";\r\nimport { MqttClient } from \"mqtt\";\r\nimport { startRefreshAccessTokenTimerJob } from \"./services/jobSchedule\";\r\nimport { connectLocalMqttClient } from \"./services/mqttLocalService\";\r\nimport { IZenHaDeviceDetails } from \"./models/IZenHaDeviceDetails\";\r\nimport { connectCloudZenMqttClient } from \"./services/mqttCloudZenService\";\r\nimport { IZenHaMqttData } from \"./models/IZenHaMqttData\";\r\nimport { ZenHaDevice } from \"./models/deviceModels/ZenHaDevice\";\r\nimport { createDeviceModel } from \"./helpers/helpers\";\r\n\r\nexport class ZendureSolarflow extends utils.Adapter {\r\n public constructor(options: Partial<utils.AdapterOptions> = {}) {\r\n super({\r\n ...options,\r\n name: \"zendure-solarflow\",\r\n });\r\n this.on(\"ready\", this.onReady.bind(this));\r\n this.on(\"stateChange\", this.onStateChange.bind(this));\r\n this.on(\"unload\", this.onUnload.bind(this));\r\n }\r\n\r\n public zenHaDeviceList: ZenHaDevice[] = []; // All found devices for this instance will be in this array\r\n public mqttSettings: IZenHaMqttData | undefined = undefined;\r\n\r\n public msgCounter: number = 700000;\r\n public lastLogin: Date | undefined = undefined;\r\n\r\n public mqttClient: MqttClient | undefined = undefined;\r\n\r\n public resetValuesJob: Job | undefined = undefined;\r\n public checkStatesJob: Job | undefined = undefined;\r\n public calculationJob: Job | undefined = undefined;\r\n public refreshAccessTokenInterval: ioBroker.Interval | undefined = undefined;\r\n public retryTimeout: ioBroker.Timeout | undefined = undefined;\r\n\r\n /**\r\n * Is called when databases are connected and adapter received configuration.\r\n */\r\n private async onReady(): Promise<void> {\r\n await this.extendObject(\"info\", {\r\n type: \"channel\",\r\n common: {\r\n name: \"Information\",\r\n },\r\n native: {},\r\n });\r\n\r\n await this.extendObject(`info.connection`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Mit Zendure Cloud verbunden\",\r\n en: \"Connected to Zendure cloud\",\r\n },\r\n type: \"boolean\",\r\n desc: \"connection\",\r\n role: \"indicator.connected\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n });\r\n\r\n await this.extendObject(`info.errorMessage`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Fehlermeldung der Verbindung zur Zendure Cloud\",\r\n en: \"Error message from Zendure Cloud\",\r\n },\r\n type: \"string\",\r\n desc: \"errorMessage\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n });\r\n\r\n this.setState(\"info.errorMessage\", \"\", true);\r\n this.setState(\"info.connection\", false, true);\r\n\r\n switch (this.config.connectionMode) {\r\n case \"authKey\":\r\n this.log.debug(\"[onReady] Using Authorization Cloud Key\");\r\n\r\n if (!this.config.authorizationCloudKey) {\r\n this.log.error(\r\n \"[zenWebService.login] authorization cloud key is missing!\"\r\n );\r\n break;\r\n }\r\n\r\n const data = await zenLogin(this);\r\n\r\n if (typeof data === \"string\" || data == undefined) {\r\n // Fehler\r\n this.setState(\"info.connection\", false, true);\r\n } else {\r\n this.mqttSettings = data.mqtt;\r\n\r\n if (!connectCloudZenMqttClient(this)) {\r\n return;\r\n }\r\n\r\n this.log.debug(\r\n `[onReady] Creating ${data.deviceList.length} devices...`\r\n );\r\n\r\n await data.deviceList.forEach(async (device: IZenHaDeviceDetails) => {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n device.productKey,\r\n device.deviceKey,\r\n device\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n } else {\r\n this.log.error(\r\n `[onReady] Error creating device with productKey '${device.productKey}' / deviceKey '${device.deviceKey} / productModel ${device.productModel}'`\r\n );\r\n }\r\n });\r\n }\r\n break;\r\n case \"local\": {\r\n this.log.debug(\"[onReady] Using local MQTT server\");\r\n\r\n connectLocalMqttClient(this);\r\n\r\n // Subscribe to 1. device from local settings\r\n if (\r\n this.config.localDevice1ProductKey &&\r\n this.config.localDevice1DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice1ProductKey,\r\n this.config.localDevice1DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 2. device from local settings\r\n if (\r\n this.config.localDevice2ProductKey &&\r\n this.config.localDevice2DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice2ProductKey,\r\n this.config.localDevice2DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 3. device from local settings\r\n if (\r\n this.config.localDevice3ProductKey &&\r\n this.config.localDevice3DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice3ProductKey,\r\n this.config.localDevice3DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 4. device from local settings\r\n if (\r\n this.config.localDevice4ProductKey &&\r\n this.config.localDevice4DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice4ProductKey,\r\n this.config.localDevice4DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n if (this.config.useRestart) {\r\n // Add interval to restart adapter every 3 hours\r\n startRefreshAccessTokenTimerJob(this);\r\n }\r\n break;\r\n }\r\n default:\r\n this.setState(\"info.connection\", false, true);\r\n this.log.error(\"[onReady] No connection mode found or mode invalid!\");\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Is called when adapter shuts down - callback has to be called under any circumstances!\r\n */\r\n private async onUnload(callback: () => void): Promise<void> {\r\n try {\r\n if (this.refreshAccessTokenInterval) {\r\n this.clearInterval(this.refreshAccessTokenInterval);\r\n }\r\n\r\n try {\r\n await this.mqttClient?.endAsync();\r\n this.log.info(\"[onUnload] MQTT client stopped!\");\r\n this.mqttClient = undefined;\r\n } catch (ex: any) {\r\n this.log.error(\"[onUnload] Error stopping MQTT client: !\" + ex.message);\r\n }\r\n\r\n this.setState(\"info.connection\", false, true);\r\n\r\n // Scheduler beenden\r\n if (this.resetValuesJob) {\r\n this.resetValuesJob.cancel();\r\n this.resetValuesJob = undefined;\r\n }\r\n\r\n if (this.checkStatesJob) {\r\n this.checkStatesJob?.cancel();\r\n this.checkStatesJob = undefined;\r\n }\r\n\r\n if (this.calculationJob) {\r\n this.calculationJob.cancel();\r\n this.calculationJob = undefined;\r\n }\r\n\r\n if (this.retryTimeout) {\r\n this.clearTimeout(this.retryTimeout);\r\n }\r\n\r\n callback();\r\n } catch (e) {\r\n callback();\r\n }\r\n }\r\n\r\n /**\r\n * Is called if a subscribed state changes\r\n */\r\n private onStateChange(\r\n id: string,\r\n state: ioBroker.State | null | undefined\r\n ): void {\r\n if (state) {\r\n // The state was changed\r\n\r\n // Read product and device key from string\r\n const splitted = id.split(\".\");\r\n const productKey = splitted[2]; // Product Key\r\n const deviceKey = splitted[3]; // Device Key\r\n const stateName1 = splitted[4]; // Folder/State Name 1 (e.g. 'control')\r\n const stateName2 = splitted[5]; // State Name, like 'setOutputLimit'\r\n\r\n const _device = this.zenHaDeviceList.find(\r\n (x) => x.productKey == productKey && x.deviceKey == deviceKey\r\n );\r\n\r\n if (!_device) {\r\n this.log.error(\r\n `[onStateChange] Device '${deviceKey}' not found in zenHaDeviceList!`\r\n );\r\n return;\r\n }\r\n\r\n // !!! Only stateChanges with ack==false are allowed to be processed.\r\n if (state.val != undefined && state.val != null && !state.ack) {\r\n switch (stateName1) {\r\n case \"control\":\r\n this.log.debug(\r\n `[onStateChange] Control state '${stateName2}' changed, new value is ${state.val}, ack = ${state.ack}!`\r\n );\r\n switch (stateName2) {\r\n case \"setOutputLimit\":\r\n _device.setOutputLimit(Number(state.val));\r\n break;\r\n case \"setInputLimit\":\r\n _device.setInputLimit(Number(state.val));\r\n break;\r\n case \"chargeLimit\":\r\n _device.setChargeLimit(Number(state.val));\r\n break;\r\n case \"dischargeLimit\":\r\n _device.setDischargeLimit(Number(state.val));\r\n break;\r\n case \"passMode\":\r\n _device.setPassMode(Number(state.val));\r\n break;\r\n case \"dcSwitch\":\r\n _device.setDcSwitch(state.val ? true : false);\r\n break;\r\n case \"acSwitch\":\r\n _device.setAcSwitch(state.val ? true : false);\r\n break;\r\n case \"acMode\":\r\n _device.setAcMode(Number(state.val));\r\n break;\r\n case \"hubState\":\r\n _device.setHubState(Number(state.val));\r\n break;\r\n case \"autoModel\":\r\n _device.setAutoModel(Number(state.val));\r\n break;\r\n case \"autoRecover\":\r\n _device.setAutoRecover(state.val ? true : false);\r\n break;\r\n case \"buzzerSwitch\":\r\n _device.setBuzzerSwitch(state.val ? true : false);\r\n break;\r\n case \"smartMode\":\r\n _device.setSmartMode(state.val ? true : false);\r\n break;\r\n case \"setDeviceAutomationInOutLimit\":\r\n _device.setDeviceAutomationInOutLimit(Number(state.val));\r\n break;\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n } else {\r\n // The state was deleted\r\n //this.log.debug(`state ${id} deleted`);\r\n }\r\n }\r\n }\r\n}\r\n\r\nif (require.main !== module) {\r\n // Export the constructor in compact mode\r\n module.exports = (options: Partial<utils.AdapterOptions> | undefined) =>\r\n new ZendureSolarflow(options);\r\n} else {\r\n // otherwise start the instance directly\r\n (() => new ZendureSolarflow())();\r\n}\r\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,YAAuB;AAEvB,2BAAyB;AAGzB,yBAAgD;AAChD,8BAAuC;AAEvC,iCAA0C;AAG1C,qBAAkC;AAE3B,MAAM,yBAAyB,MAAM,QAAQ;AAAA,EAC3C,YAAY,UAAyC,CAAC,GAAG;AAC9D,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,MAAM;AAAA,IACR,CAAC;AAMH,SAAO,kBAAiC,CAAC;AACzC;AAAA,SAAO,eAA2C;AAElD,SAAO,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/indent */\r\n/*\r\n * Created with @iobroker/create-adapter v2.5.0\r\n */\r\n\r\n// The adapter-core module gives you access to the core ioBroker functions\r\n// you need to create an adapter\r\nimport * as utils from \"@iobroker/adapter-core\";\r\n\r\nimport { zenLogin } from \"./services/zenWebService\";\r\nimport { Job } from \"node-schedule\";\r\nimport { MqttClient } from \"mqtt\";\r\nimport { startRefreshAccessTokenTimerJob } from \"./services/jobSchedule\";\r\nimport { connectLocalMqttClient } from \"./services/mqttLocalService\";\r\nimport { IZenHaDeviceDetails } from \"./models/IZenHaDeviceDetails\";\r\nimport { connectCloudZenMqttClient } from \"./services/mqttCloudZenService\";\r\nimport { IZenHaMqttData } from \"./models/IZenHaMqttData\";\r\nimport { ZenHaDevice } from \"./models/deviceModels/ZenHaDevice\";\r\nimport { createDeviceModel } from \"./helpers/helpers\";\r\n\r\nexport class ZendureSolarflow extends utils.Adapter {\r\n public constructor(options: Partial<utils.AdapterOptions> = {}) {\r\n super({\r\n ...options,\r\n name: \"zendure-solarflow\",\r\n });\r\n this.on(\"ready\", this.onReady.bind(this));\r\n this.on(\"stateChange\", this.onStateChange.bind(this));\r\n this.on(\"unload\", this.onUnload.bind(this));\r\n }\r\n\r\n public zenHaDeviceList: ZenHaDevice[] = []; // All found devices for this instance will be in this array\r\n public mqttSettings: IZenHaMqttData | undefined = undefined;\r\n\r\n public lastLogin: Date | undefined = undefined;\r\n\r\n public mqttClient: MqttClient | undefined = undefined;\r\n\r\n public resetValuesJob: Job | undefined = undefined;\r\n public checkStatesJob: Job | undefined = undefined;\r\n public calculationJob: Job | undefined = undefined;\r\n public refreshAccessTokenInterval: ioBroker.Interval | undefined = undefined;\r\n public retryTimeout: ioBroker.Timeout | undefined = undefined;\r\n\r\n /**\r\n * Is called when databases are connected and adapter received configuration.\r\n */\r\n private async onReady(): Promise<void> {\r\n await this.extendObject(\"info\", {\r\n type: \"channel\",\r\n common: {\r\n name: \"Information\",\r\n },\r\n native: {},\r\n });\r\n\r\n await this.extendObject(`info.connection`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Mit Zendure Cloud verbunden\",\r\n en: \"Connected to Zendure cloud\",\r\n },\r\n type: \"boolean\",\r\n desc: \"connection\",\r\n role: \"indicator.connected\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n });\r\n\r\n await this.extendObject(`info.errorMessage`, {\r\n type: \"state\",\r\n common: {\r\n name: {\r\n de: \"Fehlermeldung der Verbindung zur Zendure Cloud\",\r\n en: \"Error message from Zendure Cloud\",\r\n },\r\n type: \"string\",\r\n desc: \"errorMessage\",\r\n role: \"value\",\r\n read: true,\r\n write: false,\r\n },\r\n native: {},\r\n });\r\n\r\n this.setState(\"info.errorMessage\", \"\", true);\r\n this.setState(\"info.connection\", false, true);\r\n\r\n switch (this.config.connectionMode) {\r\n case \"authKey\":\r\n this.log.debug(\"[onReady] Using Authorization Cloud Key\");\r\n\r\n if (!this.config.authorizationCloudKey) {\r\n this.log.error(\r\n \"[zenWebService.login] authorization cloud key is missing!\"\r\n );\r\n break;\r\n }\r\n\r\n const data = await zenLogin(this);\r\n\r\n if (typeof data === \"string\" || data == undefined) {\r\n // Fehler\r\n this.setState(\"info.connection\", false, true);\r\n } else {\r\n this.mqttSettings = data.mqtt;\r\n\r\n if (!connectCloudZenMqttClient(this)) {\r\n return;\r\n }\r\n\r\n this.log.debug(\r\n `[onReady] Creating ${data.deviceList.length} devices...`\r\n );\r\n\r\n await data.deviceList.forEach(async (device: IZenHaDeviceDetails) => {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n device.productKey,\r\n device.deviceKey,\r\n device\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n } else {\r\n this.log.error(\r\n `[onReady] Error creating device with productKey '${device.productKey}' / deviceKey '${device.deviceKey} / productModel ${device.productModel}'`\r\n );\r\n }\r\n });\r\n }\r\n break;\r\n case \"local\": {\r\n this.log.debug(\"[onReady] Using local MQTT server\");\r\n\r\n connectLocalMqttClient(this);\r\n\r\n // Subscribe to 1. device from local settings\r\n if (\r\n this.config.localDevice1ProductKey &&\r\n this.config.localDevice1DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice1ProductKey,\r\n this.config.localDevice1DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 2. device from local settings\r\n if (\r\n this.config.localDevice2ProductKey &&\r\n this.config.localDevice2DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice2ProductKey,\r\n this.config.localDevice2DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 3. device from local settings\r\n if (\r\n this.config.localDevice3ProductKey &&\r\n this.config.localDevice3DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice3ProductKey,\r\n this.config.localDevice3DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n // Subscribe to 4. device from local settings\r\n if (\r\n this.config.localDevice4ProductKey &&\r\n this.config.localDevice4DeviceKey\r\n ) {\r\n // States erstellen\r\n const deviceModel = createDeviceModel(\r\n this,\r\n this.config.localDevice4ProductKey,\r\n this.config.localDevice4DeviceKey\r\n );\r\n\r\n if (deviceModel) {\r\n this.zenHaDeviceList.push(deviceModel);\r\n }\r\n }\r\n\r\n if (this.config.useRestart) {\r\n // Add interval to restart adapter every 3 hours\r\n startRefreshAccessTokenTimerJob(this);\r\n }\r\n break;\r\n }\r\n default:\r\n this.setState(\"info.connection\", false, true);\r\n this.log.error(\"[onReady] No connection mode found or mode invalid!\");\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Is called when adapter shuts down - callback has to be called under any circumstances!\r\n */\r\n private async onUnload(callback: () => void): Promise<void> {\r\n try {\r\n if (this.refreshAccessTokenInterval) {\r\n this.clearInterval(this.refreshAccessTokenInterval);\r\n }\r\n\r\n try {\r\n await this.mqttClient?.endAsync();\r\n this.log.info(\"[onUnload] MQTT client stopped!\");\r\n this.mqttClient = undefined;\r\n } catch (ex: any) {\r\n this.log.error(\"[onUnload] Error stopping MQTT client: !\" + ex.message);\r\n }\r\n\r\n this.setState(\"info.connection\", false, true);\r\n\r\n // Scheduler beenden\r\n if (this.resetValuesJob) {\r\n this.resetValuesJob.cancel();\r\n this.resetValuesJob = undefined;\r\n }\r\n\r\n if (this.checkStatesJob) {\r\n this.checkStatesJob?.cancel();\r\n this.checkStatesJob = undefined;\r\n }\r\n\r\n if (this.calculationJob) {\r\n this.calculationJob.cancel();\r\n this.calculationJob = undefined;\r\n }\r\n\r\n if (this.retryTimeout) {\r\n this.clearTimeout(this.retryTimeout);\r\n }\r\n\r\n callback();\r\n } catch (e) {\r\n callback();\r\n }\r\n }\r\n\r\n /**\r\n * Is called if a subscribed state changes\r\n */\r\n private onStateChange(\r\n id: string,\r\n state: ioBroker.State | null | undefined\r\n ): void {\r\n if (state) {\r\n // The state was changed\r\n\r\n // Read product and device key from string\r\n const splitted = id.split(\".\");\r\n const productKey = splitted[2]; // Product Key\r\n const deviceKey = splitted[3]; // Device Key\r\n const stateName1 = splitted[4]; // Folder/State Name 1 (e.g. 'control')\r\n const stateName2 = splitted[5]; // State Name, like 'setOutputLimit'\r\n\r\n const _device = this.zenHaDeviceList.find(\r\n (x) => x.productKey == productKey && x.deviceKey == deviceKey\r\n );\r\n\r\n if (!_device) {\r\n this.log.error(\r\n `[onStateChange] Device '${deviceKey}' not found in zenHaDeviceList!`\r\n );\r\n return;\r\n }\r\n\r\n // !!! Only stateChanges with ack==false are allowed to be processed.\r\n if (state.val != undefined && state.val != null && !state.ack) {\r\n switch (stateName1) {\r\n case \"control\":\r\n this.log.debug(\r\n `[onStateChange] Control state '${stateName2}' changed, new value is ${state.val}, ack = ${state.ack}!`\r\n );\r\n switch (stateName2) {\r\n case \"setOutputLimit\":\r\n _device.setOutputLimit(Number(state.val));\r\n break;\r\n case \"setInputLimit\":\r\n _device.setInputLimit(Number(state.val));\r\n break;\r\n case \"chargeLimit\":\r\n _device.setChargeLimit(Number(state.val));\r\n break;\r\n case \"dischargeLimit\":\r\n _device.setDischargeLimit(Number(state.val));\r\n break;\r\n case \"passMode\":\r\n _device.setPassMode(Number(state.val));\r\n break;\r\n case \"dcSwitch\":\r\n _device.setDcSwitch(state.val ? true : false);\r\n break;\r\n case \"acSwitch\":\r\n _device.setAcSwitch(state.val ? true : false);\r\n break;\r\n case \"acMode\":\r\n _device.setAcMode(Number(state.val));\r\n break;\r\n case \"hubState\":\r\n _device.setHubState(Number(state.val));\r\n break;\r\n case \"autoModel\":\r\n _device.setAutoModel(Number(state.val));\r\n break;\r\n case \"autoRecover\":\r\n _device.setAutoRecover(state.val ? true : false);\r\n break;\r\n case \"buzzerSwitch\":\r\n _device.setBuzzerSwitch(state.val ? true : false);\r\n break;\r\n case \"smartMode\":\r\n _device.setSmartMode(state.val ? true : false);\r\n break;\r\n case \"setDeviceAutomationInOutLimit\":\r\n _device.setDeviceAutomationInOutLimit(Number(state.val));\r\n break;\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n } else {\r\n // The state was deleted\r\n //this.log.debug(`state ${id} deleted`);\r\n }\r\n }\r\n }\r\n}\r\n\r\nif (require.main !== module) {\r\n // Export the constructor in compact mode\r\n module.exports = (options: Partial<utils.AdapterOptions> | undefined) =>\r\n new ZendureSolarflow(options);\r\n} else {\r\n // otherwise start the instance directly\r\n (() => new ZendureSolarflow())();\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,YAAuB;AAEvB,2BAAyB;AAGzB,yBAAgD;AAChD,8BAAuC;AAEvC,iCAA0C;AAG1C,qBAAkC;AAE3B,MAAM,yBA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,GAAG,CAAC;AACrC;AAAA,cACF,KAAK;AACH,wBAAQ,YAAY,MAAM,MAAM,OAAO,KAAK;AAC5C;AAAA,cACF,KAAK;AACH,wBAAQ,YAAY,MAAM,MAAM,OAAO,KAAK;AAC5C;AAAA,cACF,KAAK;AACH,wBAAQ,UAAU,OAAO,MAAM,GAAG,CAAC;AACnC;AAAA,cACF,KAAK;AACH,wBAAQ,YAAY,OAAO,MAAM,GAAG,CAAC;AACrC;AAAA,cACF,KAAK;AACH,wBAAQ,aAAa,OAAO,MAAM,GAAG,CAAC;AACtC;AAAA,cACF,KAAK;AACH,wBAAQ,eAAe,MAAM,MAAM,OAAO,KAAK;AAC/C;AAAA,cACF,KAAK;AACH,wBAAQ,gBAAgB,MAAM,MAAM,OAAO,KAAK;AAChD;AAAA,cACF,KAAK;AACH,wBAAQ,aAAa,MAAM,MAAM,OAAO,KAAK;AAC7C;AAAA,cACF,KAAK;AACH,wBAAQ,8BAA8B,OAAO,MAAM,GAAG,CAAC;AACvD;AAAA,YACJ;AACA;AAAA,UACF;AACE;AAAA,QACJ;AAAA,MACF,OAAO;AAAA,MAGP;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAI,QAAQ,SAAS,QAAQ;AAE3B,SAAO,UAAU,CAAC,YAChB,IAAI,iBAAiB,OAAO;AAChC,OAAO;AAEL,GAAC,MAAM,IAAI,iBAAiB,GAAG;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -69,6 +69,63 @@ class Ace1500 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
async setDeviceAutomationInOutLimit(limit) {
|
|
73
|
+
var _a;
|
|
74
|
+
if (this.adapter.mqttClient && this.productKey && this.deviceKey) {
|
|
75
|
+
this.adapter.log.debug(
|
|
76
|
+
`[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`
|
|
77
|
+
);
|
|
78
|
+
if (limit) {
|
|
79
|
+
limit = Math.round(limit);
|
|
80
|
+
} else {
|
|
81
|
+
limit = 0;
|
|
82
|
+
}
|
|
83
|
+
if (limit > 0) {
|
|
84
|
+
this.adapter.log.error(
|
|
85
|
+
`[setDeviceAutomationInOutLimit] ACE 1500 can not feed in!`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (limit < 0 && limit < -this.maxInputLimit) {
|
|
89
|
+
this.adapter.log.debug(
|
|
90
|
+
`[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`
|
|
91
|
+
);
|
|
92
|
+
limit = -this.maxInputLimit;
|
|
93
|
+
}
|
|
94
|
+
this.messageId += 1;
|
|
95
|
+
const timestamp = /* @__PURE__ */ new Date();
|
|
96
|
+
timestamp.setMilliseconds(0);
|
|
97
|
+
let _arguments = [];
|
|
98
|
+
if (limit < 0) {
|
|
99
|
+
this.adapter.log.debug(
|
|
100
|
+
`[setDeviceAutomationInOutLimit] Using CHARGE variant of ACE 1500 device automation, as device '${this.productKey}' detected and limit (${limit}) is negative!`
|
|
101
|
+
);
|
|
102
|
+
_arguments = [
|
|
103
|
+
{
|
|
104
|
+
autoModelProgram: 2,
|
|
105
|
+
autoModelValue: {
|
|
106
|
+
chargingType: 1,
|
|
107
|
+
chargingPower: Math.abs(limit),
|
|
108
|
+
freq: 0,
|
|
109
|
+
outPower: 0
|
|
110
|
+
},
|
|
111
|
+
msgType: 1,
|
|
112
|
+
autoModel: 8
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
const deviceAutomation = {
|
|
117
|
+
arguments: _arguments,
|
|
118
|
+
function: "deviceAutomation",
|
|
119
|
+
messageId: this.messageId,
|
|
120
|
+
deviceKey: this.deviceKey,
|
|
121
|
+
timestamp: timestamp.getTime() / 1e3
|
|
122
|
+
};
|
|
123
|
+
(_a = this.adapter.mqttClient) == null ? void 0 : _a.publish(
|
|
124
|
+
this.functionTopic,
|
|
125
|
+
JSON.stringify(deviceAutomation)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
72
129
|
}
|
|
73
130
|
// Annotate the CommonJS export names for ESM import in node:
|
|
74
131
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Ace1500.ts"],
|
|
4
|
-
"sourcesContent": ["import { aceControlStates } from \"../../constants/aceControlStates\";\nimport { aceStates } from \"../../constants/aceStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Ace1500 extends ZenHaDevice {\n maxInputLimit = 900;\n maxOutputLimit = 900;\n\n states = aceStates;\n controlStates = aceControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public setDcSwitch(dcSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setDcSwitchContent = {\n properties: { dcSwitch: dcSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setDcSwitch] Set DC Switch for device ${this.deviceKey} to ${dcSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setDcSwitchContent)\n );\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,uBAA0B;
|
|
4
|
+
"sourcesContent": ["import { aceControlStates } from \"../../constants/aceControlStates\";\nimport { aceStates } from \"../../constants/aceStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IDeviceAutomationPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Ace1500 extends ZenHaDevice {\n maxInputLimit = 900;\n maxOutputLimit = 900;\n\n states = aceStates;\n controlStates = aceControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public setDcSwitch(dcSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setDcSwitchContent = {\n properties: { dcSwitch: dcSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setDcSwitch] Set DC Switch for device ${this.deviceKey} to ${dcSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setDcSwitchContent)\n );\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\n }\n\n if (limit > 0) {\n this.adapter.log.error(\n `[setDeviceAutomationInOutLimit] ACE 1500 can not feed in!`\n );\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n }\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n let _arguments: IDeviceAutomationPayload[] = [];\n\n if (limit < 0) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using CHARGE variant of ACE 1500 device automation, as device '${this.productKey}' detected and limit (${limit}) is negative!`\n );\n _arguments = [\n {\n autoModelProgram: 2,\n autoModelValue: {\n chargingType: 1,\n chargingPower: Math.abs(limit),\n freq: 0,\n outPower: 0,\n },\n msgType: 1,\n autoModel: 8,\n },\n ];\n }\n\n const deviceAutomation = {\n arguments: _arguments,\n function: \"deviceAutomation\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(deviceAutomation)\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,uBAA0B;AAI1B,yBAA4B;AAErB,MAAM,gBAAgB,+BAAY;AAAA,EAOhC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAi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gB,CAAC,KAAK,aAAa;AAAA,QAC7I;AACA,gBAAQ,CAAC,KAAK;AAAA,MAChB;AAEA,WAAK,aAAa;AAElB,YAAM,YAAY,oBAAI,KAAK;AAC3B,gBAAU,gBAAgB,CAAC;AAE3B,UAAI,aAAyC,CAAC;AAE9C,UAAI,QAAQ,GAAG;AACb,aAAK,QAAQ,IAAI;AAAA,UACf,kGAAkG,KAAK,UAAU,yBAAyB,KAAK;AAAA,QACjJ;AACA,qBAAa;AAAA,UACX;AAAA,YACE,kBAAkB;AAAA,YAClB,gBAAgB;AAAA,cACd,cAAc;AAAA,cACd,eAAe,KAAK,IAAI,KAAK;AAAA,cAC7B,MAAM;AAAA,cACN,UAAU;AAAA,YACZ;AAAA,YACA,SAAS;AAAA,YACT,WAAW;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAEA,YAAM,mBAAmB;AAAA,QACvB,WAAW;AAAA,QACX,UAAU;AAAA,QACV,WAAW,KAAK;AAAA,QAChB,WAAW,KAAK;AAAA,QAChB,WAAW,UAAU,QAAQ,IAAI;AAAA,MACnC;AACA,iBAAK,QAAQ,eAAb,mBAAyB;AAAA,QACvB,KAAK;AAAA,QACL,KAAK,UAAU,gBAAgB;AAAA;AAAA,IAEnC;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -85,7 +85,7 @@ class Aio2400 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
85
85
|
limit = 30;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
this.
|
|
88
|
+
this.messageId += 1;
|
|
89
89
|
const timestamp = /* @__PURE__ */ new Date();
|
|
90
90
|
timestamp.setMilliseconds(0);
|
|
91
91
|
let _arguments = [];
|
|
@@ -103,7 +103,7 @@ class Aio2400 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
103
103
|
const deviceAutomation = {
|
|
104
104
|
arguments: _arguments,
|
|
105
105
|
function: "deviceAutomation",
|
|
106
|
-
messageId: this.
|
|
106
|
+
messageId: this.messageId,
|
|
107
107
|
deviceKey: this.deviceKey,
|
|
108
108
|
timestamp: timestamp.getTime() / 1e3
|
|
109
109
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Aio2400.ts"],
|
|
4
|
-
"sourcesContent": ["import { aioControlStates } from \"../../constants/aioControlStates\";\nimport { aioStates } from \"../../constants/aioStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IDeviceAutomationPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Aio2400 extends ZenHaDevice {\n maxInputLimit = 0;\n maxOutputLimit = 1200;\n\n states = aioStates;\n controlStates = aioControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n if (limit < 0) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] AIO 2400 can not charge by AC!`\n );\n return;\n } else {\n if (limit > this.maxOutputLimit) {\n limit = this.maxOutputLimit;\n }\n }\n\n if (\n limit < 100 &&\n limit != 90 &&\n limit != 60 &&\n limit != 30 &&\n limit != 0\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 this.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,uBAA0B;AAI1B,yBAA4B;AAErB,MAAM,gBAAgB,+BAAY;AAAA,EAOhC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,8BACX,OACe;AAlCnB;AAmCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,WAAK,QAAQ,IAAI;AAAA,QACf,kEAAkE,KAAK;AAAA,MACzE;AAEA,UAAI,OAAO;AACT,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B,OAAO;AACL,gBAAQ;AAAA,MACV;AAEA,UAAI,KAAK,QAAQ,OAAO,oBAAoB;AAC1C,cAAM,uBAAuB,MAAM,KAAK,QAAQ;AAAA,UAC9C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AACA,YACE,wBACA,qBAAqB,OACrB,qBAAqB,OAAO,QAC5B,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAEA,cAAM,mBAAmB,MAAM,KAAK,QAAQ;AAAA,UAC1C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YACE,oBACA,iBAAiB,OACjB,iBAAiB,OAAO,QACxB,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAAA,MACF;AAEA,UAAI,QAAQ,GAAG;AACb,aAAK,QAAQ,IAAI;AAAA,UACf;AAAA,QACF;AACA;AAAA,MACF,OAAO;AACL,YAAI,QAAQ,KAAK,gBAAgB;AAC/B,kBAAQ,KAAK;AAAA,QACf;AAAA,MACF;AAEA,UACE,QAAQ,OACR,SAAS,MACT,SAAS,MACT,SAAS,MACT,SAAS,GACT;AAEA,YAAI,QAAQ,OAAO,QAAQ,IAAI;AAC7B,kBAAQ;AAAA,QACV,WAAW,QAAQ,MAAM,QAAQ,IAAI;AACnC,kBAAQ;AAAA,QACV,WAAW,QAAQ,MAAM,QAAQ,IAAI;AACnC,kBAAQ;AAAA,QACV,WAAW,QAAQ,IAAI;AACrB,kBAAQ;AAAA,QACV;AAAA,MACF;AAEA,WAAK,
|
|
4
|
+
"sourcesContent": ["import { aioControlStates } from \"../../constants/aioControlStates\";\nimport { aioStates } from \"../../constants/aioStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IDeviceAutomationPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Aio2400 extends ZenHaDevice {\n maxInputLimit = 0;\n maxOutputLimit = 1200;\n\n states = aioStates;\n controlStates = aioControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n if (limit < 0) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] AIO 2400 can not charge by AC!`\n );\n return;\n } else {\n if (limit > this.maxOutputLimit) {\n limit = this.maxOutputLimit;\n }\n }\n\n if (\n limit < 100 &&\n limit != 90 &&\n limit != 60 &&\n limit != 30 &&\n limit != 0\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 this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n let _arguments: IDeviceAutomationPayload[] = [];\n\n // Output\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using FEED IN variant of AIO device automation, as device '${this.productKey}' detected and limit is positive!`\n );\n _arguments = [\n {\n autoModelProgram: 2,\n autoModelValue: limit,\n msgType: 1,\n autoModel: 8,\n },\n ];\n\n const deviceAutomation = {\n arguments: _arguments,\n function: \"deviceAutomation\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(deviceAutomation)\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAiC;AACjC,uBAA0B;AAI1B,yBAA4B;AAErB,MAAM,gBAAgB,+BAAY;AAAA,EAOhC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,8BACX,OACe;AAlCnB;AAmCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,WAAK,QAAQ,IAAI;AAAA,QACf,kEAAkE,KAAK;AAAA,MACzE;AAEA,UAAI,OAAO;AACT,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B,OAAO;AACL,gBAAQ;AAAA,MACV;AAEA,UAAI,KAAK,QAAQ,OAAO,oBAAoB;AAC1C,cAAM,uBAAuB,MAAM,KAAK,QAAQ;AAAA,UAC9C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AACA,YACE,wBACA,qBAAqB,OACrB,qBAAqB,OAAO,QAC5B,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAEA,cAAM,mBAAmB,MAAM,KAAK,QAAQ;AAAA,UAC1C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YACE,oBACA,iBAAiB,OACjB,iBAAiB,OAAO,QACx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109
109
|
}
|
|
110
|
-
this.
|
|
110
|
+
this.messageId += 1;
|
|
111
111
|
const timestamp = /* @__PURE__ */ new Date();
|
|
112
112
|
timestamp.setMilliseconds(0);
|
|
113
113
|
let _arguments = [];
|
|
@@ -176,7 +176,7 @@ class Hyper2000 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
176
176
|
const deviceAutomation = {
|
|
177
177
|
arguments: _arguments,
|
|
178
178
|
function: "deviceAutomation",
|
|
179
|
-
messageId: this.
|
|
179
|
+
messageId: this.messageId,
|
|
180
180
|
deviceKey: this.deviceKey,
|
|
181
181
|
timestamp: timestamp.getTime() / 1e3
|
|
182
182
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Hyper2000.ts"],
|
|
4
|
-
"sourcesContent": ["import { hyperControlStates } from \"../../constants/hyperControlStates\";\nimport { hyperStates } from \"../../constants/hyperStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IDeviceAutomationPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Hyper2000 extends ZenHaDevice {\n maxInputLimit = 1200;\n maxOutputLimit = 1200;\n\n states = hyperStates;\n controlStates = hyperControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcMode)\n );\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}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AI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,WAAK,QAAQ,IAAI;AAAA,QACf,kEAAkE,KAAK;AAAA,MACzE;AAEA,UAAI,OAAO;AACT,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B,OAAO;AACL,gBAAQ;AAAA,MACV;AAEA,UAAI,KAAK,QAAQ,OAAO,oBAAoB;AAC1C,cAAM,uBAAuB,MAAM,KAAK,QAAQ;AAAA,UAC9C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AACA,YACE,wBACA,qBAAqB,OACrB,qBAAqB,OAAO,QAC5B,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAEA,cAAM,mBAAmB,MAAM,KAAK,QAAQ;AAAA,UAC1C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YACE,oBACA,iBAAiB,OACjB,iBAAiB,OAAO,QACxB,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAAA,MACF;AAGA,UAAI,QAAQ,KAAK,QAAQ,CAAC,KAAK,eAAe;AAC5C,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,wCAAwC,KAAK,aAAa,gBAAgB,CAAC,KAAK,aAAa;AAAA,QAC7I;AACA,gBAAQ,CAAC,KAAK;AAAA,MAChB,WAAW,QAAQ,KAAK,gBAAgB;AACtC,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,0CAA0C,KAAK,cAAc,gBAAgB,KAAK,cAAc;AAAA,QAChJ;AACA,gBAAQ,KAAK;AAAA,MACf;AAEA,WAAK,
|
|
4
|
+
"sourcesContent": ["import { hyperControlStates } from \"../../constants/hyperControlStates\";\nimport { hyperStates } from \"../../constants/hyperStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IDeviceAutomationPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Hyper2000 extends ZenHaDevice {\n maxInputLimit = 1200;\n maxOutputLimit = 1200;\n\n states = hyperStates;\n controlStates = hyperControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcMode)\n );\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`\n );\n limit = this.maxOutputLimit;\n }\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n let _arguments: IDeviceAutomationPayload[] = [];\n\n if (limit < 0) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using CHARGE variant of HYPER device automation, as device '${this.deviceKey}' detected and limit (${limit}) is negative!`\n );\n // Input / Charge\n _arguments = [\n {\n autoModelProgram: 1,\n autoModelValue: {\n chargingType: 1,\n price: 2,\n chargingPower: Math.abs(limit),\n prices: [\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n 1, 1, 1,\n ],\n outPower: 0,\n freq: 0,\n },\n msgType: 1,\n autoModel: 8,\n },\n ];\n } else {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using FEED IN variant of HYPER device automation, as device '${this.productName}' detected and limit (${limit}) is positive!`\n );\n // Output\n _arguments = [\n {\n autoModelProgram: 2,\n autoModelValue: {\n chargingType: 0,\n chargingPower: 0,\n freq: 0,\n outPower: limit,\n },\n msgType: 1,\n autoModel: 8,\n },\n ];\n }\n\n const deviceAutomation = {\n arguments: _arguments,\n function: \"deviceAutomation\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(deviceAutomation)\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmC;AACnC,yBAA4B;AAI5B,yBAA4B;AAErB,MAAM,kBAAkB,+BAAY;AAAA,EAOlC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,UAAU,QAA+B;AAhCxD;AAiCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,UAAI,UAAU,KAAK,UAAU,GAAG;AAC9B,cAAM,YAAY,EAAE,YAAY,EAAE,OAAe,EAAE;AACnD,aAAK,QAAQ,IAAI,MAAM,8BAA8B,MAAM,GAAG;AAC9D,mBAAK,QAAQ,eAAb,mBAAyB;AAAA,UACvB,KAAK;AAAA,UACL,KAAK,UAAU,SAAS;AAAA;AAAA,MAE5B,OAAO;AACL,aAAK,QAAQ,IAAI;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEO,YAAY,UAAyB;AAjD9C;AAkDI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,YAAM,qBAAqB;AAAA,QACzB,YAAY,EAAE,UAAU,WAAW,IAAI,EAAE;AAAA,MAC3C;AACA,WAAK,QAAQ,IAAI;AAAA,QACf,0CAA0C,KAAK,SAAS,OAAO,QAAQ;AAAA,MACzE;AACA,iBAAK,QAAQ,eAAb,mBAAyB;AAAA,QACvB,KA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AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -115,7 +115,7 @@ class Sf2400Ac extends import_ZenHaDevice.ZenHaDevice {
|
|
|
115
115
|
);
|
|
116
116
|
limit = this.maxOutputLimit;
|
|
117
117
|
}
|
|
118
|
-
this.
|
|
118
|
+
this.messageId += 1;
|
|
119
119
|
const timestamp = /* @__PURE__ */ new Date();
|
|
120
120
|
timestamp.setMilliseconds(0);
|
|
121
121
|
this.adapter.log.debug(
|
|
@@ -130,7 +130,7 @@ class Sf2400Ac extends import_ZenHaDevice.ZenHaDevice {
|
|
|
130
130
|
const hemsEP = {
|
|
131
131
|
arguments: _arguments,
|
|
132
132
|
function: "hemsEP",
|
|
133
|
-
messageId: this.
|
|
133
|
+
messageId: this.messageId,
|
|
134
134
|
deviceKey: this.deviceKey,
|
|
135
135
|
timestamp: timestamp.getTime() / 1e3
|
|
136
136
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Sf2400Ac.ts"],
|
|
4
|
-
"sourcesContent": ["import { ac2400ControlStates } from \"../../constants/ac2400ControlStates\";\nimport { ac2400States } from \"../../constants/ac2400States\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf2400Ac extends ZenHaDevice {\n maxInputLimit = 2400;\n maxOutputLimit = 2400;\n\n states = ac2400States;\n controlStates = ac2400ControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcMode)\n );\n\n // Check if device is HUB, then check if smartMode is false - if so send a warning to log!\n const smartMode = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.smartMode\"\n );\n\n if (smartMode && !smartMode.val) {\n this.adapter.log.warn(\n `[setAcMode] AC mode was switched and smartMode is false - changes will be written to flash memory. In the worst case, the device may break or changes may no longer be saved!`\n );\n }\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`\n );\n limit = this.maxOutputLimit;\n }\n\n this.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAoC;AACpC,0BAA6B;AAI7B,yBAA4B;AAErB,MAAM,iBAAiB,+BAAY;AAAA,EAOjC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,UAAU,QAA+B;AAhCxD;AAiCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,UAAI,UAAU,KAAK,UAAU,GAAG;AAC9B,cAAM,YAAY,EAAE,YAAY,EAAE,OAAe,EAAE;AACnD,aAAK,QAAQ,IAAI,MAAM,8BAA8B,MAAM,GAAG;AAC9D,mBAAK,QAAQ,eAAb,mBAAyB;AAAA,UACvB,KAAK;AAAA,UACL,KAAK,UAAU,SAAS;AAAA;AAI1B,cAAM,YAAY,MAAM,KAAK,QAAQ;AAAA,UACnC,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YAAI,aAAa,CAAC,UAAU,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KAAK,eAAe;AAC5C,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,wCAAwC,KAAK,aAAa,gBAAgB,CAAC,KAAK,aAAa;AAAA,QAC7I;AACA,gBAAQ,CAAC,KAAK;AAAA,MAChB,WAAW,QAAQ,KAAK,gBAAgB;AACtC,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,0CAA0C,KAAK,cAAc,gBAAgB,KAAK,cAAc;AAAA,QAChJ;AACA,gBAAQ,KAAK;AAAA,MACf;AAEA,WAAK,
|
|
4
|
+
"sourcesContent": ["import { ac2400ControlStates } from \"../../constants/ac2400ControlStates\";\nimport { ac2400States } from \"../../constants/ac2400States\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf2400Ac extends ZenHaDevice {\n maxInputLimit = 2400;\n maxOutputLimit = 2400;\n\n states = ac2400States;\n controlStates = ac2400ControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcMode)\n );\n\n // Check if device is HUB, then check if smartMode is false - if so send a warning to log!\n const smartMode = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.smartMode\"\n );\n\n if (smartMode && !smartMode.val) {\n this.adapter.log.warn(\n `[setAcMode] AC mode was switched and smartMode is false - changes will be written to flash memory. In the worst case, the device may break or changes may no longer be saved!`\n );\n }\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`\n );\n limit = this.maxOutputLimit;\n }\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n // Device Automation for Solarflow 2400 AC and Solarflow 800\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using HEMS Variant of device automation, as deviceKey '${this.deviceKey}' detected!`\n );\n\n // HEMS Variante\n const _arguments: IHemsEpPayload = {\n outputPower: limit > 0 ? limit : 0,\n chargeState: limit > 0 ? 0 : 1,\n chargePower: limit > 0 ? 0 : limit,\n mode: 9,\n };\n\n const hemsEP = {\n arguments: _arguments,\n function: \"hemsEP\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(hemsEP)\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAoC;AACpC,0BAA6B;AAI7B,yBAA4B;AAErB,MAAM,iBAAiB,+BAAY;AAAA,EAOjC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,UAAU,QAA+B;AAhCxD;AAiCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,UAAI,UAAU,KAAK,UAAU,GAAG;AAC9B,cAAM,YAAY,EAAE,YAAY,EAAE,OAAe,EAAE;AACnD,aAAK,QAAQ,IAAI,MAAM,8BAA8B,MAAM,GAAG;AAC9D,mBAAK,QAAQ,eAAb,mBAAyB;AAAA,UACvB,KAAK;AAAA,UACL,KAAK,UAAU,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
|
117
117
|
const timestamp = /* @__PURE__ */ new Date();
|
|
118
118
|
timestamp.setMilliseconds(0);
|
|
119
119
|
this.adapter.log.debug(
|
|
@@ -128,7 +128,7 @@ class Sf800 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
128
128
|
const hemsEP = {
|
|
129
129
|
arguments: _arguments,
|
|
130
130
|
function: "hemsEP",
|
|
131
|
-
messageId: this.
|
|
131
|
+
messageId: this.messageId,
|
|
132
132
|
deviceKey: this.deviceKey,
|
|
133
133
|
timestamp: timestamp.getTime() / 1e3
|
|
134
134
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Sf800.ts"],
|
|
4
|
-
"sourcesContent": ["import { solarflow800ControlStates } from \"../../constants/solarflow800ControlStates\";\nimport { solarflow800States } from \"../../constants/solarflow800States\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf800 extends ZenHaDevice {\n maxInputLimit = 800;\n maxOutputLimit = 800;\n\n states = solarflow800States;\n controlStates = solarflow800ControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(topic, JSON.stringify(setAcMode));\n\n // Check if device is HUB, then check if smartMode is false - if so send a warning to log!\n const smartMode = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.smartMode\"\n );\n\n if (smartMode && !smartMode.val) {\n this.adapter.log.warn(\n `[setAcMode] AC mode was switched and smartMode is false - changes will be written to flash memory. In the worst case, the device may break or changes may no longer be saved!`\n );\n }\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`\n );\n limit = this.maxOutputLimit;\n }\n\n this.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAA0C;AAC1C,gCAAmC;AAInC,yBAA4B;AAErB,MAAM,cAAc,+BAAY;AAAA,EAO9B,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,UAAU,QAA+B;AAhCxD;AAiCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,UAAI,UAAU,KAAK,UAAU,GAAG;AAC9B,cAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,KAAK,SAAS;AAEtD,cAAM,YAAY,EAAE,YAAY,EAAE,OAAe,EAAE;AACnD,aAAK,QAAQ,IAAI,MAAM,8BAA8B,MAAM,GAAG;AAC9D,mBAAK,QAAQ,eAAb,mBAAyB,QAAQ,OAAO,KAAK,UAAU,SAAS;AAGhE,cAAM,YAAY,MAAM,KAAK,QAAQ;AAAA,UACnC,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YAAI,aAAa,CAAC,UAAU,KAAK;AAC/B,eAAK,QAAQ,IAAI;AAAA,YACf;AAAA,UACF;AAAA,QACF;AAAA,MACF,OAAO;AACL,aAAK,QAAQ,IAAI;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;A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AAA,MAChB,WAAW,QAAQ,KAAK,gBAAgB;AACtC,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,0CAA0C,KAAK,cAAc,gBAAgB,KAAK,cAAc;AAAA,QAChJ;AACA,gBAAQ,KAAK;AAAA,MACf;AAEA,WAAK,
|
|
4
|
+
"sourcesContent": ["import { solarflow800ControlStates } from \"../../constants/solarflow800ControlStates\";\nimport { solarflow800States } from \"../../constants/solarflow800States\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf800 extends ZenHaDevice {\n maxInputLimit = 800;\n maxOutputLimit = 800;\n\n states = solarflow800States;\n controlStates = solarflow800ControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(topic, JSON.stringify(setAcMode));\n\n // Check if device is HUB, then check if smartMode is false - if so send a warning to log!\n const smartMode = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.smartMode\"\n );\n\n if (smartMode && !smartMode.val) {\n this.adapter.log.warn(\n `[setAcMode] AC mode was switched and smartMode is false - changes will be written to flash memory. In the worst case, the device may break or changes may no longer be saved!`\n );\n }\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent)\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`\n );\n limit = this.maxOutputLimit;\n }\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n // Device Automation for Solarflow 2400 AC and Solarflow 800\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using HEMS Variant of device automation, as deviceKey '${this.deviceKey}' detected!`\n );\n\n // HEMS Variante\n const _arguments: IHemsEpPayload = {\n outputPower: limit > 0 ? limit : 0,\n chargeState: limit > 0 ? 0 : 1,\n chargePower: limit > 0 ? 0 : limit,\n mode: 9,\n };\n\n const hemsEP = {\n arguments: _arguments,\n function: \"hemsEP\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(hemsEP)\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAA0C;AAC1C,gCAAmC;AAInC,yBAA4B;AAErB,MAAM,cAAc,+BAAY;AAAA,EAO9B,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AArBF,yBAAgB;AAChB,0BAAiB;AAEjB,kBAAS;AACT,yBAAgB;AAAA,EAkBhB;AAAA,EAEA,MAAa,UAAU,QAA+B;AAhCxD;AAiCI,QAAI,KAAK,QAAQ,cAAc,KAAK,cAAc,KAAK,WAAW;AAChE,UAAI,UAAU,KAAK,UAAU,GAAG;AAC9B,cAAM,QAAQ,OAAO,KAAK,UAAU,IAAI,KAAK,SAAS;AAEtD,cAAM,YAAY,EAAE,YAAY,EAAE,OAAe,EAAE;AACnD,aAAK,QAAQ,IAAI,MAAM,8BAA8B,MAAM,GAAG;AAC9D,mBAAK,QAAQ,eAAb,mBAAyB,QAAQ,OAAO,KAAK,UAAU,SAAS;AAGhE,cAAM,YAAY,MAAM,KAAK,QAAQ;AAAA,UACnC,KAAK,aAAa,MAAM,KAAK,Y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AAA,MACF;AAGA,UAAI,QAAQ,KAAK,QAAQ,CAAC,KAAK,eAAe;AAC5C,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,wCAAwC,KAAK,aAAa,gBAAgB,CAAC,KAAK,aAAa;AAAA,QAC7I;AACA,gBAAQ,CAAC,KAAK;AAAA,MAChB,WAAW,QAAQ,KAAK,gBAAgB;AACtC,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,0CAA0C,KAAK,cAAc,gBAAgB,KAAK,cAAc;AAAA,QAChJ;AACA,gBAAQ,KAAK;AAAA,MACf;AAEA,WAAK,aAAa;AAElB,YAAM,YAAY,oBAAI,KAAK;AAC3B,gBAAU,gBAAgB,CAAC;AAG3B,WAAK,QAAQ,IAAI;AAAA,QACf,0FAA0F,KAAK,SAAS;AAAA,MAC1G;AAGA,YAAM,aAA6B;AAAA,QACjC,aAAa,QAAQ,IAAI,QAAQ;AAAA,QACjC,aAAa,QAAQ,IAAI,IAAI;AAAA,QAC7B,aAAa,QAAQ,IAAI,IAAI;AAAA,QAC7B,MAAM;AAAA,MACR;AAEA,YAAM,SAAS;AAAA,QACb,WAAW;AAAA,QACX,UAAU;AAAA,QACV,WAAW,KAAK;AAAA,QAChB,WAAW,KAAK;AAAA,QAChB,WAAW,UAAU,QAAQ,IAAI;AAAA,MACnC;AACA,iBAAK,QAAQ,eAAb,mBAAyB;AAAA,QACvB,KAAK;AAAA,QACL,KAAK,UAAU,MAAM;AAAA;AAAA,IAEzB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ class Sf800Pro extends import_ZenHaDevice.ZenHaDevice {
|
|
|
34
34
|
_deviceName,
|
|
35
35
|
_zenHaDeviceDetails
|
|
36
36
|
);
|
|
37
|
-
this.maxInputLimit =
|
|
37
|
+
this.maxInputLimit = 1e3;
|
|
38
38
|
this.maxOutputLimit = 800;
|
|
39
39
|
this.states = import_solarflow800ProStates.solarflow800ProStates;
|
|
40
40
|
this.controlStates = import_solarflow800ProControlStates.solarflow800ProControlStates;
|
|
@@ -113,7 +113,7 @@ class Sf800Pro extends import_ZenHaDevice.ZenHaDevice {
|
|
|
113
113
|
);
|
|
114
114
|
limit = this.maxOutputLimit;
|
|
115
115
|
}
|
|
116
|
-
this.
|
|
116
|
+
this.messageId += 1;
|
|
117
117
|
const timestamp = /* @__PURE__ */ new Date();
|
|
118
118
|
timestamp.setMilliseconds(0);
|
|
119
119
|
this.adapter.log.debug(
|
|
@@ -128,7 +128,7 @@ class Sf800Pro extends import_ZenHaDevice.ZenHaDevice {
|
|
|
128
128
|
const hemsEP = {
|
|
129
129
|
arguments: _arguments,
|
|
130
130
|
function: "hemsEP",
|
|
131
|
-
messageId: this.
|
|
131
|
+
messageId: this.messageId,
|
|
132
132
|
deviceKey: this.deviceKey,
|
|
133
133
|
timestamp: timestamp.getTime() / 1e3
|
|
134
134
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/models/deviceModels/Sf800Pro.ts"],
|
|
4
|
-
"sourcesContent": ["import { solarflow800ProControlStates } from \"../../constants/solarflow800ProControlStates\";\nimport { solarflow800ProStates } from \"../../constants/solarflow800ProStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf800Pro extends ZenHaDevice {\n maxInputLimit =
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0CAA6C;AAC7C,mCAAsC;AAItC,yBAA4B;AAErB,MAAM,iBAAiB,+BAAY;AAAA,EAOjC,YACL,UACA,aACA,YACA,cACA,aACA,qBACA;AACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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f,kEAAkE,KAAK;AAAA,MACzE;AAEA,UAAI,OAAO;AACT,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B,OAAO;AACL,gBAAQ;AAAA,MACV;AAEA,UAAI,KAAK,QAAQ,OAAO,oBAAoB;AAC1C,cAAM,uBAAuB,MAAM,KAAK,QAAQ;AAAA,UAC9C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AACA,YACE,wBACA,qBAAqB,OACrB,qBAAqB,OAAO,QAC5B,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAEA,cAAM,mBAAmB,MAAM,KAAK,QAAQ;AAAA,UAC1C,KAAK,aAAa,MAAM,KAAK,YAAY;AAAA,QAC3C;AAEA,YACE,oBACA,iBAAiB,OACjB,iBAAiB,OAAO,QACxB,QAAQ,GACR;AACA,kBAAQ;AAAA,QACV;AAAA,MACF;AAGA,UAAI,QAAQ,KAAK,QAAQ,CAAC,KAAK,eAAe;AAC5C,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,wCAAwC,KAAK,aAAa,gBAAgB,CAAC,KAAK,aAAa;AAAA,QAC7I;AACA,gBAAQ,CAAC,KAAK;AAAA,MAChB,WAAW,QAAQ,KAAK,gBAAgB;AACtC,aAAK,QAAQ,IAAI;AAAA,UACf,yCAAyC,KAAK,0CAA0C,KAAK,cAAc,gBAAgB,KAAK,cAAc;AAAA,QAChJ;AACA,gBAAQ,KAAK;AAAA,MACf;AAEA,WAAK,
|
|
4
|
+
"sourcesContent": ["import { solarflow800ProControlStates } from \"../../constants/solarflow800ProControlStates\";\nimport { solarflow800ProStates } from \"../../constants/solarflow800ProStates\";\nimport { ZendureSolarflow } from \"../../main\";\nimport { IHemsEpPayload } from \"../IDeviceAutomationPayload\";\nimport { IZenHaDeviceDetails } from \"../IZenHaDeviceDetails\";\nimport { ZenHaDevice } from \"./ZenHaDevice\";\n\nexport class Sf800Pro extends ZenHaDevice {\n maxInputLimit = 1000;\n maxOutputLimit = 800;\n\n states = solarflow800ProStates;\n controlStates = solarflow800ProControlStates;\n\n public constructor(\n _adapter: ZendureSolarflow,\n _productKey: string,\n _deviceKey: string,\n _productName: string,\n _deviceName: string,\n _zenHaDeviceDetails?: IZenHaDeviceDetails,\n ) {\n super(\n _adapter,\n _productKey,\n _deviceKey,\n _productName,\n _deviceName,\n _zenHaDeviceDetails,\n );\n }\n\n public async setAcMode(acMode: number): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n if (acMode >= 0 && acMode <= 3) {\n const topic = `iot/${this.productKey}/${this.deviceKey}/properties/write`;\n\n const setAcMode = { properties: { acMode: acMode } };\n this.adapter.log.debug(`[setAcMode] Set AC mode to ${acMode}!`);\n this.adapter.mqttClient?.publish(topic, JSON.stringify(setAcMode));\n\n // Check if device is HUB, then check if smartMode is false - if so send a warning to log!\n const smartMode = await this.adapter.getStateAsync(\n this.productKey + \".\" + this.deviceKey + \".control.smartMode\",\n );\n\n if (smartMode && !smartMode.val) {\n this.adapter.log.warn(\n `[setAcMode] AC mode was switched and smartMode is false - changes will be written to flash memory. In the worst case, the device may break or changes may no longer be saved!`,\n );\n }\n } else {\n this.adapter.log.error(\n `[setAcMode] AC mode must be a value between 0 and 3!`,\n );\n }\n }\n }\n\n public setAcSwitch(acSwitch: boolean): void {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n const setAcSwitchContent = {\n properties: { acSwitch: acSwitch ? 1 : 0 },\n };\n this.adapter.log.debug(\n `[setAcSwitch] Set AC Switch for device ${this.deviceKey} to ${acSwitch}!`,\n );\n this.adapter.mqttClient?.publish(\n this.iotTopic,\n JSON.stringify(setAcSwitchContent),\n );\n }\n }\n\n public async setDeviceAutomationInOutLimit(\n limit: number, // can be negative, negative will trigger charging mode\n ): Promise<void> {\n if (this.adapter.mqttClient && this.productKey && this.deviceKey) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Set device Automation limit to ${limit}!`,\n );\n\n if (limit) {\n limit = Math.round(limit);\n } else {\n limit = 0;\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 limit > 0\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 limit > 0\n ) {\n limit = 0;\n }\n }\n\n // Convert maxInputLimit to negative value and compare to limit\n if (limit < 0 && limit < -this.maxInputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is below the maximum input limit of ${this.maxInputLimit}, setting to ${-this.maxInputLimit}!`,\n );\n limit = -this.maxInputLimit;\n } else if (limit > this.maxOutputLimit) {\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] limit ${limit} is higher the maximum output limit of ${this.maxOutputLimit}, setting to ${this.maxOutputLimit}!`,\n );\n limit = this.maxOutputLimit;\n }\n\n this.messageId += 1;\n\n const timestamp = new Date();\n timestamp.setMilliseconds(0);\n\n // Device Automation for Solarflow 2400 AC and Solarflow 800\n this.adapter.log.debug(\n `[setDeviceAutomationInOutLimit] Using HEMS Variant of device automation, as deviceKey '${this.deviceKey}' detected!`,\n );\n\n // HEMS Variante\n const _arguments: IHemsEpPayload = {\n outputPower: limit > 0 ? limit : 0,\n chargeState: limit > 0 ? 0 : 1,\n chargePower: limit > 0 ? 0 : limit,\n mode: 9,\n };\n\n const hemsEP = {\n arguments: _arguments,\n function: \"hemsEP\",\n messageId: this.messageId,\n deviceKey: this.deviceKey,\n timestamp: timestamp.getTime() / 1000,\n };\n this.adapter.mqttClient?.publish(\n this.functionTopic,\n JSON.stringify(hemsEP),\n );\n }\n }\n}\n"],
|
|
5
|
+
"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,IAAI;AAAA,QACf,0FAA0F,KAAK,SAAS;AAAA,MAC1G;AAGA,YAAM,aAA6B;AAAA,QACjC,aAAa,QAAQ,IAAI,QAAQ;AAAA,QACjC,aAAa,QAAQ,IAAI,IAAI;AAAA,QAC7B,aAAa,QAAQ,IAAI,IAAI;AAAA,QAC7B,MAAM;AAAA,MACR;AAEA,YAAM,SAAS;AAAA,QACb,WAAW;AAAA,QACX,UAAU;AAAA,QACV,WAAW,KAAK;AAAA,QAChB,WAAW,KAAK;AAAA,QAChB,WAAW,UAAU,QAAQ,IAAI;AAAA,MACnC;AACA,iBAAK,QAAQ,eAAb,mBAAyB;AAAA,QACvB,KAAK;AAAA,QACL,KAAK,UAAU,MAAM;AAAA;AAAA,IAEzB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -126,7 +126,7 @@ class SfHub1200 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
126
126
|
limit = 30;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
this.
|
|
129
|
+
this.messageId += 1;
|
|
130
130
|
const timestamp = /* @__PURE__ */ new Date();
|
|
131
131
|
timestamp.setMilliseconds(0);
|
|
132
132
|
let _arguments = [];
|
|
@@ -163,7 +163,7 @@ class SfHub1200 extends import_ZenHaDevice.ZenHaDevice {
|
|
|
163
163
|
const deviceAutomation = {
|
|
164
164
|
arguments: _arguments,
|
|
165
165
|
function: "deviceAutomation",
|
|
166
|
-
messageId: this.
|
|
166
|
+
messageId: this.messageId,
|
|
167
167
|
deviceKey: this.deviceKey,
|
|
168
168
|
timestamp: timestamp.getTime() / 1e3
|
|
169
169
|
};
|