iobroker.hue 3.5.31 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,21 @@ Please note: Adapter settings button "Find Bridge" will be inactive if field "Br
45
45
  |__Polling__|If checked, the adapter will poll state changes, otherwise it can only be used to control lamps, not to show their status.|
46
46
  |__Polling interval__|Defines how often the states will be polled, and thus updated in ioBroker. Low polling intervals can cause performance issues in some settings. Hence, the minimum allowed polling interval is 2 seconds. If polling interval is set to less than 2 seconds it will be set to 2 seconds during runtime.|
47
47
 
48
+ ### Commands
49
+ Command states (e.g. `hue.0.All.command`) can be used to set multiple commands to the bridge.
50
+ This allows to set a group or a light to a specific state using e.g. a transiton time.
51
+
52
+ ```javascript
53
+ setState('hue.0.All.command', { "bri": 50, "transitiontime": 30 }, false);
54
+ ```
55
+
56
+ For groups which contain scenes, like `hue.0.Wohnzimmer.scene_hell` the scenes can also be activated with a transitiontime.
57
+ To do this, pass the scene argument to the corresponding command.
58
+
59
+ ```javascript
60
+ setState('hue.0.All.Wohnzimmer', { "scene": "hell", "transitiontime": 30 }, false);
61
+ ```
62
+
48
63
  ### Additional information
49
64
  With version 3.3.0 the group states `anyOn` and `allOn` became controllable, note that they will just act like the `on` state,
50
65
  when controlled. In some cases, it may be desirable to have a controllable `anyOn` state in your visualization.
@@ -58,6 +73,9 @@ In den Adapter-Settings muss die IP der Hue Bridge sowie ein Username konfigurie
58
73
  Placeholder for the next version (at the beginning of the line):
59
74
  ### __WORK IN PROGRESS__
60
75
  -->
76
+ ### 3.6.0 (2021-12-30)
77
+ * (foxriver76) allow to trigger scenes via `command` state, this allows to start a scene with `transitiontime`
78
+
61
79
  ### 3.5.31 (2021-11-20)
62
80
  * (foxriver76) ct value fix of #234 ported for 0 (All) group
63
81
 
package/io-package.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "hue",
4
- "version": "3.5.31",
4
+ "version": "3.6.0",
5
5
  "tier": 2,
6
6
  "news": {
7
+ "3.6.0": {
8
+ "en": "allow to trigger scenes via `command` state, this allows to start a scene with `transitiontime`",
9
+ "de": "Ermöglicht das Auslösen von Szenen über den 'Befehl'-Zustand, dies ermöglicht das Starten einer Szene mit 'Übergangszeit'",
10
+ "ru": "позволяют запускать сцены через состояние `command`, это позволяет запускать сцену с` transitiontime`",
11
+ "pt": "permite acionar cenas via estado `command`, isso permite iniciar uma cena com` tempo de transição`",
12
+ "nl": "laat toe om scènes te activeren via de status `commando`, dit maakt het mogelijk om een scène te starten met `overgangstijd`",
13
+ "fr": "permet de déclencher des scènes via l'état \"commande\", cela permet de démarrer une scène avec \"temps de transition\"",
14
+ "it": "permette di attivare scene tramite lo stato `comando`, questo permette di avviare una scena con `transitiontime`",
15
+ "es": "permite activar escenas a través del estado `comando`, esto permite iniciar una escena con` tiempo de transición`",
16
+ "pl": "pozwala na wyzwalanie scen poprzez stan `command`, pozwala to na uruchomienie sceny z `transitiontime`",
17
+ "zh-cn": "允许通过 `command` 状态触发场景,这允许使用 `transitiontime` 启动场景"
18
+ },
7
19
  "3.5.31": {
8
20
  "en": "ct value fix of #234 ported for 0 (All) group",
9
21
  "de": "ct-Wert-Fix von #234 portiert für 0 (Alle) Gruppe",
@@ -75,18 +87,6 @@
75
87
  "es": "solucionó un problema con el nombre de usuario establecido en la API de Hue (corrige 249)\ntraducción fija de la ventana emergente de búsqueda (arreglos # 247)",
76
88
  "pl": "naprawiono problem z nazwą użytkownika ustawioną w Hue API (poprawki 249)\npoprawione tłumaczenie wyskakującego okienka wyszukiwania (poprawki #247)",
77
89
  "zh-cn": "修复了 Hue API 中设置的用户名问题(修复 249)\n搜索弹出窗口的固定翻译(修复#247)"
78
- },
79
- "3.5.25": {
80
- "en": "if we cannot determine correct ct value, we won't set it (fixes #234)",
81
- "de": "Wenn wir den korrekten ct-Wert nicht bestimmen können, werden wir ihn nicht festlegen (fixes #234)",
82
- "ru": "если мы не можем определить правильное значение ct, мы не будем его устанавливать (исправления # 234)",
83
- "pt": "se não pudermos determinar o valor correto de ct, não o definiremos (corrige # 234)",
84
- "nl": "als we de juiste ct-waarde niet kunnen bepalen, stellen we deze niet in (fixes #234)",
85
- "fr": "si nous ne pouvons pas déterminer la valeur ct correcte, nous ne la définirons pas (corrections #234)",
86
- "it": "se non riusciamo a determinare il valore ct corretto, non lo imposteremo (correzioni #234)",
87
- "es": "si no podemos determinar el valor de ct correcto, no lo configuraremos (arreglos # 234)",
88
- "pl": "jeśli nie możemy określić prawidłowej wartości ct, nie ustawimy jej (poprawki #234)",
89
- "zh-cn": "如果我们无法确定正确的 ct 值,我们将不会设置它(修复 #234)"
90
90
  }
91
91
  },
92
92
  "titleLang": {
package/main.js CHANGED
@@ -250,11 +250,22 @@ function startAdapter(options) {
250
250
  }
251
251
  handleParam(idState, false);
252
252
  }
253
+
254
+ let sceneId;
253
255
  // Handle commands at the end because they overwrite also anything
254
256
  if (commandSupported && dp === 'command') {
255
257
  try {
256
258
  const commands = JSON.parse(state.val);
257
259
 
260
+ if (typeof commands.scene === 'string') {
261
+ // we need to get the id of the scene
262
+ const sceneObj = await adapter.getObjectAsync(`${channelId}.scene_${commands.scene.toLowerCase()}`);
263
+
264
+ if (sceneObj && sceneObj.native) {
265
+ sceneId = sceneObj.native.id;
266
+ }
267
+ }
268
+
258
269
  for (const command of Object.keys(commands)) {
259
270
  if (command === 'on') {
260
271
  // if on is the only command and nativeTurnOn is activated
@@ -318,6 +329,7 @@ function startAdapter(options) {
318
329
 
319
330
  // create lightState from ls and check values
320
331
  let lightState = /(LightGroup)|(Room)|(Zone)|(Entertainment)/g.test(obj.common.role) ? new v3.lightStates.GroupLightState() : new v3.lightStates.LightState();
332
+
321
333
  if (parseInt(ls.bri) > 0) {
322
334
  const bri = Math.min(254, ls.bri);
323
335
  if (isNaN(bri)) {
@@ -445,7 +457,7 @@ function startAdapter(options) {
445
457
  if ('transitiontime' in ls) {
446
458
  const transitiontime = Math.max(0, Math.min(65535, parseInt(ls.transitiontime)));
447
459
  if (!isNaN(transitiontime)) {
448
- finalLS.transitiontime = transitiontime
460
+ finalLS.transitiontime = transitiontime;
449
461
  lightState = lightState.transitiontime(transitiontime);
450
462
  }
451
463
  }
@@ -535,6 +547,11 @@ function startAdapter(options) {
535
547
  } // endElse
536
548
  }
537
549
 
550
+ // this can only happen for cmd - groups
551
+ if (sceneId !== undefined) {
552
+ lightState.scene(sceneId);
553
+ }
554
+
538
555
  blockedIds[id] = true;
539
556
 
540
557
  if (!adapter.config.ignoreGroups && /(LightGroup)|(Room)|(Zone)|(Entertainment)/g.test(obj.common.role)) {
@@ -549,8 +566,7 @@ function startAdapter(options) {
549
566
  adapter.log.debug(`updated group state (${groupIds[id]}) after change`);
550
567
  } catch (e) {
551
568
  adapter.log.error(`Could not set GroupState of ${obj.common.name}: ${e.message}`);
552
- } // endTryCatch
553
-
569
+ }
554
570
  } else if (obj.common.role === 'switch') {
555
571
  if (Object.prototype.hasOwnProperty.call(finalLS, 'on')) {
556
572
  finalLS = {on: finalLS.on};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.hue",
3
- "version": "3.5.31",
3
+ "version": "3.6.0",
4
4
  "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",
5
5
  "author": "hobbyquaker <hq@ccu.io>",
6
6
  "contributors": [
@@ -32,13 +32,13 @@
32
32
  "node-hue-api": "^4.0.10"
33
33
  },
34
34
  "devDependencies": {
35
- "@alcalzone/release-script": "^3.4.1",
35
+ "@alcalzone/release-script": "^3.4.2",
36
36
  "@alcalzone/release-script-plugin-iobroker": "^3.4.1",
37
37
  "@alcalzone/release-script-plugin-license": "^3.4.1",
38
38
  "@iobroker/testing": "^2.5.2",
39
39
  "axios": "^0.24.0",
40
40
  "chai": "^4.3.4",
41
- "eslint": "^8.2.0",
41
+ "eslint": "^8.5.0",
42
42
  "gulp": "^4.0.2",
43
43
  "mocha": "^9.1.3"
44
44
  },