iobroker.zigbee2mqtt 0.2.0 → 2.1.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/lib/groups.js DELETED
@@ -1,68 +0,0 @@
1
- const states = require('./states').states;
2
- const utils = require('./utils');
3
-
4
- function defineGroupDevice(devices, groupID, ieee_address, scenes, useKelvin) {
5
- const newDevice = {
6
- id: groupID,
7
- ieee_address: ieee_address,
8
- icon: undefined,
9
- states: [
10
- states.state,
11
- states.brightness,
12
- states.color,
13
- states.brightness_move,
14
- states.colortemp_move,
15
- ],
16
- };
17
-
18
- const colortemp = {
19
- id: 'colortemp',
20
- prop: 'color_temp',
21
- name: 'Color temperature',
22
- icon: undefined,
23
- role: 'level.color.temperature',
24
- write: true,
25
- read: true,
26
- type: 'number',
27
- unit: useKelvin == true ? 'K' : 'mired',
28
- setter: (value) => {
29
- return utils.toMired(value);
30
- },
31
- getter: (payload) => {
32
- if (useKelvin == true) {
33
- return utils.miredKelvinConversion(payload.color_temp);
34
- }
35
- else {
36
- return payload.color_temp;
37
- }
38
- },
39
- };
40
-
41
- // @ts-ignore
42
- newDevice.states.push(colortemp);
43
-
44
- // Create buttons for scenes
45
- for (const scene of scenes) {
46
- const sceneSate = {
47
- id: `scene_${scene.id}`,
48
- prop: `scene_recall`,
49
- name: scene.name,
50
- icon: undefined,
51
- role: 'button',
52
- write: true,
53
- read: true,
54
- type: 'boolean',
55
- setter: (value) => (value) ? scene.id : undefined
56
- };
57
- // @ts-ignore
58
- newDevice.states.push(sceneSate);
59
- }
60
-
61
- // if the device is already present in the cache, remove it
62
- utils.removeDeviceByIeee(devices, ieee_address);
63
- devices.push(newDevice);
64
- }
65
-
66
- module.exports = {
67
- defineGroupDevice: defineGroupDevice,
68
- };