Skip to content

Commit

Permalink
chore: release v1.14.34
Browse files Browse the repository at this point in the history
use async rpc calls for better error handling
now log error events received by XML-RPC
detect invalid params and log instead of crash
  • Loading branch information
foxriver76 committed Feb 11, 2021
1 parent def5e88 commit 0092f94
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ by ioBroker, when you have a running 'dummy' program on the CCU which depends on
### __WORK IN PROGRESS__
-->

### __WORK IN PROGRESS__
### 1.14.34 (2021-02-11)
* (foxriver76) use async rpc calls for better error handling
* (foxriver76) now log error events received by XML-RPC
* (foxriver76) detect invalid params and log instead of crash

### 1.14.33 (2021-01-30)
* (foxriver76) fix problems with CuxD and HMIP (fixes #307)
Expand Down
26 changes: 13 additions & 13 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,20 @@
"es": "Conecta los Procesos de Interfaz HomeMatic (BidCos-Services, Homegear y CUxD) a través de XML-RPC o BIN-RPC a ioBroker",
"pl": "Łączy procesy HomeMatic-Interface (BidCos-Services, Homegear i CUxD) za pośrednictwem XML-RPC lub BIN-RPC z ioBroker"
},
"version": "1.14.33",
"version": "1.14.34",
"news": {
"1.14.34": {
"en": "use async rpc calls for better error handling\nnow log error events received by XML-RPC\ndetect invalid params and log instead of crash",
"de": "Verwenden Sie asynchrone RPC-Aufrufe für eine bessere Fehlerbehandlung\nProtokollieren Sie jetzt von XML-RPC empfangene Fehlerereignisse\nErkennen Sie ungültige Parameter und protokollieren Sie anstelle eines Absturzes",
"ru": "используйте вызовы async rpc для лучшей обработки ошибок\nтеперь записывать события ошибок, полученные XML-RPC\nобнаруживать недопустимые параметры и регистрировать вместо сбоя",
"pt": "use chamadas rpc assíncronas para melhor tratamento de erros\nagora registra eventos de erro recebidos por XML-RPC\ndetectar parâmetros inválidos e registrar em vez de travar",
"nl": "gebruik asynchrone rpc-oproepen voor betere foutafhandeling\nlog nu foutgebeurtenissen die zijn ontvangen door XML-RPC\ndetecteren ongeldige parameters en log in plaats van crash",
"fr": "utiliser les appels async rpc pour une meilleure gestion des erreurs\nenregistre maintenant les événements d'erreur reçus par XML-RPC\ndétecter les paramètres invalides et enregistrer au lieu de planter",
"it": "usa chiamate rpc asincrone per una migliore gestione degli errori\nora registra gli eventi di errore ricevuti da XML-RPC\nrileva parametri e log non validi invece di crash",
"es": "use llamadas async rpc para un mejor manejo de errores\nahora registra los eventos de error recibidos por XML-RPC\ndetectar parámetros inválidos y registrar en lugar de fallar",
"pl": "użyj asynchronicznych wywołań RPC dla lepszej obsługi błędów\nteraz rejestruj zdarzenia błędów odebrane przez XML-RPC\nwykrywa nieprawidłowe parametry i rejestruje zamiast awarii",
"zh-cn": "使用异步rpc调用以更好地处理错误\n现在记录XML-RPC收到的错误事件\n检测无效的参数并记录而不是崩溃"
},
"1.14.33": {
"en": "fix problems with CuxD and HMIP (fixes #307)\nmore palces where we now log message on real errors instead of error object",
"de": "Beheben Sie Probleme mit CuxD und HMIP (behebt # 307)\nWeitere Palces, in denen wir jetzt Nachrichten über echte Fehler anstelle von Fehlerobjekten protokollieren",
Expand Down Expand Up @@ -242,18 +254,6 @@
"es": "eliminó completamente el almacenamiento en caché de metadatos porque los metadatos pueden ser dinámicos debido a la actualización de FW o CuxD",
"pl": "całkowicie usunięto buforowanie metadanych, ponieważ metadane mogą być dynamiczne z powodu aktualizacji FW lub CuxD",
"zh-cn": "完全删除了元数据缓存,因为由于固件更新或CuxD,元数据可以是动态的"
},
"1.14.6": {
"en": "added some hmip roles for channel 0",
"de": "Einige hmip-Rollen für Kanal 0 wurden hinzugefügt",
"ru": "добавлены некоторые роли hmip для канала 0",
"pt": "adicionou algumas funções hmip para o canal 0",
"nl": "enkele hmip-rollen toegevoegd voor kanaal 0",
"fr": "ajout de quelques rôles hmip pour le canal 0",
"it": "aggiunti alcuni ruoli hmip per il canale 0",
"es": "se agregaron algunos roles hmip para el canal 0",
"pl": "dodano kilka ról hmip dla kanału 0",
"zh-cn": "为频道0添加了一些hmip角色"
}
},
"authors": [
Expand Down
29 changes: 20 additions & 9 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,22 @@ async function readSettings(id) {
controlEPaper(id, data);
} // endReadSettings

// the adapter object

function startAdapter(options) {
options = options || {};

Object.assign(options, {

name: adapterName,
error: e => {
if (e.code === 'EADDRNOTAVAIL') {
adapter.log.error(`Address ${adapter.config.adapterAddress} not available, maybe your HOST IP has changed due to migration`);
// doesn't work in that case, so let it correctly be handled by controller at least we can log
// return true;
}

// don't now how to handle so let it burn ;-)
return false;
},
ready: () => {
adapter.subscribeStates('*');
main();
Expand Down Expand Up @@ -869,6 +876,7 @@ async function initRpcServer() {
daemonURL = `${daemonProto + callbackAddress}:${port}`;

try {
// somehow we cannot catch EADDRNOTAVAIL, also not with a cb here
rpcServer = rpc.createServer({
host: adapter.config.adapterAddress,
port: port
Expand Down Expand Up @@ -1104,6 +1112,16 @@ async function initRpcServer() {
const methods = {

event: (err, params) => {
if (err) {
adapter.log.error(`${adapter.config.type}rpc <- received error event: ${err}`);
return '';
}

if (!Array.isArray(params)) {
adapter.log.error(`${adapter.config.type}rpc <- Invalid params "${params}" received`);
return '';
}

adapter.log.debug(`${adapter.config.type}rpc <- event ${JSON.stringify(params)}`);
let val;
// CUxD ignores all prefixes!!
Expand All @@ -1117,13 +1135,6 @@ const methods = {
}
const name = `${params[0]}.${channel}.${params[2]}`;

/* now handled below
if (name === `${adapter.namespace}.CENTRAL.PONG` || name ===`${adapter.namespace}.CENTRAL.0.PONG`) {
adapter.log.debug('PONG event received, ignoring');
return '';
}
*/

if (dpTypes[name]) {
// it shouldn't be necessary to scale on % values, see https://github.com/ioBroker/ioBroker.hm-rpc/issues/263
// backward compatibility -> max===1 unit===%
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.hm-rpc",
"version": "1.14.33",
"version": "1.14.34",
"description": "Connects HomeMatic Interface-Processes (BidCos-Services, Homegear and CUxD) via XML-RPC or BIN-RPC to ioBroker",
"author": {
"name": "hobbyquaker",
Expand Down

0 comments on commit 0092f94

Please sign in to comment.