iobroker.sbfspot 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/io-package.json +16 -16
- package/package.json +10 -10
- package/lib/tools.js +0 -101
package/README.md
CHANGED
|
@@ -65,6 +65,9 @@ sometimes npm intall must be called more then one time to successfully install a
|
|
|
65
65
|
Placeholder for the next version (at the beginning of the line):
|
|
66
66
|
### **WORK IN PROGRESS**
|
|
67
67
|
-->
|
|
68
|
+
### 5.0.2 (2025-10-04)
|
|
69
|
+
(René) update dependencies + changes based on adapter checker
|
|
70
|
+
|
|
68
71
|
### 5.0.1 (2025-06-29)
|
|
69
72
|
* (René) new testing
|
|
70
73
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "sbfspot",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"5.0.2": {
|
|
7
|
+
"en": "(René) update dependencies + changes based on adapter checker",
|
|
8
|
+
"de": "(René) aktualisieren Abhängigkeiten + Änderungen basierend auf Adapter-Checker",
|
|
9
|
+
"ru": "Зависимости обновления + изменения на основе проверки адаптера",
|
|
10
|
+
"pt": "(René) atualizar dependências + alterações com base no verificador do adaptador",
|
|
11
|
+
"nl": "(René) update afhankelijkheden + wijzigingen op basis van adaptercontrole",
|
|
12
|
+
"fr": "(René) mettre à jour les dépendances + les changements basés sur adaptateur checker",
|
|
13
|
+
"it": "(René) aggiornamento dipendenze + modifiche in base all'adattatore checker",
|
|
14
|
+
"es": "(René) dependencias de actualización + cambios basados en el control de adaptador",
|
|
15
|
+
"pl": "(René) update dependences + changes based on adapter checker",
|
|
16
|
+
"uk": "(René) оновлення залежності + зміни на основі перевірки адаптера",
|
|
17
|
+
"zh-cn": "(René) 基于适配器检查器更新依赖性+变化"
|
|
18
|
+
},
|
|
6
19
|
"5.0.1": {
|
|
7
20
|
"en": "new testing",
|
|
8
21
|
"de": "neue tests",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "zob. numer # 417: test z nodejs @ 22\nwydanie # 435: zainstalować widżety ponownie",
|
|
81
94
|
"uk": "переглянути номер #417: тест з nodejs@22\nproblem #435: встановити віджети знову",
|
|
82
95
|
"zh-cn": "参见第417期:带节点的测试@22\n第435期: 再次安装部件"
|
|
83
|
-
},
|
|
84
|
-
"4.3.4": {
|
|
85
|
-
"en": "update dependencies\nbug fixes based on adapter checker recommendation",
|
|
86
|
-
"de": "aktualisierung der abhängigkeiten\nfehlerbehebungen basierend auf adapter-checker empfehlung",
|
|
87
|
-
"ru": "обновление зависимостей\nисправления ошибок на основе рекомендации адаптера",
|
|
88
|
-
"pt": "dependências\ncorreções de bugs com base na recomendação do verificador do adaptador",
|
|
89
|
-
"nl": "afhankelijkheden bijwerken\nbug fixes op basis van adaptercontrole aanbeveling",
|
|
90
|
-
"fr": "mettre à jour les dépendances\ncorrection des bugs en fonction de la recommandation du vérificateur d'adaptateur",
|
|
91
|
-
"it": "aggiornamento dipendenze\ncorrezioni di bug in base alla raccomandazione dell'adattatore checker",
|
|
92
|
-
"es": "dependencias de actualización\ncorrecciones de errores basado en la recomendación de control de adaptador",
|
|
93
|
-
"pl": "aktualizacji zależności\npoprawki błędów oparte na rekomendacji sprawdzania adaptera",
|
|
94
|
-
"uk": "оновлення залежності\nвиправлення помилок на основі рекомендації адаптера",
|
|
95
|
-
"zh-cn": "更新依赖关系\n根据适配器检查器建议修正错误"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -142,12 +142,12 @@
|
|
|
142
142
|
},
|
|
143
143
|
"dependencies": [
|
|
144
144
|
{
|
|
145
|
-
"js-controller": ">=
|
|
145
|
+
"js-controller": ">=6.0.11"
|
|
146
146
|
}
|
|
147
147
|
],
|
|
148
148
|
"globalDependencies": [
|
|
149
149
|
{
|
|
150
|
-
"admin": ">=7.
|
|
150
|
+
"admin": ">=7.6.17"
|
|
151
151
|
}
|
|
152
152
|
],
|
|
153
153
|
"plugins": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.sbfspot",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "sbfspot (SMA inverter) Adapter",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "René G.",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"node": ">= 20"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@iobroker/adapter-core": "^3.2
|
|
25
|
-
"axios": "^1.
|
|
26
|
-
"better-sqlite3": "^12.
|
|
27
|
-
"mysql2": "^3.
|
|
24
|
+
"@iobroker/adapter-core": "^3.3.2",
|
|
25
|
+
"axios": "^1.12.2",
|
|
26
|
+
"better-sqlite3": "^12.4.1",
|
|
27
|
+
"mysql2": "^3.15.1",
|
|
28
28
|
"suncalc2": "^1.8.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
|
|
33
33
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
34
34
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
35
|
-
"@iobroker/adapter-dev": "^1.
|
|
36
|
-
"@iobroker/eslint-config": "^2.0
|
|
37
|
-
"@iobroker/testing": "^5.
|
|
38
|
-
"chai": "^
|
|
39
|
-
"mocha": "^11.7.
|
|
35
|
+
"@iobroker/adapter-dev": "^1.5.0",
|
|
36
|
+
"@iobroker/eslint-config": "^2.2.0",
|
|
37
|
+
"@iobroker/testing": "^5.1.1",
|
|
38
|
+
"chai": "^6.2.0",
|
|
39
|
+
"mocha": "^11.7.4"
|
|
40
40
|
},
|
|
41
41
|
"main": "main.js",
|
|
42
42
|
"bugs": {
|
package/lib/tools.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const axios = require('axios').default;
|
|
2
|
-
|
|
3
|
-
//Tests whether the given variable is a real object and not an Array
|
|
4
|
-
/**
|
|
5
|
-
* @param {any} it The variable to test
|
|
6
|
-
* @returns {it is Record<string, any>}
|
|
7
|
-
*/
|
|
8
|
-
function isObject(it) {
|
|
9
|
-
// This is necessary because:
|
|
10
|
-
// typeof null === 'object'
|
|
11
|
-
// typeof [] === 'object'
|
|
12
|
-
// [] instanceof Object === true
|
|
13
|
-
return Object.prototype.toString.call(it) === '[object Object]';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//Tests whether the given variable is really an Array
|
|
17
|
-
/**
|
|
18
|
-
* @param {any} it The variable to test
|
|
19
|
-
* @returns {it is any[]}
|
|
20
|
-
*/
|
|
21
|
-
function isArray(it) {
|
|
22
|
-
if (typeof Array.isArray === 'function') {
|
|
23
|
-
return Array.isArray(it);
|
|
24
|
-
}
|
|
25
|
-
return Object.prototype.toString.call(it) === '[object Array]';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//Translates text to the target language. Automatically chooses the right translation API.
|
|
29
|
-
/**
|
|
30
|
-
* @param {string} text The text to translate
|
|
31
|
-
* @param {string} targetLang The target languate
|
|
32
|
-
* @param {string} [yandexApiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
|
|
33
|
-
* @returns {Promise<string>}
|
|
34
|
-
*/
|
|
35
|
-
async function translateText(text, targetLang, yandexApiKey) {
|
|
36
|
-
if (targetLang === 'en') {
|
|
37
|
-
return text;
|
|
38
|
-
} else if (!text) {
|
|
39
|
-
return '';
|
|
40
|
-
}
|
|
41
|
-
if (yandexApiKey) {
|
|
42
|
-
return translateYandex(text, targetLang, yandexApiKey);
|
|
43
|
-
} else {
|
|
44
|
-
return translateGoogle(text, targetLang);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//Translates text with Yandex API
|
|
49
|
-
/**
|
|
50
|
-
* @param {string} text The text to translate
|
|
51
|
-
* @param {string} targetLang The target languate
|
|
52
|
-
* @param {string} apiKey The yandex API key. You can create one for free at https://translate.yandex.com/developers
|
|
53
|
-
* @returns {Promise<string>}
|
|
54
|
-
*/
|
|
55
|
-
async function translateYandex(text, targetLang, apiKey) {
|
|
56
|
-
if (targetLang === 'zh-cn') {
|
|
57
|
-
targetLang = 'zh';
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${apiKey}&text=${encodeURIComponent(text)}&lang=en-${targetLang}`;
|
|
61
|
-
const response = await axios({ url, timeout: 15000 });
|
|
62
|
-
if (response.data && response.data.text && isArray(response.data.text)) {
|
|
63
|
-
return response.data.text[0];
|
|
64
|
-
}
|
|
65
|
-
throw new Error('Invalid response for translate request');
|
|
66
|
-
} catch (e) {
|
|
67
|
-
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
//Translates text with Google API
|
|
72
|
-
/**
|
|
73
|
-
* @param {string} text The text to translate
|
|
74
|
-
* @param {string} targetLang The target languate
|
|
75
|
-
* @returns {Promise<string>}
|
|
76
|
-
*/
|
|
77
|
-
async function translateGoogle(text, targetLang) {
|
|
78
|
-
try {
|
|
79
|
-
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
|
|
80
|
-
const response = await axios({ url, timeout: 15000 });
|
|
81
|
-
if (isArray(response.data)) {
|
|
82
|
-
// we got a valid response
|
|
83
|
-
return response.data[0][0][0];
|
|
84
|
-
}
|
|
85
|
-
throw new Error('Invalid response for translate request');
|
|
86
|
-
} catch (e) {
|
|
87
|
-
if (e.response && e.response.status === 429) {
|
|
88
|
-
throw new Error(
|
|
89
|
-
`Could not translate to "${targetLang}": Rate-limited by Google Translate`
|
|
90
|
-
);
|
|
91
|
-
} else {
|
|
92
|
-
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
module.exports = {
|
|
98
|
-
isArray,
|
|
99
|
-
isObject,
|
|
100
|
-
translateText
|
|
101
|
-
};
|