iobroker.fronius-wattpilot
Advanced tools
Comparing version 4.6.2 to 4.6.3
{ | ||
"common": { | ||
"name": "fronius-wattpilot", | ||
"version": "4.6.2", | ||
"version": "4.6.3", | ||
"news": { | ||
"4.6.3": { | ||
"en": "Fixed a bug where the adapter would use a undefined variable\nFixed bug #44\nFixed bug #43", | ||
"de": "Fehler behoben, bei dem der Adapter eine undefinierte Variable verwenden würde\nFehler behoben #44\nFehler behoben #43", | ||
"ru": "Исправлена ошибка, где адаптер будет использовать неопределенную переменную\nИсправлена ошибка #44\nИсправлена ошибка #43", | ||
"pt": "Corrigido um bug onde o adaptador usaria uma variável indefinida\nCorrigido o erro #44\nCorrigido o erro #43", | ||
"nl": "Een insect waar de ontvoerder een onbepaalde variabele\nQuality over Quantity (QoQ) Releases Vertaling:\nQuality over Quantity (QoQ) Releases Vertaling:", | ||
"fr": "Correction d'un bug où l'adaptateur utiliserait une variable undefined\nCorrection du bug #44\nCorrection du bug #43", | ||
"it": "Risolto un bug in cui l'adattatore avrebbe usato una variabile non definita\nCorretto bug #44\nCorretto bug #43", | ||
"es": "Arreglado un fallo donde el adaptador utilizaría una variable indefinida\nError fijo #44\nError fijo #43", | ||
"pl": "Błękitnym błędem, w którym adapter użył nie określonej zmiennej\nFixed bug #44 (ang.)\nFixed bug #43 (ang.)", | ||
"uk": "Виправлено помилку, де адаптер використовуватиме не визначену змінну\nВиправлена помилка #44\nВиправлена помилка #43", | ||
"zh-cn": "确定一个配制,使适应者使用一个未界定的变量。\n九. 固定的乙ug #44\n九、导 言.. 43" | ||
}, | ||
"4.6.2": { | ||
@@ -83,15 +96,2 @@ "en": "Thanks to Norb1204 for fixing a few bugs that I missed. More in Issue #40", | ||
"zh-cn": "已知国家现在将得到更新,即使有活力的序号得以更新。" | ||
}, | ||
"4.3.0": { | ||
"en": "dependency updates\nstate updates", | ||
"de": "abhängigkeitsaktualisierung\nzustandsänderungen", | ||
"ru": "обновления зависимости\nгосударственные обновления", | ||
"pt": "atualizações de dependência\natualizações do estado", | ||
"nl": "afhankelijke updates\nvertaling:", | ||
"fr": "mises à jour de la dépendance\nmises à jour de l ' état", | ||
"it": "aggiornamenti di dipendenza\naggiornamenti di stato", | ||
"es": "actualizaciones de la dependencia\nactualizaciones estatales", | ||
"pl": "aktualizacja\naktualizacja stanu", | ||
"uk": "оновлення залежності\nоновлення стану", | ||
"zh-cn": "依赖性最新资料\n国家最新资料" | ||
} | ||
@@ -98,0 +98,0 @@ }, |
323
main.js
@@ -47,3 +47,3 @@ "use strict"; | ||
if (this.config["cloud"]) { | ||
hostToConnect = "ws://app.wattpilot.io/app/" + this.config["serial-number"] + "?version=1.2.9"; | ||
hostToConnect = "wss://app.wattpilot.io/app/" + this.config["serial-number"] + "?version=1.2.9"; | ||
} else { | ||
@@ -320,7 +320,3 @@ hostToConnect = "ws://" + this.config["ip-host"] + "/ws"; | ||
timeout["alw"] = Date.now(); | ||
if (data2["status"][dataKeyToParse] === 0) { | ||
await adapter.setStateAsync("AllowCharging", { val: false, ack: true }); | ||
} else if (data2["status"][dataKeyToParse] === 1) { | ||
await adapter.setStateAsync("AllowCharging", { val: true, ack: true }); | ||
} | ||
await adapter.setStateAsync("AllowCharging", { val: data2["status"][dataKeyToParse], ack: true }); | ||
} | ||
@@ -659,7 +655,3 @@ break; | ||
if (data2["status"][dataKeyToParse] === 0) { | ||
await adapter.setStateAsync("AllowCharging", { val: false, ack: true }); | ||
} else if (data2["status"][dataKeyToParse] === 1) { | ||
await adapter.setStateAsync("AllowCharging", { val: true, ack: true }); | ||
} | ||
await adapter.setStateAsync("AllowCharging", { val: data2["status"][dataKeyToParse], ack: true }); | ||
break; | ||
@@ -898,171 +890,186 @@ | ||
if (state.val) { | ||
// @ts-ignore | ||
if (!state.val.includes(";")) { | ||
this.log.error("Wrong Value"); | ||
return; | ||
} | ||
stateValue = state.val.toString().split(";"); | ||
let sendData = {}; | ||
if (stateValue[1] === "true") { | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": true | ||
if (hashedPass !== undefined) { | ||
// @ts-ignore | ||
if (!state.val.includes(";")) { | ||
this.log.error("Wrong Value"); | ||
return; | ||
} | ||
stateValue = state.val.toString().split(";"); | ||
let sendData = {}; | ||
if (stateValue[1] === "true") { | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": true | ||
}; | ||
} else if (stateValue[1] === "false") { | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": false | ||
}; | ||
} else { // should also be checked against floats and stings, but I currently don't know how to do it | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": parseInt(stateValue[1]) | ||
}; | ||
} | ||
// @ts-ignore | ||
const data = JSON.stringify(sendData); | ||
const tf = createHmac("sha256", hashedPass).update(data).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": data, | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf | ||
}; | ||
} else if (stateValue[1] === "false") { | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": false | ||
}; | ||
} else { // should also be checked against floats and stings, but I currently don't know how to do it | ||
sendData = { | ||
"type": "setValue", | ||
"requestId": counter, | ||
"key": stateValue[0], | ||
"value": parseInt(stateValue[1]) | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} else { | ||
this.log.error("Wrong Value"); | ||
} | ||
} else if (id.includes("amp")) { | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const data = JSON.stringify(sendData); | ||
const tf = createHmac("sha256", hashedPass).update(data).digest("hex"); | ||
const json = {"type": "setValue", "requestId": counter, "key": "amp", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(json)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": data, | ||
"data": JSON.stringify(json), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} else { | ||
this.log.error("Wrong Value"); | ||
} | ||
} else if (id.includes("amp")) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const json = {"type": "setValue", "requestId": counter, "key": "amp", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(json)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(json), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} else if (id.includes("cae")) { | ||
counter = counter + 1; | ||
let ok = false; | ||
if (state.val !== null) { | ||
if (typeof state.val === "boolean") { | ||
ok = true; | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
let ok = false; | ||
if (state.val !== null) { | ||
if (typeof state.val === "boolean") { | ||
ok = true; | ||
} | ||
if (ok) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "cae", "value": state.val}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
if (ok) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "cae", "value": state.val}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
} else if (id.includes("AccessState")) { | ||
counter = counter + 1; | ||
let mode = 42; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("open")) { | ||
mode = 0; | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
let mode = 42; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("open")) { | ||
mode = 0; | ||
} | ||
if (state.val.toString().toLowerCase().includes("wait")) { | ||
mode = 1; | ||
} | ||
if (mode !== 42) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "acs", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
if (state.val.toString().toLowerCase().includes("wait")) { | ||
mode = 1; | ||
} | ||
if (mode !== 42) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "acs", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
} else if (id.includes("cableLock")) { | ||
counter = counter + 1; | ||
let mode = 42; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("normal")) { | ||
mode = 0; | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
let mode = 42; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("normal")) { | ||
mode = 0; | ||
} | ||
if (state.val.toString().toLowerCase().includes("autounlock")) { | ||
mode = 1; | ||
} | ||
if (state.val.toString().toLowerCase().includes("alwayslock")) { | ||
mode = 2; | ||
} | ||
if (mode !== 42) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "ust", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
if (state.val.toString().toLowerCase().includes("autounlock")) { | ||
mode = 1; | ||
} | ||
if (state.val.toString().toLowerCase().includes("alwayslock")) { | ||
mode = 2; | ||
} | ||
if (mode !== 42) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "ust", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
} else if (id.includes("set_power")) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const json = {"type": "setValue", "requestId": counter, "key": "amp", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(json)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(json), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const json = {"type": "setValue", "requestId": counter, "key": "amp", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(json)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(json), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} else if (id.includes("set_mode")) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "lmo", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
// @ts-ignore | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "lmo", "value": parseInt(state.val)}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} else if (id.includes("mode")) { | ||
counter = counter + 1; | ||
let mode = 0; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("eco")) { | ||
mode = 4; | ||
if (hashedPass !== undefined) { | ||
counter = counter + 1; | ||
let mode = 0; | ||
if (state.val !== null) { | ||
if (state.val.toString().toLowerCase().includes("eco")) { | ||
mode = 4; | ||
} | ||
if (state.val.toString().toLowerCase().includes("next trip")) { | ||
mode = 5; | ||
} | ||
if (state.val.toString().toLowerCase().includes("default")) { | ||
mode = 3; | ||
} | ||
if (mode !== 0) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "lmo", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
if (state.val.toString().toLowerCase().includes("next trip")) { | ||
mode = 5; | ||
} | ||
if (state.val.toString().toLowerCase().includes("default")) { | ||
mode = 3; | ||
} | ||
if (mode !== 0) { | ||
const sendData = {"type": "setValue", "requestId": counter, "key": "lmo", "value": mode}; | ||
const tf = createHmac("sha256", hashedPass).update(JSON.stringify(sendData)).digest("hex"); | ||
const sendDataToSource = { | ||
"type": "securedMsg", | ||
"data": JSON.stringify(sendData), | ||
"requestId": counter.toString() + "sm", | ||
"hmac": tf.toString() | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} | ||
} | ||
@@ -1069,0 +1076,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"name": "iobroker.fronius-wattpilot", | ||
"version": "4.6.2", | ||
"version": "4.6.3", | ||
"description": "fronius-wattpilot", | ||
@@ -30,2 +30,5 @@ "author": { | ||
], | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"repository": { | ||
@@ -37,3 +40,3 @@ "type": "git", | ||
"@iobroker/adapter-core": "^2.6.8", | ||
"ws": "^8.13.0" | ||
"ws": "^8.14.0" | ||
}, | ||
@@ -40,0 +43,0 @@ "devDependencies": { |
@@ -78,2 +78,7 @@ ![Logo](admin/fronius-wattpilot.png) | ||
--> | ||
### 4.6.3 (2023-12-24) | ||
- Fixed a bug where the adapter would use a undefined variable | ||
- Fixed bug #44 | ||
- Fixed bug #43 | ||
### 4.6.2 (2023-08-15) | ||
@@ -80,0 +85,0 @@ - Thanks to Norb1204 for fixing a few bugs that I missed. More in Issue #40 |
150513
1170
246
+ Added@types/node@20.12.11(transitive)
- Removed@types/node@20.12.12(transitive)
Updatedws@^8.14.0