Skip to content

Commit

Permalink
chore: release v3.5.1
Browse files Browse the repository at this point in the history
avoid crash cases on invalid xy, setting state for non-existing device and on failing user creation
  • Loading branch information
foxriver76 committed Feb 20, 2021
1 parent 0bab706 commit 4714ed3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ In den Adapter-Settings muss die IP der Hue Bridge sowie ein Username konfigurie
### __WORK IN PROGRESS__
-->

### 3.5.1 (2021-02-20)
* (foxriver76) avoid crash cases on invalid xy, setting state for non-existing device and on failing user creation

### 3.5.0 (2021-02-18)
* (foxriver76) use official js-controller regex for replacing forbidden chars (fixes #165)
* (foxriver76) use release-script
Expand Down
26 changes: 13 additions & 13 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "hue",
"version": "3.5.0",
"version": "3.5.1",
"news": {
"3.5.1": {
"en": "avoid crash cases on invalid xy, setting state for non-existing device and on failing user creation",
"de": "Vermeiden Sie Absturzfälle auf ungültigem xy, setzen Sie den Status für nicht vorhandenes Gerät und schlagen Sie die Benutzererstellung fehl",
"ru": "Избегайте сбоев при недопустимом xy, настройке состояния для несуществующего устройства и при сбое создания пользователя",
"pt": "evite casos de falha em xy inválido, configuração de estado para dispositivo não existente e falha na criação do usuário",
"nl": "vermijd crashgevallen op ongeldige xy, instellingstoestand voor niet-bestaand apparaat en bij mislukte aanmaak van gebruikers",
"fr": "éviter les cas de plantage sur un xy non valide, définir l'état d'un périphérique non existant et en cas d'échec de la création d'utilisateur",
"it": "evitare casi di arresto anomalo su xy non valido, impostazione dello stato per dispositivo inesistente e mancata creazione dell'utente",
"es": "evitar casos de bloqueo en xy no válido, establecer el estado para el dispositivo no existente y en la creación de un usuario fallido",
"pl": "unikaj przypadków awarii na nieprawidłowym xy, ustawianiu stanu dla nieistniejącego urządzenia i niepowodzeniu tworzenia użytkownika",
"zh-cn": "避免在无效的xy,不存在的设备的设置状态以及用户创建失败时发生崩溃的情况"
},
"3.5.0": {
"en": "use official js-controller regex for replacing forbidden chars (fixes #165)\nuse release-script\nsentry added",
"de": "Verwenden Sie den offiziellen regulären Ausdruck für js-controller, um verbotene Zeichen zu ersetzen (Fixes # 165).\nbenutze das Release-Skript\nWachposten hinzugefügt",
Expand Down Expand Up @@ -230,18 +242,6 @@
"es": "Se agregaron nuevos indicadores de grupos de entretenimiento y se agregó la posibilidad de iniciar y detener la transmisión",
"pl": "dodano nowe wskaźniki grup rozrywkowych oraz dodano możliwość rozpoczęcia i zakończenia transmisji",
"zh-cn": "添加了娱乐团体的新指标,并增加了开始和停止流媒体播放的可能性"
},
"3.0.3": {
"en": "fixed problem turning on/off switchs like Osram Plug",
"de": "Problem beim Ein- und Ausschalten von Schaltern wie Osram Plug behoben",
"ru": "исправлена проблема включения / выключения выключателей, таких как Osram Plug",
"pt": "problema corrigido ao ligar / desligar interruptores como o Osram Plug",
"nl": "probleem opgelost met het in- en uitschakelen van schakelaars zoals Osram Plug",
"fr": "correction d'un problème d'activation / désactivation des interrupteurs comme la prise Osram",
"it": "risolto il problema di accensione / spegnimento di interruttori come Osram Plug",
"es": "problema solucionado al encender / apagar interruptores como Osram Plug",
"pl": "naprawiono problem z włączaniem / wyłączaniem przełączników takich jak Osram Plug",
"zh-cn": "解决了打开/关闭Osram Plug等开关的问题"
}
},
"title": "Philips Hue Bridge",
Expand Down
17 changes: 14 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,13 @@ function startAdapter(options) {
try {
obj = await adapter.getObjectAsync(id);
} catch (e) {
adapter.log.error(`obj "${id}" in callback getObject is null or undefined`);
adapter.log.error(`Could not get object "${id}" on stateChange: ${e.message}`);
return;
}

// maybe someone emitted a state change for a non existing device via script
if (!obj) {
adapter.log.error(`Object "${id}" on stateChange is null or undefined`);
return;
}

Expand Down Expand Up @@ -316,7 +322,12 @@ function startAdapter(options) {

let xy = ls.xy.toString().split(',');
xy = {'x': xy[0], 'y': xy[1]};
xy = hueHelper.GamutXYforModel(xy.x, xy.y, (Object.prototype.hasOwnProperty.call(obj.native, 'modelid') ? obj.native.modelid.trim() : 'default'));
xy = hueHelper.GamutXYforModel(xy.x, xy.y, Object.prototype.hasOwnProperty.call(obj.native, 'modelid') ? obj.native.modelid.trim() : 'default');
if (!xy) {
adapter.log.error(`Invalid "xy" value "${state.val}" for id "${id}"`);
return;
}

finalLS.xy = `${xy.x},${xy.y}`;

lightState = lightState.xy(parseFloat(xy.x), parseFloat(xy.y));
Expand Down Expand Up @@ -648,7 +659,7 @@ async function createUser(ip) {
if (!e.getHueErrorType || e.getHueErrorType() !== 101) {
adapter.log.error(e);
}
return {error: e.getHueErrorType ? e.getHueErrorType() : e, message: JSON.stringify(e)};
return {error: e.getHueErrorType ? e.getHueErrorType() : e, message: e.message};
}
} // endCreateUser

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.hue",
"version": "3.5.0",
"version": "3.5.1",
"description": "Connects Philips Hue LED Bulbs, Friends of Hue LED Lamps and Stripes and other SmartLink capable Devices (LivingWhites, some LivingColors) via Philips Hue Bridges",
"author": "hobbyquaker <[email protected]>",
"contributors": [
Expand Down

0 comments on commit 4714ed3

Please sign in to comment.