iobroker.sma-echarger 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +155 -3
- package/admin/i18n/de.json +5 -0
- package/admin/i18n/en.json +5 -0
- package/admin/i18n/es.json +5 -0
- package/admin/i18n/fr.json +5 -0
- package/admin/i18n/it.json +5 -0
- package/admin/i18n/nl.json +5 -0
- package/admin/i18n/pl.json +5 -0
- package/admin/i18n/pt.json +5 -0
- package/admin/i18n/ru.json +5 -0
- package/admin/i18n/uk.json +5 -0
- package/admin/i18n/zh-cn.json +5 -0
- package/admin/jsonConfig.json +38 -0
- package/admin/sma-echarger.png +0 -0
- package/io-package.json +128 -0
- package/lib/adapter-config.d.ts +23 -0
- package/main.js +515 -0
- package/package.json +66 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SpongeTroN <rolf@bunter-waeschekorb.de>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,155 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# ioBroker.sma-echarger
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/iobroker.sma-echarger)
|
|
6
|
+
[](https://www.npmjs.com/package/iobroker.sma-echarger)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
[](https://nodei.co/npm/iobroker.sma-echarger/)
|
|
11
|
+
|
|
12
|
+
**Tests:** 
|
|
13
|
+
|
|
14
|
+
## sma-echarger adapter for ioBroker
|
|
15
|
+
|
|
16
|
+
Anbindung eines SMA eChargers. Lesen und Steuern
|
|
17
|
+
|
|
18
|
+
## Developer manual
|
|
19
|
+
|
|
20
|
+
This section is intended for the developer. It can be deleted later.
|
|
21
|
+
|
|
22
|
+
### DISCLAIMER
|
|
23
|
+
|
|
24
|
+
Please make sure that you consider copyrights and trademarks when you use names or logos of a company and add a disclaimer to your README.
|
|
25
|
+
You can check other adapters for examples or ask in the developer community. Using a name or logo of a company without permission may cause legal problems for you.
|
|
26
|
+
|
|
27
|
+
### Getting started
|
|
28
|
+
|
|
29
|
+
You are almost done, only a few steps left:
|
|
30
|
+
|
|
31
|
+
1. Create a new repository on GitHub with the name `ioBroker.sma-echarger`
|
|
32
|
+
2. Initialize the current folder as a new git repository:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git init -b master
|
|
36
|
+
git add .
|
|
37
|
+
git commit -m "Initial commit"
|
|
38
|
+
```
|
|
39
|
+
3. Link your local repository with the one on GitHub:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git remote add origin https://github.com/SpongeTroN/ioBroker.sma-echarger
|
|
43
|
+
```
|
|
44
|
+
4. Push all files to the GitHub repo:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git push origin master
|
|
48
|
+
```
|
|
49
|
+
5. Add a new secret under https://github.com/SpongeTroN/ioBroker.sma-echarger/settings/secrets. It must be named `AUTO_MERGE_TOKEN` and contain a personal access token with push access to the repository, e.g. yours. You can create a new token under https://github.com/settings/tokens.
|
|
50
|
+
6. Head over to [main.js](main.js) and start programming!
|
|
51
|
+
|
|
52
|
+
### Best Practices
|
|
53
|
+
|
|
54
|
+
We've collected some [best practices](https://github.com/ioBroker/ioBroker.repositories#development-and-coding-best-practices) regarding ioBroker development and coding in general. If you're new to ioBroker or Node.js, you should
|
|
55
|
+
check them out. If you're already experienced, you should also take a look at them - you might learn something new :)
|
|
56
|
+
|
|
57
|
+
### State Roles
|
|
58
|
+
|
|
59
|
+
When creating state objects, it is important to use the correct role for the state. The role defines how the state should be interpreted by visualizations and other adapters. For a list of available roles and their meanings, please refer to the [state roles documentation](https://www.iobroker.net/#en/documentation/dev/stateroles.md).
|
|
60
|
+
|
|
61
|
+
**Important:** Do not invent your own custom role names. If you need a role that is not part of the official list, please contact the ioBroker developer community for guidance and discussion about adding new roles.
|
|
62
|
+
|
|
63
|
+
### Scripts in `package.json`
|
|
64
|
+
|
|
65
|
+
Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
|
|
66
|
+
|
|
67
|
+
| Script name | Description |
|
|
68
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| `test:js` | Executes the tests you defined in `*.test.js` files. |
|
|
70
|
+
| `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
|
|
71
|
+
| `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
|
|
72
|
+
| `test` | Performs a minimal test run on package files and your tests. |
|
|
73
|
+
| `check` | Performs a type-check on your code (without compiling anything). |
|
|
74
|
+
| `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
|
|
75
|
+
| `translate` | Translates texts in your adapter to all required languages, see [`@iobroker/adapter-dev`](https://github.com/ioBroker/adapter-dev#manage-translations) for more details. |
|
|
76
|
+
| `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
|
|
77
|
+
|
|
78
|
+
### Writing tests
|
|
79
|
+
|
|
80
|
+
When done right, testing code is invaluable, because it gives you the
|
|
81
|
+
confidence to change your code while knowing exactly if and when
|
|
82
|
+
something breaks. A good read on the topic of test-driven development
|
|
83
|
+
is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
|
|
84
|
+
Although writing tests before the code might seem strange at first, but it has very
|
|
85
|
+
clear upsides.
|
|
86
|
+
|
|
87
|
+
The template provides you with basic tests for the adapter startup and package files.
|
|
88
|
+
It is recommended that you add your own tests into the mix.
|
|
89
|
+
|
|
90
|
+
### Publishing the adapter
|
|
91
|
+
|
|
92
|
+
Using GitHub Actions, you can enable automatic releases on npm whenever you push a new git tag that matches the form
|
|
93
|
+
`v<major>.<minor>.<patch>`. We **strongly recommend** that you do. The necessary steps are described in `.github/workflows/test-and-release.yml`.
|
|
94
|
+
|
|
95
|
+
Since you installed the release script, you can create a new
|
|
96
|
+
release simply by calling:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run release
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Additional command line options for the release script are explained in the
|
|
103
|
+
[release-script documentation](https://github.com/AlCalzone/release-script#command-line).
|
|
104
|
+
|
|
105
|
+
To get your adapter released in ioBroker, please refer to the documentation
|
|
106
|
+
of [ioBroker.repositories](https://github.com/ioBroker/ioBroker.repositories#requirements-for-adapter-to-get-added-to-the-latest-repository).
|
|
107
|
+
|
|
108
|
+
### Test the adapter manually with dev-server
|
|
109
|
+
|
|
110
|
+
Since you set up `dev-server`, you can use it to run, test and debug your adapter.
|
|
111
|
+
|
|
112
|
+
You may start `dev-server` by calling from your dev directory:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
dev-server watch
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The ioBroker.admin interface will then be available at http://localhost:undefined/
|
|
119
|
+
|
|
120
|
+
Please refer to the [`dev-server` documentation](https://github.com/ioBroker/dev-server#command-line) for more details.
|
|
121
|
+
|
|
122
|
+
## Changelog
|
|
123
|
+
|
|
124
|
+
<!--
|
|
125
|
+
Placeholder for the next version (at the beginning of the line):
|
|
126
|
+
### **WORK IN PROGRESS**
|
|
127
|
+
-->
|
|
128
|
+
|
|
129
|
+
### **WORK IN PROGRESS**
|
|
130
|
+
|
|
131
|
+
* (SpongeTroN) initial release
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT License
|
|
136
|
+
|
|
137
|
+
Copyright (c) 2026 SpongeTroN <rolf@bunter-waeschekorb.de>
|
|
138
|
+
|
|
139
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
140
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
141
|
+
in the Software without restriction, including without limitation the rights
|
|
142
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
143
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
144
|
+
furnished to do so, subject to the following conditions:
|
|
145
|
+
|
|
146
|
+
The above copyright notice and this permission notice shall be included in all
|
|
147
|
+
copies or substantial portions of the Software.
|
|
148
|
+
|
|
149
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
150
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
151
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
152
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
153
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
154
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
155
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"i18n": true,
|
|
3
|
+
"type": "panel",
|
|
4
|
+
"items": {
|
|
5
|
+
"ipAddress": {
|
|
6
|
+
"type": "text",
|
|
7
|
+
"label": "IP-Adresse des SMA eChargers",
|
|
8
|
+
"xs": 12,
|
|
9
|
+
"sm": 6,
|
|
10
|
+
"md": 4
|
|
11
|
+
},
|
|
12
|
+
"pollInterval": {
|
|
13
|
+
"type": "number",
|
|
14
|
+
"label": "Abfrageintervall (Sekunden)",
|
|
15
|
+
"min": 15,
|
|
16
|
+
"max": 3600,
|
|
17
|
+
"default": 15,
|
|
18
|
+
"xs": 12,
|
|
19
|
+
"sm": 6,
|
|
20
|
+
"md": 4
|
|
21
|
+
},
|
|
22
|
+
"username": {
|
|
23
|
+
"type": "text",
|
|
24
|
+
"label": "Benutzername (Standard: user)",
|
|
25
|
+
"default": "user",
|
|
26
|
+
"xs": 12,
|
|
27
|
+
"sm": 6,
|
|
28
|
+
"md": 4
|
|
29
|
+
},
|
|
30
|
+
"password": {
|
|
31
|
+
"type": "password",
|
|
32
|
+
"label": "Passwort",
|
|
33
|
+
"xs": 12,
|
|
34
|
+
"sm": 6,
|
|
35
|
+
"md": 4
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
Binary file
|
package/io-package.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"common": {
|
|
3
|
+
"name": "sma-echarger",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"news": {
|
|
6
|
+
"0.1.0": {
|
|
7
|
+
"en": "First working version with live measurements, parameter scan and control states",
|
|
8
|
+
"de": "Erste funktionsfähige Version mit Live-Messwerten, Parameter-Scan und Control-Datenpunkten"
|
|
9
|
+
},
|
|
10
|
+
"0.0.1": {
|
|
11
|
+
"en": "initial release",
|
|
12
|
+
"de": "Erstveröffentlichung",
|
|
13
|
+
"ru": "Начальная версия",
|
|
14
|
+
"pt": "lançamento inicial",
|
|
15
|
+
"nl": "Eerste uitgave",
|
|
16
|
+
"fr": "Première version",
|
|
17
|
+
"it": "Versione iniziale",
|
|
18
|
+
"es": "Versión inicial",
|
|
19
|
+
"pl": "Pierwsze wydanie",
|
|
20
|
+
"uk": "Початкова версія",
|
|
21
|
+
"zh-cn": "首次出版"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"titleLang": {
|
|
25
|
+
"en": "eCharger",
|
|
26
|
+
"de": "eCharger",
|
|
27
|
+
"ru": "электронное зарядное устройство",
|
|
28
|
+
"pt": "Carregador eletrônico",
|
|
29
|
+
"nl": "eOplader",
|
|
30
|
+
"fr": "eChargeur",
|
|
31
|
+
"it": "eCharger",
|
|
32
|
+
"es": "cargador electrónico",
|
|
33
|
+
"pl": "eŁadowarka",
|
|
34
|
+
"uk": "eCharger",
|
|
35
|
+
"zh-cn": "电子充电器"
|
|
36
|
+
},
|
|
37
|
+
"desc": {
|
|
38
|
+
"en": "Anbindung eines SMA eChargers. Lesen und Steuern",
|
|
39
|
+
"de": "Anbindung eines SMA eChargers. Lesen und Steuern",
|
|
40
|
+
"ru": "Используйте зарядные устройства SMA eChargers. Лесен и Стойерн",
|
|
41
|
+
"pt": "Conecte seus eChargers SMA. Lesen e Steuern",
|
|
42
|
+
"nl": "Sluit een SMA eCharger aan. Lesen en Steuern",
|
|
43
|
+
"fr": "Connexion à un chargeur électronique SMA. Lesen et Steuern",
|
|
44
|
+
"it": "Collegare un eChargers SMA. Lesen und Steuern",
|
|
45
|
+
"es": "Anbindung eines SMA eChargers. Lesen und Steuern",
|
|
46
|
+
"pl": "Dołącz eines SMA eChargers. Lesen i Steuern",
|
|
47
|
+
"uk": "Anbindung eines SMA eChargers. Lesen und Steuern",
|
|
48
|
+
"zh-cn": "SMA 电子充电器的安装。学习与施展"
|
|
49
|
+
},
|
|
50
|
+
"authors": [
|
|
51
|
+
"SpongeTroN <rolf@bunter-waeschekorb.de>"
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"template",
|
|
55
|
+
"automation",
|
|
56
|
+
"IoT",
|
|
57
|
+
"integration"
|
|
58
|
+
],
|
|
59
|
+
"licenseInformation": {
|
|
60
|
+
"type": "free",
|
|
61
|
+
"license": "MIT"
|
|
62
|
+
},
|
|
63
|
+
"platform": "Javascript/Node.js",
|
|
64
|
+
"icon": "sma-echarger.png",
|
|
65
|
+
"enabled": true,
|
|
66
|
+
"extIcon": "https://raw.githubusercontent.com/SpongeTroN/ioBroker.sma-echarger/master/admin/sma-echarger.png",
|
|
67
|
+
"readme": "https://github.com/SpongeTroN/ioBroker.sma-echarger/blob/master/README.md",
|
|
68
|
+
"loglevel": "info",
|
|
69
|
+
"tier": 3,
|
|
70
|
+
"mode": "daemon",
|
|
71
|
+
"type": "iot-systems",
|
|
72
|
+
"compact": true,
|
|
73
|
+
"connectionType": "local",
|
|
74
|
+
"dataSource": "poll",
|
|
75
|
+
"adminUI": {
|
|
76
|
+
"config": "json"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": [
|
|
79
|
+
{
|
|
80
|
+
"js-controller": ">=6.0.11"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"globalDependencies": [
|
|
84
|
+
{
|
|
85
|
+
"admin": ">=7.0.23"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"native": {
|
|
90
|
+
"option1": true,
|
|
91
|
+
"option2": "42"
|
|
92
|
+
},
|
|
93
|
+
"objects": [],
|
|
94
|
+
"instanceObjects": [
|
|
95
|
+
{
|
|
96
|
+
"_id": "info",
|
|
97
|
+
"type": "channel",
|
|
98
|
+
"common": {
|
|
99
|
+
"name": "Information"
|
|
100
|
+
},
|
|
101
|
+
"native": {}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"_id": "info.connection",
|
|
105
|
+
"type": "state",
|
|
106
|
+
"common": {
|
|
107
|
+
"role": "indicator.connected",
|
|
108
|
+
"name": "Device or service connected",
|
|
109
|
+
"type": "boolean",
|
|
110
|
+
"read": true,
|
|
111
|
+
"write": false,
|
|
112
|
+
"def": false
|
|
113
|
+
},
|
|
114
|
+
"encryptedNative": [
|
|
115
|
+
"password"
|
|
116
|
+
],
|
|
117
|
+
"protectedNative": [
|
|
118
|
+
"password"
|
|
119
|
+
],
|
|
120
|
+
"native": {
|
|
121
|
+
"ipAddress": "",
|
|
122
|
+
"pollInterval": 15,
|
|
123
|
+
"username": "user",
|
|
124
|
+
"password": "***"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// This file extends the AdapterConfig type from "@iobroker/types"
|
|
2
|
+
// using the actual properties present in io-package.json
|
|
3
|
+
// in order to provide typings for adapter.config properties
|
|
4
|
+
|
|
5
|
+
import { native } from '../io-package.json';
|
|
6
|
+
|
|
7
|
+
type _AdapterConfig = typeof native;
|
|
8
|
+
|
|
9
|
+
// Augment the globally declared type ioBroker.AdapterConfig
|
|
10
|
+
declare global {
|
|
11
|
+
namespace ioBroker {
|
|
12
|
+
interface AdapterConfig extends _AdapterConfig {
|
|
13
|
+
ipAddress: string;
|
|
14
|
+
pollInterval: number;
|
|
15
|
+
username: string;
|
|
16
|
+
password: string;
|
|
17
|
+
// Do not enter anything here!
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// this is required so the above AdapterConfig is found by TypeScript / type checking
|
|
23
|
+
export {};
|
package/main.js
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const utils = require('@iobroker/adapter-core');
|
|
5
|
+
const axios = require('axios');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
|
|
8
|
+
const LIVE_POINTS = [
|
|
9
|
+
{
|
|
10
|
+
channel: 'Measurement.Metering.GridMs.TotWIn.ChaSta',
|
|
11
|
+
dp: 'Ladeleistung_W',
|
|
12
|
+
name: 'Aktuelle Ladeleistung',
|
|
13
|
+
unit: 'W',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
channel: 'Measurement.Metering.GridMs.TotWhIn.ChaSta',
|
|
17
|
+
dp: 'Gesamtenergie_Wh',
|
|
18
|
+
name: 'Geladene Gesamtenergie',
|
|
19
|
+
unit: 'Wh',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
channel: 'Measurement.ChaSess.WhIn',
|
|
23
|
+
dp: 'Sitzungsenergie_Wh',
|
|
24
|
+
name: 'Energie aktuelle Ladung',
|
|
25
|
+
unit: 'Wh',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
channel: 'Measurement.Operation.EVeh.ChaStt',
|
|
29
|
+
dp: 'Fahrzeug_Status',
|
|
30
|
+
name: 'Status Fahrzeug/Ladung',
|
|
31
|
+
unit: '',
|
|
32
|
+
states: {
|
|
33
|
+
200111: 'Kabel getrennt',
|
|
34
|
+
200112: 'Kabel angeschlossen',
|
|
35
|
+
200113: 'wird geladen',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
channel: 'Measurement.Operation.Health',
|
|
40
|
+
dp: 'Geraete_Status',
|
|
41
|
+
name: 'Status Wallbox',
|
|
42
|
+
unit: '',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
channel: 'Measurement.GridMs.A.phsA',
|
|
46
|
+
dp: 'Strom_L1_A',
|
|
47
|
+
name: 'Ladestrom Phase L1',
|
|
48
|
+
unit: 'A',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
channel: 'Measurement.GridMs.A.phsB',
|
|
52
|
+
dp: 'Strom_L2_A',
|
|
53
|
+
name: 'Ladestrom Phase L2',
|
|
54
|
+
unit: 'A',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
channel: 'Measurement.GridMs.A.phsC',
|
|
58
|
+
dp: 'Strom_L3_A',
|
|
59
|
+
name: 'Ladestrom Phase L3',
|
|
60
|
+
unit: 'A',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
channel: 'Measurement.GridMs.PhV.phsA',
|
|
64
|
+
dp: 'Spannung_L1_V',
|
|
65
|
+
name: 'Spannung Phase L1',
|
|
66
|
+
unit: 'V',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
channel: 'Measurement.GridMs.PhV.phsB',
|
|
70
|
+
dp: 'Spannung_L2_V',
|
|
71
|
+
name: 'Spannung Phase L2',
|
|
72
|
+
unit: 'V',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
channel: 'Measurement.GridMs.PhV.phsC',
|
|
76
|
+
dp: 'Spannung_L3_V',
|
|
77
|
+
name: 'Spannung Phase L3',
|
|
78
|
+
unit: 'V',
|
|
79
|
+
},
|
|
80
|
+
// Hier einfach weitere Kanäle ergänzen...
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/** @type {const} */
|
|
85
|
+
|
|
86
|
+
const CONTROL_STATES = [
|
|
87
|
+
{
|
|
88
|
+
id: 'Control.Lademodus',
|
|
89
|
+
channelId: 'Parameter.Chrg.ActChaMod',
|
|
90
|
+
initial: 4719,
|
|
91
|
+
common: {
|
|
92
|
+
name: 'Lademodus für eCharger festlegen',
|
|
93
|
+
type: 'number',
|
|
94
|
+
role: 'level',
|
|
95
|
+
read: true,
|
|
96
|
+
write: true,
|
|
97
|
+
states: {
|
|
98
|
+
4718: 'Schnellladen',
|
|
99
|
+
4719: 'PV-Überschuss',
|
|
100
|
+
4720: 'Laden mit Zielvorgabe',
|
|
101
|
+
4721: 'LadenStop',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'Control.Inverter_WMaxIn',
|
|
107
|
+
channelId: 'Parameter.Inverter.WMaxIn',
|
|
108
|
+
initial: 11000,
|
|
109
|
+
common: {
|
|
110
|
+
name: 'Maximale Wirkleistung (WMaxIn) setzen',
|
|
111
|
+
type: 'number',
|
|
112
|
+
role: 'level.power',
|
|
113
|
+
unit: 'W',
|
|
114
|
+
min: 4500,
|
|
115
|
+
max: 11000,
|
|
116
|
+
read: true,
|
|
117
|
+
write: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'Control.Ladefreigabe',
|
|
122
|
+
channelId: 'Parameter.Chrg.ChrgApv',
|
|
123
|
+
initial: 5171,
|
|
124
|
+
common: {
|
|
125
|
+
name: 'Ladefreigabe',
|
|
126
|
+
type: 'number',
|
|
127
|
+
role: 'level',
|
|
128
|
+
read: true,
|
|
129
|
+
write: true,
|
|
130
|
+
states: {
|
|
131
|
+
5172: 'Ja',
|
|
132
|
+
5171: 'Nein',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'Control.Inverter_WMax',
|
|
138
|
+
channelId: 'Parameter.Inverter.WMax',
|
|
139
|
+
initial: 11000,
|
|
140
|
+
common: {
|
|
141
|
+
name: 'Maximale Wirkleistung setzen (WMax)',
|
|
142
|
+
type: 'number',
|
|
143
|
+
role: 'level.power',
|
|
144
|
+
unit: 'W',
|
|
145
|
+
min: 4500,
|
|
146
|
+
max: 11000,
|
|
147
|
+
read: true,
|
|
148
|
+
write: true,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const TARGET_PARAMS = [
|
|
154
|
+
'Parameter.Chrg.ActChaMod',
|
|
155
|
+
'Parameter.Inverter.WMax',
|
|
156
|
+
'Parameter.Inverter.WMaxIn',
|
|
157
|
+
'Parameter.Inverter.AcALim',
|
|
158
|
+
'Parameter.Chrg.ChrgLok',
|
|
159
|
+
'Parameter.Chrg.ChrgApv',
|
|
160
|
+
'Parameter.Inverter.OutPhs',
|
|
161
|
+
'Parameter.Chrg.Plan.DurTmm',
|
|
162
|
+
'Parameter.Chrg.Plan.En',
|
|
163
|
+
'Parameter.Chrg.Plan.StopTm',
|
|
164
|
+
];
|
|
165
|
+
const queryItems = TARGET_PARAMS.map(id => ({
|
|
166
|
+
componentId: 'IGULD:SELF',
|
|
167
|
+
channelId: id,
|
|
168
|
+
}));
|
|
169
|
+
|
|
170
|
+
// Mapping-Tabelle automatisch aus LIVE_POINTS erzeugen
|
|
171
|
+
const LIVE_MAPPING = Object.fromEntries(LIVE_POINTS.map(item => [item.channel, item.dp]));
|
|
172
|
+
// Reagiert auf Änderungen des Datenpunkts (ack: false)
|
|
173
|
+
// Zuordnung: [Datenpunkt unter DP_PREFIX] -> [SMA Parameter-Kanal]
|
|
174
|
+
|
|
175
|
+
class SmaEcharger extends utils.Adapter {
|
|
176
|
+
constructor(options) {
|
|
177
|
+
super({
|
|
178
|
+
...options,
|
|
179
|
+
name: 'sma-echarger',
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
this.on('ready', this.onReady.bind(this));
|
|
183
|
+
this.on('stateChange', this.onStateChange.bind(this));
|
|
184
|
+
this.on('unload', this.onUnload.bind(this));
|
|
185
|
+
|
|
186
|
+
this.httpsAgent = new https.Agent({ rejectUnauthorized: false });
|
|
187
|
+
this.cachedToken = null;
|
|
188
|
+
this.pollTimer = null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async onReady() {
|
|
192
|
+
this.log.info('=== PARAMETER-ANALYSE & LIVE-TEST STARTET ===');
|
|
193
|
+
|
|
194
|
+
if (!this.config.ipAddress || !this.config.password) {
|
|
195
|
+
this.log.error('ABBRUCH: IP-Adresse oder Passwort ist leer!');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 1. Debug-Datenpunkt für alle Parameter anlegen
|
|
200
|
+
await this.setObjectNotExistsAsync('Debug.All_Parameters', {
|
|
201
|
+
type: 'state',
|
|
202
|
+
common: {
|
|
203
|
+
name: 'Komplette JSON-Antwort aller Parameter',
|
|
204
|
+
type: 'string',
|
|
205
|
+
role: 'json',
|
|
206
|
+
read: true,
|
|
207
|
+
write: false,
|
|
208
|
+
},
|
|
209
|
+
native: {},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Übergeordneten Kanal "Live" anlegen
|
|
213
|
+
await this.setObjectNotExists('Live', {
|
|
214
|
+
type: 'channel',
|
|
215
|
+
common: { name: 'Live-Messwerte' },
|
|
216
|
+
native: {},
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Alle Live-Datenpunkte aus LIVE_POINTS anlegen
|
|
220
|
+
// Alle Live-Datenpunkte aus LIVE_POINTS anlegen/aktualisieren
|
|
221
|
+
for (const item of LIVE_POINTS) {
|
|
222
|
+
const fullId = `Live.${item.dp}`;
|
|
223
|
+
|
|
224
|
+
/** @type {ioBroker.StateCommon} */
|
|
225
|
+
const commonObj = {
|
|
226
|
+
name: item.name,
|
|
227
|
+
type: 'number',
|
|
228
|
+
role: 'value',
|
|
229
|
+
unit: item.unit,
|
|
230
|
+
read: true,
|
|
231
|
+
write: false,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
if (item.states) {
|
|
235
|
+
commonObj.states = item.states;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
await this.extendObject(fullId, {
|
|
239
|
+
type: 'state',
|
|
240
|
+
common: commonObj,
|
|
241
|
+
native: { channelId: item.channel },
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Initial auf 0 setzen, falls der Datenpunkt noch leer (null) ist
|
|
245
|
+
const existing = await this.getState(fullId);
|
|
246
|
+
if (!existing || existing.val === null) {
|
|
247
|
+
await this.setState(fullId, { val: 0, ack: true });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// 2b. Alle Control-Datenpunkte anlegen und auf Änderungen lauschen
|
|
251
|
+
|
|
252
|
+
for (const item of CONTROL_STATES) {
|
|
253
|
+
await this.setObjectNotExists(item.id, {
|
|
254
|
+
type: 'state',
|
|
255
|
+
common: item.common,
|
|
256
|
+
native: { channelId: item.channelId },
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
// Initialwert nur setzen, falls der Datenpunkt noch leer (null) ist
|
|
260
|
+
const existing = await this.getState(item.id);
|
|
261
|
+
if (!existing || existing.val === null) {
|
|
262
|
+
await this.setState(item.id, { val: item.initial, ack: true });
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
this.subscribeStates('Control.*');
|
|
267
|
+
this.subscribeStates('Parameter.*');
|
|
268
|
+
|
|
269
|
+
// 3. Einmalig ALLE Parameter abrufen und speichern
|
|
270
|
+
await this.listAllParameters();
|
|
271
|
+
|
|
272
|
+
// 4. Live-Werte sofort einmal abfragen und Intervall starten
|
|
273
|
+
await this.readLiveValues();
|
|
274
|
+
const intervalMs = (this.config.pollInterval || 15) * 1000;
|
|
275
|
+
this.pollTimer = this.setInterval(() => this.readLiveValues(), intervalMs);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async getToken(forceRefresh = false) {
|
|
279
|
+
if (this.cachedToken && !forceRefresh) {
|
|
280
|
+
return this.cachedToken;
|
|
281
|
+
}
|
|
282
|
+
const response = await axios.post(
|
|
283
|
+
`https://${this.config.ipAddress}/api/v1/token`,
|
|
284
|
+
`grant_type=password&username=${encodeURIComponent(this.config.username || 'user')}&password=${encodeURIComponent(this.config.password)}`,
|
|
285
|
+
{
|
|
286
|
+
httpsAgent: this.httpsAgent,
|
|
287
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
288
|
+
timeout: 10000,
|
|
289
|
+
},
|
|
290
|
+
);
|
|
291
|
+
this.cachedToken = response.data.access_token;
|
|
292
|
+
return this.cachedToken;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async smaRequest(method, endpoint, data) {
|
|
296
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
297
|
+
try {
|
|
298
|
+
const token = await this.getToken(attempt > 0);
|
|
299
|
+
return await axios.request({
|
|
300
|
+
method: method,
|
|
301
|
+
url: `https://${this.config.ipAddress}${endpoint}`,
|
|
302
|
+
data: data,
|
|
303
|
+
httpsAgent: this.httpsAgent,
|
|
304
|
+
headers: {
|
|
305
|
+
Authorization: `Bearer ${token}`,
|
|
306
|
+
'Content-Type': 'application/json',
|
|
307
|
+
},
|
|
308
|
+
timeout: 10000,
|
|
309
|
+
});
|
|
310
|
+
} catch (error) {
|
|
311
|
+
if (error.response && error.response.status === 401 && attempt === 0) {
|
|
312
|
+
this.cachedToken = null;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
throw error;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
async listAllParameters() {
|
|
321
|
+
try {
|
|
322
|
+
const res = await this.smaRequest('post', '/api/v1/parameters/search/', {
|
|
323
|
+
queryItems: [{ componentId: 'IGULD:SELF' }],
|
|
324
|
+
});
|
|
325
|
+
if (!res || !res.data) {
|
|
326
|
+
this.log.warn('Keine Daten von der SMA-Wallbox erhalten.');
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const jsonString = JSON.stringify(res.data);
|
|
330
|
+
|
|
331
|
+
await this.setState('Debug.All_Parameters', { val: jsonString, ack: true });
|
|
332
|
+
this.log.info(jsonString);
|
|
333
|
+
/////
|
|
334
|
+
let apiResponse = jsonString;
|
|
335
|
+
// 1. Falls die Antwort noch ein JSON-String ist, in ein Objekt umwandeln
|
|
336
|
+
const data = typeof apiResponse === 'string' ? JSON.parse(apiResponse) : apiResponse;
|
|
337
|
+
|
|
338
|
+
// 2. Prüfen, ob data[0] und das innere values-Array vorhanden sind
|
|
339
|
+
if (!Array.isArray(data) || data.length === 0 || !Array.isArray(data[0].values)) {
|
|
340
|
+
this.log.warn('Ungültiges SMA-Parameter-Format.');
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// 3. Alle Parameter aus data[0].values durchlaufen
|
|
345
|
+
data[0].values.forEach(param => {
|
|
346
|
+
// Punkt-Notation für saubere Ordnerstruktur in ioBroker beibehalten
|
|
347
|
+
const cleanId = param.channelId.replace(/\[\]$/, '');
|
|
348
|
+
|
|
349
|
+
// Wert auslesen (beachtet sowohl "value" als auch das Array "values[0]")
|
|
350
|
+
let rawValue = '';
|
|
351
|
+
if (param.value !== undefined) {
|
|
352
|
+
rawValue = param.value;
|
|
353
|
+
} else if (Array.isArray(param.values) && param.values.length > 0) {
|
|
354
|
+
rawValue = param.values[0];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Prüfen, ob der Wert eine Zahl ist (z. B. "5500" oder "14.000")
|
|
358
|
+
const isNumber = rawValue !== '' && !isNaN(Number(rawValue));
|
|
359
|
+
const finalValue = isNumber ? Number(rawValue) : String(rawValue);
|
|
360
|
+
|
|
361
|
+
// Datenpunkt-Eigenschaften aufbauen
|
|
362
|
+
/** @type {ioBroker.StateCommon} */
|
|
363
|
+
const commonObj = {
|
|
364
|
+
name: param.channelId,
|
|
365
|
+
type: isNumber ? 'number' : 'string',
|
|
366
|
+
role: 'value',
|
|
367
|
+
read: true,
|
|
368
|
+
write: Boolean(param.editable),
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
if (isNumber && param.min !== undefined) {
|
|
372
|
+
commonObj.min = Number(param.min);
|
|
373
|
+
}
|
|
374
|
+
if (isNumber && param.max !== undefined) {
|
|
375
|
+
commonObj.max = Number(param.max);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Datenpunkt anlegen und Wert setzen
|
|
379
|
+
this.setObjectNotExistsAsync(cleanId, {
|
|
380
|
+
type: 'state',
|
|
381
|
+
common: commonObj,
|
|
382
|
+
native: {},
|
|
383
|
+
});
|
|
384
|
+
this.setState(cleanId, { val: finalValue, ack: true });
|
|
385
|
+
});
|
|
386
|
+
if (Array.isArray(res.data) && res.data.length > 0 && Array.isArray(res.data[0].values)) {
|
|
387
|
+
this.log.info(
|
|
388
|
+
`Erfolg! ${res.data[0].values.length} Parameter gefunden und in Debug.All_Parameters gespeichert.`,
|
|
389
|
+
);
|
|
390
|
+
} else {
|
|
391
|
+
this.log.warn('Antwort erhalten, Struktur bitte im Datenpunkt Debug.All_Parameters ansehen.');
|
|
392
|
+
}
|
|
393
|
+
} catch (error) {
|
|
394
|
+
const details = error.response
|
|
395
|
+
? `${error.response.status} - ${JSON.stringify(error.response.data)}`
|
|
396
|
+
: error.message;
|
|
397
|
+
this.log.error(`Fehler beim Parameter-Abruf: ${details}`);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
async readLiveValues() {
|
|
402
|
+
try {
|
|
403
|
+
// Live-Messwerte abrufen
|
|
404
|
+
const liveRes = await this.smaRequest('post', '/api/v1/measurements/live/', [
|
|
405
|
+
{ componentId: 'IGULD:SELF' },
|
|
406
|
+
]);
|
|
407
|
+
if (!liveRes || !liveRes.data) {
|
|
408
|
+
this.log.warn('Keine Daten von der SMA-Wallbox erhalten.');
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (Array.isArray(liveRes.data)) {
|
|
413
|
+
for (const item of liveRes.data) {
|
|
414
|
+
const targetDp = LIVE_MAPPING[item.channelId];
|
|
415
|
+
if (targetDp && item.values && item.values.length > 0) {
|
|
416
|
+
const val = Number(item.values[0].value);
|
|
417
|
+
this.setState(`Live.${targetDp}`, { val: val, ack: true });
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// Alle gewünschten Parameter in einem einzigen Request abrufen
|
|
422
|
+
const paramRes = await this.smaRequest('post', '/api/v1/parameters/search/', { queryItems: queryItems });
|
|
423
|
+
|
|
424
|
+
// Antwort prüfen und mit einer Schleife in die Datenpunkte schreiben
|
|
425
|
+
if (Array.isArray(paramRes.data)) {
|
|
426
|
+
for (let i = 0; i < paramRes.data.length; i++) {
|
|
427
|
+
const componentObj = paramRes.data[i];
|
|
428
|
+
|
|
429
|
+
if (componentObj && Array.isArray(componentObj.values)) {
|
|
430
|
+
for (let j = 0; j < componentObj.values.length; j++) {
|
|
431
|
+
const item = componentObj.values[j];
|
|
432
|
+
const rawVal = item.value;
|
|
433
|
+
|
|
434
|
+
// Prüfen, ob der Wert eine Zahl ist (z. B. "4719" oder "14.000")
|
|
435
|
+
const finalVal = rawVal !== '' && !isNaN(Number(rawVal)) ? Number(rawVal) : String(rawVal);
|
|
436
|
+
|
|
437
|
+
// Schreibt z. B. in item.channelId-{Parameter.Chrg.ActChaMod}-, finalVal-{4719}-, ack-{true}- <-- 4719 steht für PV-Überschussladen
|
|
438
|
+
this.setState(item.channelId, finalVal, true);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
await this.setState('info.connection', true, true);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
await this.setState('info.connection', false, true);
|
|
446
|
+
const details = error.response ? JSON.stringify(error.response.data) : error.message;
|
|
447
|
+
this.log.error(`Fehler beim Lesen der Live-Werte: ${details}`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
async onStateChange(id, state) {
|
|
451
|
+
if (!state) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
const shortId = id.replace(`${this.namespace}.`, '');
|
|
456
|
+
|
|
457
|
+
// FALL 1: Steuerbefehl (ack === false) -> Suche über item.id
|
|
458
|
+
if (!state.ack) {
|
|
459
|
+
const controlItem = CONTROL_STATES.find(item => item.id === shortId);
|
|
460
|
+
if (controlItem) {
|
|
461
|
+
await this.setValueOneCharger(controlItem.channelId, controlItem.id, state.val);
|
|
462
|
+
}
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// FALL 2: Wert von der Wallbox (ack === true) -> Suche über item.channelId
|
|
467
|
+
const syncItem = CONTROL_STATES.find(item => item.channelId === shortId);
|
|
468
|
+
if (syncItem) {
|
|
469
|
+
const wallboxVal = Number(state.val);
|
|
470
|
+
const controlState = await this.getState(syncItem.id);
|
|
471
|
+
|
|
472
|
+
if (!isNaN(wallboxVal) && controlState && controlState.ack === true && controlState.val !== wallboxVal) {
|
|
473
|
+
await this.setState(syncItem.id, { val: wallboxVal, ack: true });
|
|
474
|
+
this.log.info(`SMA Sync: ${syncItem.id} auf ${wallboxVal} aktualisiert.`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
async setValueOneCharger(param, dp, value) {
|
|
480
|
+
try {
|
|
481
|
+
const putResponse = await this.smaRequest('put', '/api/v1/parameters/IGULD:SELF/', {
|
|
482
|
+
values: [
|
|
483
|
+
{
|
|
484
|
+
channelId: param,
|
|
485
|
+
timestamp: new Date().toISOString(),
|
|
486
|
+
value: String(value),
|
|
487
|
+
},
|
|
488
|
+
],
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
if (putResponse) {
|
|
492
|
+
this.log.info(`SMA eCharger ${param} erfolgreich auf ${value} gesetzt (HTTP ${putResponse.status})`);
|
|
493
|
+
const numVal = Number(value);
|
|
494
|
+
await this.setState(dp, { val: numVal, ack: true });
|
|
495
|
+
await this.setState(param, { val: numVal, ack: true });
|
|
496
|
+
}
|
|
497
|
+
} catch (error) {
|
|
498
|
+
const details = error.response ? JSON.stringify(error.response.data) : error.message;
|
|
499
|
+
this.log.error(`SMA eCharger Fehler beim Setzen von ${param}: ${details}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
onUnload(callback) {
|
|
504
|
+
if (this.pollTimer) {
|
|
505
|
+
this.clearInterval(this.pollTimer);
|
|
506
|
+
}
|
|
507
|
+
callback();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (require.main !== module) {
|
|
512
|
+
module.exports = options => new SmaEcharger(options);
|
|
513
|
+
} else {
|
|
514
|
+
new SmaEcharger();
|
|
515
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.sma-echarger",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Anbindung eines SMA eChargers. Lesen und Steuern",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "SpongeTroN",
|
|
7
|
+
"email": "rolf@bunter-waeschekorb.de"
|
|
8
|
+
},
|
|
9
|
+
"contributors": [],
|
|
10
|
+
"homepage": "https://github.com/SpongeTroN/ioBroker.sma-echarger",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"template",
|
|
14
|
+
"automation",
|
|
15
|
+
"IoT",
|
|
16
|
+
"integration"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/SpongeTroN/ioBroker.sma-echarger.git"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">= 20"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@iobroker/adapter-core": "^3.4.3",
|
|
27
|
+
"axios": "^1.21.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@alcalzone/release-script": "^5.2.1",
|
|
31
|
+
"@alcalzone/release-script-plugin-iobroker": "^5.2.0",
|
|
32
|
+
"@alcalzone/release-script-plugin-license": "^5.2.2",
|
|
33
|
+
"@alcalzone/release-script-plugin-manual-review": "^5.2.0",
|
|
34
|
+
"@iobroker/adapter-dev": "^1.5.0",
|
|
35
|
+
"@iobroker/dev-server": "^0.8.0",
|
|
36
|
+
"@iobroker/eslint-config": "^2.3.4",
|
|
37
|
+
"@iobroker/testing": "^6.3.2",
|
|
38
|
+
"@tsconfig/node24": "^24.0.6",
|
|
39
|
+
"@types/iobroker": "npm:@iobroker/types@^7.2.5",
|
|
40
|
+
"@types/node": "^24.19.2",
|
|
41
|
+
"typescript": "~5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"main": "main.js",
|
|
44
|
+
"files": [
|
|
45
|
+
"admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).{json,json5}",
|
|
46
|
+
"admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
|
|
47
|
+
"lib/",
|
|
48
|
+
"www/",
|
|
49
|
+
"io-package.json",
|
|
50
|
+
"LICENSE",
|
|
51
|
+
"main.js"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
55
|
+
"test:package": "mocha test/package --exit",
|
|
56
|
+
"test:integration": "mocha test/integration --exit",
|
|
57
|
+
"test": "npm run test:js && npm run test:package",
|
|
58
|
+
"check": "tsc --noEmit -p tsconfig.check.json",
|
|
59
|
+
"lint": "eslint -c eslint.config.mjs .",
|
|
60
|
+
"translate": "translate-adapter",
|
|
61
|
+
"release": "release-script",
|
|
62
|
+
"dev-server": "dev-server"
|
|
63
|
+
},
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/SpongeTroN/ioBroker.sma-echarger/issues"
|
|
66
|
+
},
|
|
67
|
+
"readmeFilename": "README.md"
|
|
68
|
+
}
|