* (Apollon77) make sure a "null" value in state changes is not crashing
This commit is contained in:
@@ -56,7 +56,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x, 14.x, 16.x]
|
||||
node-version: [12.x, 14.x, 16.x, 18.x]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
|
||||
@@ -93,6 +93,11 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
|
||||
-->
|
||||
|
||||
## Changelog
|
||||
|
||||
### __WORK IN PROGRESS__
|
||||
* (Apollon77) IMPORTANT: Replace special characters in entity attribute names with an underscore! Object IDs might change!
|
||||
* (Apollon77) make sure a "null" value in state changes is not crashing
|
||||
|
||||
### 1.1.2 (2022-03-29)
|
||||
* (Apollon77) Fix crash cases reported by Sentry
|
||||
|
||||
|
||||
@@ -177,6 +177,44 @@
|
||||
"agree",
|
||||
"cancel"
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": {
|
||||
"operand": "and",
|
||||
"rules": [
|
||||
"oldVersion<1.2.0",
|
||||
"newVersion>=1.2.0"
|
||||
]
|
||||
},
|
||||
"title": {
|
||||
"en": "Important notice!",
|
||||
"de": "Wichtiger Hinweis!",
|
||||
"ru": "Важное замечание!",
|
||||
"pt": "Notícia importante!",
|
||||
"nl": "Belangrijke mededeling!",
|
||||
"fr": "Avis important!",
|
||||
"it": "Avviso IMPORTANTE!",
|
||||
"es": "Noticia importante!",
|
||||
"pl": "Ważna uwaga!",
|
||||
"zh-cn": "重要通知!"
|
||||
},
|
||||
"text": {
|
||||
"en": "The new version 1.2.x will potentially change the Names of Objects when special characters like \".\", \"-\" or spaces were used in entity attributes! Please delete the old objects manually if needed.",
|
||||
"de": "Die neue Version 1.2.x wird die Namen von Objekten möglicherweise ändern, wenn spezielle Zeichen wie \".\", \"-\" oder Leerzeichen in Entity-Attributen verwendet wurden! Alten Objekte bitte bei Bedarf manuell löschen.",
|
||||
"ru": "Новая версия 1.2.x будет потенциально менять имена объектов, когда специальные символы типа \".\", \"-\" или пространства были использованы в атрибутах лица! Пожалуйста, удалите старые объекты вручную, если это необходимо.",
|
||||
"pt": "A nova versão 1.2.x irá potencialmente alterar os Nomes de Objetos quando caracteres especiais como \".\", \"-\" ou espaços foram usados em atributos de entidade! Por favor, exclua os objetos antigos manualmente, se necessário.",
|
||||
"nl": "De nieuwe versie 1.2.x zal de Namen van Objects veranderen als speciale personages zoals \", \" of ruimtes werden gebruikt in entiteitsaanklachten! Verwijder de oude objecten handmatig als het nodig is.",
|
||||
"fr": "La nouvelle version 1.2.x modifiera potentiellement les Noms des Objets lorsque des caractères spéciaux comme \", \"-\" ou des espaces ont été utilisés dans des attributs d'entité ! Veuillez supprimer les anciens objets manuellement si nécessaire.",
|
||||
"it": "La nuova versione 1.2.x cambierà potenzialmente i nomi degli oggetti quando caratteri speciali come \".\", \"-\" o spazi sono stati utilizzati negli attributi dell'entità! Si prega di eliminare i vecchi oggetti manualmente se necessario.",
|
||||
"es": "La nueva versión 1.2.x potencialmente cambiará los Nombres de Objetos cuando caracteres especiales como \"., \"-\" o espacios fueron utilizados en atributos de entidad! Por favor, borre los viejos objetos manualmente si es necesario.",
|
||||
"pl": "Nowa wersja 1.2.x będzie potencjalnie zmieniać nazwy obiektów, kiedy szczególne postacie takie jak „.”, „-” lub przestrzenie były używane w atrybutach. Okazuje się, że stare obiekty ręcznie będą potrzebne.",
|
||||
"zh-cn": "新版本1.2.x将可能改变物体的名称,如“......”、“-”或空间在实体的属性中使用。 请在必要时删除旧物体。."
|
||||
},
|
||||
"level": "warn",
|
||||
"buttons": [
|
||||
"agree",
|
||||
"cancel"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@ function startAdapter(options) {
|
||||
let requestFields = {};
|
||||
if (typeof state.val === 'string') {
|
||||
try {
|
||||
requestFields = JSON.parse(state.val);
|
||||
requestFields = JSON.parse(state.val) || {};
|
||||
} catch (err) {
|
||||
adapter.log.info(`Ignore data for service call ${id} is no valid JSON: ${err.message}`);
|
||||
requestFields = {};
|
||||
@@ -284,7 +284,7 @@ function parseStates(entities, services, callback) {
|
||||
}
|
||||
|
||||
obj = {
|
||||
_id: `${adapter.namespace}.entities.${entity.entity_id}.${attr}`,
|
||||
_id: `${adapter.namespace}.entities.${entity.entity_id}.${attr.replace(adapter.FORBIDDEN_CHARS, '_')}`,
|
||||
type: 'state',
|
||||
common: common,
|
||||
native: {
|
||||
@@ -390,7 +390,7 @@ function main() {
|
||||
if ((typeof val === 'object' && val !== null) || Array.isArray(val)) {
|
||||
val = JSON.stringify(val);
|
||||
}
|
||||
adapter.setForeignState(id + attr, {val, ack: true, lc, ts});
|
||||
adapter.setForeignState(id + attr.replace(adapter.FORBIDDEN_CHARS, '_'), {val, ack: true, lc, ts});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"websocket": "^1.0.34",
|
||||
"ws": "^8.5.0",
|
||||
"ws": "^8.8.0",
|
||||
"@iobroker/adapter-core": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"@alcalzone/release-script-plugin-license": "^3.5.9",
|
||||
"axios": "^0.27.2",
|
||||
"gulp": "^4.0.2",
|
||||
"mocha": "^9.2.2",
|
||||
"mocha": "^10.0.0",
|
||||
"chai": "^4.3.6"
|
||||
},
|
||||
"main": "main.js",
|
||||
|
||||
Reference in New Issue
Block a user