iobroker.fronius-wattpilot
Advanced tools
Comparing version 4.1.0 to 4.2.0
{ | ||
"common": { | ||
"name": "fronius-wattpilot", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"news": { | ||
"4.2.0": { | ||
"en": "Some QoL improvements", | ||
"de": "Einige QoL Verbesserungen", | ||
"ru": "Некоторые улучшения QoL", | ||
"pt": "Algumas melhorias de QoL", | ||
"nl": "Wat QoL verbetering", | ||
"fr": "Quelques améliorations QoL", | ||
"it": "Alcuni miglioramenti QoL", | ||
"es": "Algunas mejoras de QoL", | ||
"pl": "Niektóre poprawy QoL", | ||
"uk": "Деякі покращення QoL", | ||
"zh-cn": "B. 改进" | ||
}, | ||
"4.1.0": { | ||
@@ -82,14 +95,2 @@ "en": "Added the possibility to add states manually via the instance-settings\nFixed the bug where the adapter didn't set the correct value types\nAdded some quality of life improvements", | ||
"zh-cn": "正常价值的冷冻时间" | ||
}, | ||
"3.2.3": { | ||
"en": "Bug fixed where the adapter would not respect the timout timer and would try to constantly reconnect to the WattPilot\nBug fixed where the adapter would send a wrong disconnect message to the WattPilot", | ||
"de": "Fehler behoben, wo der Adapter den Timout-Timer nicht respektieren würde und versuchen würde, ständig wieder mit dem WattPilot zu verbinden\nFehler behoben, wo der Adapter eine falsche Trennmeldung an den WattPilot senden würde", | ||
"ru": "Баг зафиксировал, где адаптер не будет уважать таймер timout и попытался бы постоянно переподключиться к WattPilot\nБаг исправил, где адаптер отправит неправильный отключение сообщения в WattPilot", | ||
"pt": "Bug corrigido onde o adaptador não respeita o temporizador de timout e tentaria constantemente reconectar-se ao WattPilot\nBug corrigido onde o adaptador enviaria uma mensagem de desconexão errada para o WattPilot", | ||
"nl": "Bug herstelde waar de adapter de timout timer niet zou respecteren en probeerde constant contact te maken met de WattPilot\nBug heeft gerepareerd waar de adapter een verkeerd afgesloten bericht zou sturen naar de WattPilot", | ||
"fr": "Correction de bug où l'adaptateur ne respecterait pas le minuteur de timout et essayerait de se connecter constamment au WattPilot\nBug corrigé où l'adaptateur envoie un mauvais message de déconnexion au WattPilot", | ||
"it": "Bug fisso dove l'adattatore non avrebbe rispettato il timer di timout e cercherebbe di ricollegare costantemente al WattPilot\nBug fisso dove l'adattatore invierebbe un messaggio di disconnessione sbagliato al WattPilot", | ||
"es": "Error fijo donde el adaptador no respetaría el temporizador de timout y trataría de reconectarse constantemente con el WattPilot\nError fijo donde el adaptador enviaría un mensaje de desconexión equivocado al WattPilot", | ||
"pl": "Bug ustał, gdzie adapter nie szanuje czasownika i próbował stale rekonekstować się z WattPilotem\nBug ustał, gdzie adapter wysyła nieodłączną wiadomość do WattPilot", | ||
"zh-cn": "如果适应者不尊重受害者时间,将设法与WattPilot公司保持持续的联系\n如果适应者将向WattPilot发出错误的不相容信息,则确定其固定地点。" | ||
} | ||
@@ -96,0 +97,0 @@ }, |
118
main.js
@@ -96,8 +96,12 @@ "use strict"; | ||
if (messageData["type"] === "response") { | ||
if (messageData["status"]["amp"] !== undefined) { | ||
adapter.setState("set_power", messageData["status"]["amp"], true); | ||
} else if (messageData["status"]["lmo"] !== undefined) { | ||
adapter.setState("set_mode", messageData["status"]["mode"], true); | ||
if (messageData["success"]) { | ||
if (messageData["status"]["amp"] !== undefined) { | ||
adapter.setState("set_power", messageData["status"]["amp"], true); | ||
} else if (messageData["status"]["lmo"] !== undefined) { | ||
adapter.setState("set_mode", messageData["status"]["mode"], true); | ||
} else { | ||
adapter.setState("set_state", true, true); | ||
} | ||
} else { | ||
adapter.setState("set_state", true, true); | ||
logger.error("Error on setting value: " + messageData["message"]); | ||
} | ||
@@ -827,52 +831,78 @@ } else if (messageData["type"] === "hello") { // Handle Hello Message | ||
onStateChange(id, state) { | ||
if (state) { | ||
if (state.ack === false) { | ||
if (id.includes("set_state")) { | ||
this.log.info(adapter.counter); | ||
counter = counter + 1; | ||
let stateValue; | ||
if (state.val === undefined) { | ||
if (state && state.ack === false) { | ||
if (id.includes("set_state")) { | ||
this.log.info(adapter.counter); | ||
counter = counter + 1; | ||
let stateValue; | ||
if (state.val === undefined) { | ||
this.log.error("Wrong Value"); | ||
} | ||
if (state.val) { | ||
// @ts-ignore | ||
if (!state.val.includes(";")) { | ||
this.log.error("Wrong Value"); | ||
return; | ||
} | ||
if (state.val) { | ||
// @ts-ignore | ||
if (!state.val.includes(";")) { | ||
this.log.error("Wrong Value"); | ||
return; | ||
} | ||
stateValue = state.val.toString().split(";"); | ||
const sendData = { | ||
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 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 { | ||
this.log.error("Wrong Value"); | ||
} | ||
} 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() }; | ||
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 | ||
}; | ||
ws.send(JSON.stringify(sendDataToSource)); | ||
} else { | ||
this.log.error("Wrong Value"); | ||
} | ||
} 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)); | ||
} 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)); | ||
} | ||
} 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)); | ||
} | ||
@@ -879,0 +909,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"name": "iobroker.fronius-wattpilot", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "fronius-wattpilot", | ||
@@ -9,0 +9,0 @@ "author": { |
@@ -79,2 +79,5 @@ ![Logo](admin/fronius-wattpilot.png) | ||
--> | ||
### 4.2.0 (2023-01-01) | ||
- Some QoL improvements | ||
### 4.1.0 (2022-12-30) | ||
@@ -81,0 +84,0 @@ - Added the possibility to add states manually via the instance-settings |
Sorry, the diff of this file is not supported yet
990
213
137280