-
Notifications
You must be signed in to change notification settings - Fork 279
/
events.ts
200 lines (178 loc) · 8.38 KB
/
events.ts
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import {FrameControl} from "../zspec/zcl/definition/tstype";
import {Device, Endpoint} from "./model";
import {KeyValue} from "./tstype";
enum Events {
message = "message",
adapterDisconnected = "adapterDisconnected",
deviceJoined = "deviceJoined",
deviceInterview = "deviceInterview",
deviceAnnounce = "deviceAnnounce",
deviceNetworkAddressChanged = "deviceNetworkAddressChanged",
deviceLeave = "deviceLeave",
permitJoinChanged = "permitJoinChanged",
lastSeenChanged = "lastSeenChanged",
}
interface DeviceJoinedPayload {
device: Device;
}
interface DeviceInterviewPayload {
status: 'started' | 'successful' | 'failed';
device: Device;
}
interface DeviceNetworkAddressChangedPayload {
device: Device;
}
interface DeviceAnnouncePayload {
device: Device;
}
interface DeviceLeavePayload {
ieeeAddr: string;
}
interface PermitJoinChangedPayload {
permitted: boolean, reason: 'timer_expired' | 'manual', timeout: number
}
interface LastSeenChangedPayload {
device: Device;
reason: 'deviceAnnounce' | 'networkAddress' | 'deviceJoined' | 'messageEmitted' | 'messageNonEmitted';
}
const CommandsLookup: {[s: string]: MessagePayloadType} = {
'notification': 'commandNotification',
'commissioningNotification': 'commandCommissioningNotification',
'on': 'commandOn',
'offWithEffect': 'commandOffWithEffect',
'step': 'commandStep',
'stop': 'commandStop',
'hueNotification': 'commandHueNotification',
'off': 'commandOff',
'stepColorTemp': 'commandStepColorTemp',
'stepHue': 'commandStepHue',
'stepSaturation': 'commandStepSaturation',
'moveWithOnOff': 'commandMoveWithOnOff',
'move': 'commandMove',
'moveColorTemp': 'commandMoveColorTemp',
'moveHue': 'commandMoveHue',
'moveToSaturation': 'commandMoveToSaturation',
'moveToHueAndSaturation': 'commandMoveToHueAndSaturation',
'stopWithOnOff': 'commandStopWithOnOff',
'moveToLevel': 'commandMoveToLevel',
'moveToLevelWithOnOff': 'commandMoveToLevelWithOnOff',
'toggle': 'commandToggle',
'tradfriArrowSingle': 'commandTradfriArrowSingle',
'tradfriArrowHold': 'commandTradfriArrowHold',
'tradfriArrowRelease': 'commandTradfriArrowRelease',
'stepWithOnOff': 'commandStepWithOnOff',
'moveToColorTemp': 'commandMoveToColorTemp',
'moveToColor': 'commandMoveToColor',
'onWithTimedOff': 'commandOnWithTimedOff',
'recall': 'commandRecall',
'arm': 'commandArm',
'panic': 'commandPanic',
'emergency': 'commandEmergency',
'operationEventNotification': 'commandOperationEventNotification',
'statusChangeNotification': 'commandStatusChangeNotification',
'colorLoopSet': 'commandColorLoopSet',
'enhancedMoveToHueAndSaturation': 'commandEnhancedMoveToHueAndSaturation',
'downClose': 'commandDownClose',
'upOpen': 'commandUpOpen',
'dataResponse': 'commandDataResponse',
'dataReport': 'commandDataReport',
'mcuVersionResponse': 'commandMcuVersionResponse',
'getWeeklyScheduleRsp': 'commandGetWeeklyScheduleRsp',
'queryNextImageRequest': 'commandQueryNextImageRequest',
'alertsNotification': 'commandAlertsNotification',
'programmingEventNotification': 'commandProgrammingEventNotification',
'getPinCodeRsp': 'commandGetPinCodeRsp',
'getUserStatusRsp': 'commandGetUserStatusRsp',
'arrivalSensorNotify': 'commandArrivalSensorNotify',
'getPanelStatus': 'commandGetPanelStatus',
'checkin': 'commandCheckIn',
'moveToHue': 'commandMoveToHue',
'store': 'commandStore',
'alarm': 'commandAlarm',
'unlockDoorRsp': 'commandUnlockDoorRsp',
// HEIMAN scenes cluster
'atHome': 'commandAtHome',
'goOut': 'commandGoOut',
'cinema': 'commandCinema',
'repast': 'commandRepast',
'sleep': 'commandSleep',
// HEIMAN IR remote cluster
'studyKeyRsp': 'commandStudyKeyRsp',
'createIdRsp': 'commandCreateIdRsp',
'getIdAndKeyCodeListRsp': 'commandGetIdAndKeyCodeListRsp',
'mcuGatewayConnectionStatus': 'commandMcuGatewayConnectionStatus', // Tuya gateway connnection status
'mcuSyncTime': 'commandMcuSyncTime', // Tuya time sync
'activeStatusReport': 'commandActiveStatusReport', // Tuya active status report (command 0x06)
'activeStatusReportAlt': 'commandActiveStatusReportAlt', // Tuya active status report (command 0x05)
// Wiser Smart HVAC Commmands
'wiserSmartSetSetpoint': 'commandWiserSmartSetSetpoint',
'wiserSmartCalibrateValve': 'commandWiserSmartCalibrateValve',
// Dafoss Ally/Hive TRV Commands
'danfossSetpointCommand': 'commandDanfossSetpointCommand',
// Siglis zigfred Commands
'siglisZigfredButtonEvent': 'commandSiglisZigfredButtonEvent',
// Zosung IR remote cluster commands and responses
'zosungSendIRCode01': 'commandZosungSendIRCode01',
'zosungSendIRCode02': 'commandZosungSendIRCode02',
'zosungSendIRCode04': 'commandZosungSendIRCode04',
'zosungSendIRCode00': 'commandZosungSendIRCode00',
'zosungSendIRCode03Resp': 'zosungSendIRCode03Resp',
'zosungSendIRCode05Resp': 'zosungSendIRCode05Resp',
'transferDataResp': 'transferDataResp',
// Schneider
'schneiderWiserThermostatBoost':'commandSchneiderWiserThermostatBoost',
// Tradfri
'action1': 'commandAction1',
'action2': 'commandAction2',
'action3': 'commandAction3',
'action4': 'commandAction4',
'action6': 'commandAction6',
// Tuya
'tuyaAction': 'commandTuyaAction',
'tuyaAction2': 'commandTuyaAction2',
};
type MessagePayloadType =
// Global
'attributeReport' | 'readResponse' | 'raw' | 'read' | 'write' |
// Specific
'commandOn' | 'commandOffWithEffect' | 'commandStep' | 'commandStop' | 'commandHueNotification' |
'commandOff' | 'commandStepColorTemp' | 'commandMoveWithOnOff' |
'commandMove' | 'commandMoveHue' | 'commandStepHue' | 'commandStepSaturation' |
'commandMoveToSaturation' | 'commandStopWithOnOff' | 'commandMoveToLevelWithOnOff' | 'commandToggle' |
'commandTradfriArrowSingle' | 'commandTradfriArrowHold' | 'commandTradfriArrowRelease' |
'commandStepWithOnOff' | 'commandMoveToColorTemp' | 'commandMoveToColor' | 'commandOnWithTimedOff' |
'commandRecall' | 'commandArm' | 'commandPanic' | 'commandEmergency' | 'commandColorLoopSet' |
'commandOperationEventNotification' | 'commandStatusChangeNotification' | 'commandEnhancedMoveToHueAndSaturation' |
'commandUpOpen' | 'commandDownClose' | 'commandMoveToLevel' | 'commandMoveColorTemp' | 'commandDataResponse' |
'commandDataReport' | 'commandGetWeeklyScheduleRsp' | 'commandQueryNextImageRequest' | 'commandNotification' |
'commandAlertsNotification' | 'commandProgrammingEventNotification' | 'commandGetPinCodeRsp' |
'commandArrivalSensorNotify' | 'commandCommissioningNotification' | 'commandGetUserStatusRsp' |
'commandAlarm' | 'commandUnlockDoorRsp' | 'commandMcuVersionResponse' |
'commandAtHome' | 'commandGoOut' | 'commandCinema' | 'commandRepast' | 'commandSleep' |
'commandStudyKeyRsp' | 'commandCreateIdRsp' | 'commandGetIdAndKeyCodeListRsp' | 'commandMcuSyncTime' |
'commandGetPanelStatus' | 'commandCheckIn' | 'commandActiveStatusReport' | 'commandActiveStatusReportAlt' |
'commandMoveToHue' | 'commandStore'| 'commandWiserSmartSetSetpoint' | 'commandWiserSmartCalibrateValve' |
'commandSiglisZigfredButtonEvent' | 'commandDanfossSetpointCommand' | 'commandZosungSendIRCode00' |
'commandZosungSendIRCode01' | 'commandZosungSendIRCode02'|'commandZosungSendIRCode04' | 'zosungSendIRCode03Resp' |
'zosungSendIRCode05Resp' | 'commandMcuGatewayConnectionStatus' | 'commandSchneiderWiserThermostatBoost' |
'transferDataResp' | 'commandAction1' | 'commandAction2' | 'commandAction3' | 'commandAction4' | 'commandAction6' |
'commandTuyaAction' | 'commandTuyaAction2' | 'commandMoveToHueAndSaturation';
interface MessagePayload {
type: MessagePayloadType;
device: Device;
endpoint: Endpoint;
linkquality: number;
groupID: number;
cluster: string | number;
data: KeyValue | Array<string | number>;
meta: {
zclTransactionSequenceNumber?: number;
manufacturerCode?: number;
frameControl?: FrameControl;
};
}
export {
Events, MessagePayload, MessagePayloadType, CommandsLookup, DeviceInterviewPayload, DeviceAnnouncePayload,
DeviceLeavePayload, DeviceJoinedPayload, PermitJoinChangedPayload, DeviceNetworkAddressChangedPayload,
LastSeenChangedPayload,
};