-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIndicator.js
133 lines (126 loc) · 3.38 KB
/
Indicator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Homey CommandClass
* Indicator
* Version 1 & 2
* Device settings only
*
* JUST FOR REFERENCE!
* Basic knowledge still needed.
*/
/*
* =========== APP.JSON VERSION 1 - 2 ===========
* SETTING_ID = Unique setting id for the device
* SETTING_LABEL = Short description of what the setting does
* SETTING_HINT = Optional, longer discription what the setting does
*/
{
"id": "SETTING_ID",
"type": "checkbox",
"label": {
"en": "SETTING_LABEL"
},
"hint": {
"en": "SETTING_HINT" //Optional
},
"value": true
}
/*
* =========== DRIVER.JS VERSION 1 ===========
* SETTING_ID = Unique setting id for the device
*/
SETTING_ID: (newValue, oldValue, deviceData) => {
const node = module.exports.nodes[deviceData.token];
if (node && typeof node.instance.CommandClass.COMMAND_CLASS_INDICATOR !== 'undefined') {
//Send parameter values to module
node.instance.CommandClass.COMMAND_CLASS_INDICATOR.INDICATOR_SET({
"Value": (newValue) ? 1 : 0,
}, err => {
if (err) return console.error(err, false);
});
}
},
/*
* =========== DRIVER.JS VERSION 2 ===========
* !! === UNTESTED DRIVER --- !!
* SETTING_ID = Unique setting id for the device
* INDICATION_VERION_1_VALUE = The value (true = 1 / false = 0) that would be used in version 1
* AMOUNT_INDICATORS = The amount of indicators you want to change
*
* # = the number of setable indicator, starting from 1
* INDICATION_ID = Any of the supported indicators ids, displayed below
* INDICATION_PROPERTY = Any of the supported indicators properties, displayed below
* INDICATION_VALUE = Indication value, displayed below
*/
SETTING_ID: (newValue, oldValue, deviceData) => {
const node = module.exports.nodes[deviceData.token];
if (node && typeof node.instance.CommandClass.COMMAND_CLASS_INDICATOR !== 'undefined') {
//Send parameter values to module
node.instance.CommandClass.COMMAND_CLASS_INDICATOR.INDICATOR_SET({
"Indicator 0 Value": INDICATION_VERION_1_VALUE,
"Level": {
"Indicator Object Count": AMOUNT_INDICATORS,
},
"Indicator ID #": INDICATION_ID,
"Property ID #": INDICATION_PROPERTY,
"Value #": INDICATION_VALUE,
}, err => {
if (err) return console.error(err, false);
});
}
},
/*
* SUPPORTED INDICATOR IDS:
* ---------- FROM VERSION 2 ----------
1 - ARMED
2 - NOT_ARMED
3 - READY
4 - FAULT
5 - BUSY
6 - ENTER_ID
7 - ENTER_PIN
8 - OK
9 - NOT_OK
32 - ZONE1_ARMED
33 - ZONE2_ARMED
34 - ZONE3_ARMED
35 - ZONE4_ARMED
36 - ZONE5_ARMED
37 - ZONE6_ARMED
48 - LCD_BACKLIGHT
64 - BUTTON_BACKLIGHT_LETTERS
65 - BUTTON_BACKLIGHT_DIGITS
66 -BUTTON_BACKLIGHT_COMMAND
67 - BUTTON1_INDICATION
68 - BUTTON2_INDICATION
69 - BUTTON3_INDICATION
70 - BUTTON4_INDICATION
71 - BUTTON5_INDICATION
72 - BUTTON6_INDICATION
73 - BUTTON7_INDICATION
74 - BUTTON8_INDICATION
75 - BUTTON9_INDICATION
76 - BUTTON10_INDICATION
77 - BUTTON11_INDICATION
78 - BUTTON12_INDICATION
240 = Buzzer
* SUPPORTED INDICATOR PROPERTIES AND ITS VALUES:
* ---------- FROM VERSION 2 ----------
1 - Multilevel
0 = Off
1-99 = Brightness indication
255 = Previous value
2 - Binary
0 = Off
1-99 = on
255 = On
3 - On_Off_Period
0 - 0 seconds
/\-[range]-\/
255 = 25.5 seconds
4 - On_Off_Cycles
0 = 0 times
/\-[range]-\/
254 = 254 times
255 = until stopped by an on/off signal
16 - Low_power (GET only)
*/