-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathq.js
120 lines (115 loc) · 3.77 KB
/
q.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
const {Zcl} = require('zigbee-herdsman');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const ota = require('zigbee-herdsman-converters/lib/ota');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const {
deviceEndpoints,
iasZoneAlarm,
temperature,
humidity,
pressure,
co2,
illuminance,
numeric,
identify,
enumLookup,
} = require('zigbee-herdsman-converters/lib/modernExtend');
const defaultReporting = {min: 30, max: 300, change: 0};
const definition = {
zigbeeModel: ['Q_sensor'],
model: 'Q_sensor',
vendor: 'xyzroe',
description: 'Multi-functional Zigbee Air Quality Sensor',
ota: ota.zigbeeOTA,
extend: [
deviceEndpoints({endpoints: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13}}),
iasZoneAlarm({zoneType: 'occupancy', zoneAttributes: ['alarm_1', 'tamper']}),
temperature({endpointNames: ['1', '2', '3', '4']}),
humidity({endpointNames: ['2', '4']}),
pressure({endpointNames: ['3']}),
co2({endpointNames: ['4']}),
illuminance({endpointNames: ['5']}),
identify(),
numeric({
name: 'voc',
unit: 'points',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'VOC index',
access: 'STATE_GET',
endpointNames: ['6'],
reporting: defaultReporting,
}),
numeric({
name: 'adc1',
unit: 'mV',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'ADC1 value',
access: 'STATE_GET',
endpointNames: ['7'],
reporting: defaultReporting,
}),
numeric({
name: 'adc2',
unit: 'mV',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'ADC2 value',
access: 'STATE_GET',
endpointNames: ['8'],
reporting: defaultReporting,
}),
enumLookup({
name: 'possition',
lookup: {Incorrect: 0, Horizontal: 1, Vertical: 2},
cluster: 'genMultistateValue',
attribute: 'presentValue',
description: 'Device position',
access: 'STATE_GET',
endpointNames: ['10'],
reporting: defaultReporting,
}),
numeric({
name: 'pitch',
unit: '°',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'Pitch value',
access: 'STATE_GET',
endpointNames: ['11'],
reporting: defaultReporting,
precision: 6,
}),
numeric({
name: 'roll',
unit: '°',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'Roll value',
access: 'STATE_GET',
endpointNames: ['12'],
reporting: defaultReporting,
precision: 6,
}),
numeric({
name: 'yaw',
unit: '°',
cluster: 'genAnalogInput',
attribute: 'presentValue',
description: 'Yaw value',
access: 'STATE_GET',
endpointNames: ['13'],
reporting: defaultReporting,
precision: 6,
}),
],
meta: {multiEndpoint: true},
};
module.exports = definition;