iobroker.ebus 3.6.7 → 3.6.8
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 -3
- package/package.json +7 -7
- package/lib/tools.js +0 -101
package/README.md
CHANGED
|
@@ -76,6 +76,9 @@ in /opt/iobroker/node_modules/iobroker.ebus/lib/scripts you can find a scripts t
|
|
|
76
76
|
Placeholder for the next version (at the beginning of the line):
|
|
77
77
|
### **WORK IN PROGRESS**
|
|
78
78
|
-->
|
|
79
|
+
### 3.6.8 (2025-10-04)
|
|
80
|
+
* (René) update dependencies + changes based on adapter checker
|
|
81
|
+
|
|
79
82
|
### 3.6.7 (2025-09-06)
|
|
80
83
|
* (René) dependencies updated and bug fix based on adapter checker
|
|
81
84
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "ebus",
|
|
4
|
-
"version": "3.6.
|
|
4
|
+
"version": "3.6.8",
|
|
5
5
|
"news": {
|
|
6
|
+
"3.6.8": {
|
|
7
|
+
"en": "update dependencies + changes based on adapter checker",
|
|
8
|
+
"de": "aktualisierung abhängigkeiten + änderungen basierend auf adapter-checker",
|
|
9
|
+
"ru": "зависимости обновления + изменения на основе проверки адаптера",
|
|
10
|
+
"pt": "atualizar dependências + alterações com base no verificador de adaptadores",
|
|
11
|
+
"nl": "update afhankelijkheden + wijzigingen op basis van adaptercontrole",
|
|
12
|
+
"fr": "mettre à jour les dépendances + les changements basés sur le vérificateur d'adaptateur",
|
|
13
|
+
"it": "aggiornamento dipendenze + modifiche in base all'adattatore checker",
|
|
14
|
+
"es": "dependencias de actualización + cambios basados en el control de adaptador",
|
|
15
|
+
"pl": "aktualizacja zależności + zmiany w oparciu o sprawdzacz adaptera",
|
|
16
|
+
"uk": "оновлення залежності + зміни на основі перевірки адаптера",
|
|
17
|
+
"zh-cn": "根据适配器检查器更新依赖性+变化"
|
|
18
|
+
},
|
|
6
19
|
"3.6.7": {
|
|
7
20
|
"en": "dependencies updated and bug fix based on adapter checker",
|
|
8
21
|
"de": "abhängigkeiten aktualisiert und fehler beheben basierend auf adapter checker",
|
|
@@ -128,12 +141,12 @@
|
|
|
128
141
|
},
|
|
129
142
|
"dependencies": [
|
|
130
143
|
{
|
|
131
|
-
"js-controller": ">=
|
|
144
|
+
"js-controller": ">=6.0.11"
|
|
132
145
|
}
|
|
133
146
|
],
|
|
134
147
|
"globalDependencies": [
|
|
135
148
|
{
|
|
136
|
-
"admin": ">=7.
|
|
149
|
+
"admin": ">=7.6.17"
|
|
137
150
|
}
|
|
138
151
|
],
|
|
139
152
|
"plugins": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.ebus",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.8",
|
|
4
4
|
"description": "ioBroker ebus Adapter",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "René G.",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@iobroker/adapter-core": "^3.3.2",
|
|
27
|
-
"axios": "^1.
|
|
27
|
+
"axios": "^1.12.2",
|
|
28
28
|
"net": "^1.0.2",
|
|
29
29
|
"promise-socket": "^8.0.0"
|
|
30
30
|
},
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@alcalzone/release-script-plugin-iobroker": "^3.7.2",
|
|
34
34
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
35
35
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
36
|
-
"@iobroker/adapter-dev": "^1.
|
|
37
|
-
"@iobroker/eslint-config": "^2.0
|
|
38
|
-
"@iobroker/testing": "^5.
|
|
39
|
-
"chai": "^6.0
|
|
40
|
-
"mocha": "^11.7.
|
|
36
|
+
"@iobroker/adapter-dev": "^1.5.0",
|
|
37
|
+
"@iobroker/eslint-config": "^2.2.0",
|
|
38
|
+
"@iobroker/testing": "^5.1.1",
|
|
39
|
+
"chai": "^6.2.0",
|
|
40
|
+
"mocha": "^11.7.4"
|
|
41
41
|
},
|
|
42
42
|
"main": "main.js",
|
|
43
43
|
"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
|
-
};
|