-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathindex.js
More file actions
170 lines (159 loc) · 4.03 KB
/
index.js
File metadata and controls
170 lines (159 loc) · 4.03 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
'use strict';
const _debug = require('debug');
const ZCLNode = require('./lib/Node');
const Cluster = require('./lib/Cluster');
const BoundCluster = require('./lib/BoundCluster');
const zclTypes = require('./lib/zclTypes');
const zclFrames = require('./lib/zclFrames');
const { ZCLError } = require('./lib/util');
/**
* Enables or disables debug logging.
* @param {boolean} flag - Set to true to enable logging
* @param {string} namespaces - As specified by [`debug`](https://www.npmjs.com/package/debug)
* npm module (e.g.
* `zigbee-clusters:bound-cluster:*`).
*
* @example
*
* const { debug } = require('zigbee-clusters');
*
* // Enables debug logging in zigbee-clusters
* debug(true);
*/
function debug(flag = true, namespaces = '*') {
// If arg is boolean and true, or string with length consider logging to be enabled
if (flag) {
// TODO: currently `debug.enable()` overrides all enabled namespaces, this is likely to be
// fixed in debug@5.0.0 (see: https://github.com/visionmedia/debug/issues/425). Until then
// enable all ('*') to prevent disabling others.
_debug.enable(namespaces);
return;
}
// Disable all, only thing we can do here
// TODO: maybe from debug@5.0.0 we can disable specific namespaces, in that case only disable
// the `zigbee-clusters` namespace.
_debug.disable();
}
const {
ZCLDataTypes,
ZCLDataType,
ZCLStruct,
} = zclTypes;
const { ZIGBEE_PROFILE_ID, ZIGBEE_DEVICE_ID, IAS_ZONE_TYPE } = require('./lib/constants');
// Required for compatibility with named exports when used with ESM
const {
BasicCluster,
PowerConfigurationCluster,
DeviceTemperatureCluster,
IdentifyCluster,
GroupsCluster,
ScenesCluster,
OnOffCluster,
OnOffSwitchCluster,
LevelControlCluster,
AlarmsCluster,
TimeCluster,
AnalogInputCluster,
AnalogOutputCluster,
AnalogValueCluster,
BinaryInputCluster,
BinaryOutputCluster,
BinaryValueCluster,
MultistateInputCluster,
MultistateOutputCluster,
MultistateValueCluster,
OTACluster,
PowerProfileCluster,
PollControlCluster,
ShadeConfigurationCluster,
DoorLockCluster,
WindowCoveringCluster,
ThermostatCluster,
PumpConfigurationAndControlCluster,
FanControlCluster,
DehumidificationControlCluster,
ColorControlCluster,
BallastConfigurationCluster,
IlluminanceMeasurementCluster,
IlluminanceLevelSensingCluster,
TemperatureMeasurementCluster,
PressureMeasurementCluster,
FlowMeasurementCluster,
RelativeHumidityCluster,
OccupancySensingCluster,
IASZoneCluster,
IASACECluster,
IASWDCluster,
MeteringCluster,
ElectricalMeasurementCluster,
DiagnosticsCluster,
TouchLinkCluster,
CLUSTER,
} = require('./lib/clusters');
module.exports = {
// Cluster base classes
Cluster,
BoundCluster,
// ZCL
ZCLNode,
zclTypes,
zclFrames,
ZCLDataTypes,
ZCLDataType,
ZCLStruct,
ZCLError,
// Cluster definitions
BasicCluster,
PowerConfigurationCluster,
DeviceTemperatureCluster,
IdentifyCluster,
GroupsCluster,
ScenesCluster,
OnOffCluster,
OnOffSwitchCluster,
LevelControlCluster,
AlarmsCluster,
TimeCluster,
AnalogInputCluster,
AnalogOutputCluster,
AnalogValueCluster,
BinaryInputCluster,
BinaryOutputCluster,
BinaryValueCluster,
MultistateInputCluster,
MultistateOutputCluster,
MultistateValueCluster,
OTACluster,
PowerProfileCluster,
PollControlCluster,
ShadeConfigurationCluster,
DoorLockCluster,
WindowCoveringCluster,
ThermostatCluster,
PumpConfigurationAndControlCluster,
FanControlCluster,
DehumidificationControlCluster,
ColorControlCluster,
BallastConfigurationCluster,
IlluminanceMeasurementCluster,
IlluminanceLevelSensingCluster,
TemperatureMeasurementCluster,
PressureMeasurementCluster,
FlowMeasurementCluster,
RelativeHumidityCluster,
OccupancySensingCluster,
IASZoneCluster,
IASACECluster,
IASWDCluster,
MeteringCluster,
ElectricalMeasurementCluster,
DiagnosticsCluster,
TouchLinkCluster,
// Constant cluster definitions
CLUSTER,
// Utilities
debug,
ZIGBEE_PROFILE_ID,
ZIGBEE_DEVICE_ID,
IAS_ZONE_TYPE,
};