homebridge-gree-ac 1.0.1 → 2.0.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/CHANGELOG.md +19 -0
- package/LICENSE +176 -21
- package/README.md +180 -42
- package/config.schema.json +277 -0
- package/dist/commands.d.ts +121 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +123 -0
- package/dist/commands.js.map +1 -0
- package/dist/crypto.d.ts +6 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +19 -0
- package/dist/crypto.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +35 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +203 -0
- package/dist/platform.js.map +1 -0
- package/dist/platformAccessory.d.ts +89 -0
- package/dist/platformAccessory.d.ts.map +1 -0
- package/dist/platformAccessory.js +867 -0
- package/dist/platformAccessory.js.map +1 -0
- package/dist/settings.d.ts +51 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +50 -0
- package/dist/settings.js.map +1 -0
- package/dist/tsAccessory.d.ts +36 -0
- package/dist/tsAccessory.d.ts.map +1 -0
- package/dist/tsAccessory.js +65 -0
- package/dist/tsAccessory.js.map +1 -0
- package/greedevice.jpg +0 -0
- package/greemac.jpg +0 -0
- package/package.json +51 -23
- package/uiconfig.jpg +0 -0
- package/app/commandEnums.js +0 -137
- package/app/deviceFactory.js +0 -286
- package/app/encryptionService.js +0 -39
- package/example.config.json +0 -20
- package/index.js +0 -339
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "GREEAirConditioner",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": true,
|
|
5
|
+
"schema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"required": true,
|
|
11
|
+
"default": "GREE Air Conditioner"
|
|
12
|
+
},
|
|
13
|
+
"port": {
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"required": true,
|
|
16
|
+
"default": 7002,
|
|
17
|
+
"minimum": 1025
|
|
18
|
+
},
|
|
19
|
+
"scanAddress": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"required": true,
|
|
22
|
+
"default": "192.168.1.255",
|
|
23
|
+
"format": "ipv4"
|
|
24
|
+
},
|
|
25
|
+
"scanCount": {
|
|
26
|
+
"type": "integer",
|
|
27
|
+
"required": true,
|
|
28
|
+
"default": 10,
|
|
29
|
+
"minimum": 3
|
|
30
|
+
},
|
|
31
|
+
"scanTimeout": {
|
|
32
|
+
"type": "integer",
|
|
33
|
+
"required": true,
|
|
34
|
+
"default": 3,
|
|
35
|
+
"minimum": 1
|
|
36
|
+
},
|
|
37
|
+
"devices": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"mac": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"required": true,
|
|
45
|
+
"pattern": "^[a-f0-9]{12}$"
|
|
46
|
+
},
|
|
47
|
+
"name": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"required": false
|
|
50
|
+
},
|
|
51
|
+
"model": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"required": false
|
|
54
|
+
},
|
|
55
|
+
"speedSteps": {
|
|
56
|
+
"type": "integer",
|
|
57
|
+
"required": true,
|
|
58
|
+
"default": 5,
|
|
59
|
+
"oneOf": [
|
|
60
|
+
{
|
|
61
|
+
"title": "3-step model",
|
|
62
|
+
"enum": [
|
|
63
|
+
3
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"title": "5-step model",
|
|
68
|
+
"enum": [
|
|
69
|
+
5
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"statusUpdateInterval": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"required": false,
|
|
77
|
+
"minimum": 1,
|
|
78
|
+
"default": 10
|
|
79
|
+
},
|
|
80
|
+
"sensorOffset": {
|
|
81
|
+
"type": "integer",
|
|
82
|
+
"required": false,
|
|
83
|
+
"default": 40
|
|
84
|
+
},
|
|
85
|
+
"minimumTargetTemperature": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"required": false,
|
|
88
|
+
"minimum": 16,
|
|
89
|
+
"default": 16
|
|
90
|
+
},
|
|
91
|
+
"maximumTargetTemperature": {
|
|
92
|
+
"type": "integer",
|
|
93
|
+
"required": false,
|
|
94
|
+
"maximum": 30,
|
|
95
|
+
"default": 30
|
|
96
|
+
},
|
|
97
|
+
"xFanEnabled": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"default": false
|
|
100
|
+
},
|
|
101
|
+
"temperatureSensor": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"required": true,
|
|
104
|
+
"default": "disabled",
|
|
105
|
+
"oneOf": [
|
|
106
|
+
{
|
|
107
|
+
"title": "Disabled",
|
|
108
|
+
"enum": [
|
|
109
|
+
"disabled"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"title": "Child accessory",
|
|
114
|
+
"enum": [
|
|
115
|
+
"child"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"title": "Separate accessory",
|
|
120
|
+
"enum": [
|
|
121
|
+
"separate"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"disabled": {
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"layout": [
|
|
135
|
+
{
|
|
136
|
+
"key": "name",
|
|
137
|
+
"title": "Name:"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"type": "flex",
|
|
141
|
+
"flex-flow": "row wrap",
|
|
142
|
+
"items": [
|
|
143
|
+
{
|
|
144
|
+
"key": "scanAddress",
|
|
145
|
+
"flex": "1 1 50%",
|
|
146
|
+
"title": "Scan address:",
|
|
147
|
+
"description": "Local network broadcast address"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"key": "port",
|
|
151
|
+
"flex": "1 1 50%",
|
|
152
|
+
"title": "Port:"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"key": "scanCount",
|
|
156
|
+
"flex": "1 1 50%",
|
|
157
|
+
"title": "Scan count:",
|
|
158
|
+
"description": "Initial device discovery retry count"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"key": "scanTimeout",
|
|
162
|
+
"flex": "1 1 50%",
|
|
163
|
+
"title": "Scan timeout:",
|
|
164
|
+
"description": "Timeout in seconds between device discovery retries"
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"type": "array",
|
|
170
|
+
"key": "devices",
|
|
171
|
+
"title": "Devices",
|
|
172
|
+
"buttonText": "Add device",
|
|
173
|
+
"expandable": true,
|
|
174
|
+
"expanded": false,
|
|
175
|
+
"items": [
|
|
176
|
+
{
|
|
177
|
+
"type": "div",
|
|
178
|
+
"displayFlex": true,
|
|
179
|
+
"flex-flow": "row wrap",
|
|
180
|
+
"items": [
|
|
181
|
+
{
|
|
182
|
+
"key": "devices[].mac",
|
|
183
|
+
"flex": "1 1 50%",
|
|
184
|
+
"title": "MAC address (Serial Number):",
|
|
185
|
+
"description": "MAC address of the device using lowercase letters and no separators"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"key": "devices[].name",
|
|
189
|
+
"flex": "1 1 50%",
|
|
190
|
+
"title": "Device name:",
|
|
191
|
+
"description": "Custom name of the device"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"key": "devices[].disabled",
|
|
195
|
+
"flex": "1 1 100%",
|
|
196
|
+
"title": "Disabled",
|
|
197
|
+
"description": "If checked, this accessory will be removed and ignored from HomeKit.",
|
|
198
|
+
"condition": {
|
|
199
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac));"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"key": "devices[].model",
|
|
204
|
+
"flex": "1 1 50%",
|
|
205
|
+
"title": "Device model:",
|
|
206
|
+
"condition": {
|
|
207
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"key": "devices[].speedSteps",
|
|
212
|
+
"flex": "1 1 50%",
|
|
213
|
+
"title": "Fan speed steps:",
|
|
214
|
+
"condition": {
|
|
215
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"key": "devices[].statusUpdateInterval",
|
|
220
|
+
"flex": "1 1 50%",
|
|
221
|
+
"title": "Status update interval:",
|
|
222
|
+
"description": "Update interval (in seconds)",
|
|
223
|
+
"condition": {
|
|
224
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"key": "devices[].sensorOffset",
|
|
229
|
+
"flex": "1 1 50%",
|
|
230
|
+
"title": "Temperature offset:",
|
|
231
|
+
"description": "Temperature sensor calibration (in Degrees Celsius)",
|
|
232
|
+
"condition": {
|
|
233
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"key": "devices[].minimumTargetTemperature",
|
|
238
|
+
"flex": "1 1 50%",
|
|
239
|
+
"title": "Minimum target temperature:",
|
|
240
|
+
"description": "Minimum target temperature (in Degrees Celsius)",
|
|
241
|
+
"condition": {
|
|
242
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"key": "devices[].maximumTargetTemperature",
|
|
247
|
+
"flex": "1 1 50%",
|
|
248
|
+
"title": "Maximum target temperature:",
|
|
249
|
+
"description": "Maximum target temperature (in Degrees Celsius)",
|
|
250
|
+
"condition": {
|
|
251
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"key": "devices[].xFanEnabled",
|
|
256
|
+
"flex": "1 1 50%",
|
|
257
|
+
"title": "xFan enabled",
|
|
258
|
+
"description": "If enabled, then xFan functionality is turned on automatically on the device",
|
|
259
|
+
"condition": {
|
|
260
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"key": "devices[].temperatureSensor",
|
|
265
|
+
"flex": "1 1 50%",
|
|
266
|
+
"title": "Temperature sensor:",
|
|
267
|
+
"description": "Additional temperature sensor in Home App",
|
|
268
|
+
"condition": {
|
|
269
|
+
"functionBody": "return (model.devices && model.devices[arrayIndices] && model.devices[arrayIndices].mac && /^[a-f0-9]{12}$/.test(model.devices[arrayIndices].mac) && model.devices[arrayIndices].disabled !== true);"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
declare const commands: {
|
|
2
|
+
power: {
|
|
3
|
+
code: string;
|
|
4
|
+
value: {
|
|
5
|
+
off: number;
|
|
6
|
+
on: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
mode: {
|
|
10
|
+
code: string;
|
|
11
|
+
value: {
|
|
12
|
+
auto: number;
|
|
13
|
+
cool: number;
|
|
14
|
+
dry: number;
|
|
15
|
+
fan: number;
|
|
16
|
+
heat: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
targetTemperature: {
|
|
20
|
+
code: string;
|
|
21
|
+
};
|
|
22
|
+
temperature: {
|
|
23
|
+
code: string;
|
|
24
|
+
};
|
|
25
|
+
units: {
|
|
26
|
+
code: string;
|
|
27
|
+
value: {
|
|
28
|
+
celsius: number;
|
|
29
|
+
fahrenheit: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
temperatureOffset: {
|
|
33
|
+
code: string;
|
|
34
|
+
};
|
|
35
|
+
speed: {
|
|
36
|
+
code: string;
|
|
37
|
+
value: {
|
|
38
|
+
auto: number;
|
|
39
|
+
low: number;
|
|
40
|
+
mediumLow: number;
|
|
41
|
+
medium: number;
|
|
42
|
+
mediumHigh: number;
|
|
43
|
+
high: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
swingHorizontal: {
|
|
47
|
+
code: string;
|
|
48
|
+
value: {
|
|
49
|
+
default: number;
|
|
50
|
+
full: number;
|
|
51
|
+
left: number;
|
|
52
|
+
centerLeft: number;
|
|
53
|
+
center: number;
|
|
54
|
+
centerRight: number;
|
|
55
|
+
right: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
swingVertical: {
|
|
59
|
+
code: string;
|
|
60
|
+
value: {
|
|
61
|
+
default: number;
|
|
62
|
+
full: number;
|
|
63
|
+
fixedHighest: number;
|
|
64
|
+
fixedHigher: number;
|
|
65
|
+
fixedMiddle: number;
|
|
66
|
+
fixedLower: number;
|
|
67
|
+
fixedLowest: number;
|
|
68
|
+
swingLowest: number;
|
|
69
|
+
swingLower: number;
|
|
70
|
+
swingMiddle: number;
|
|
71
|
+
swingHigher: number;
|
|
72
|
+
swingHighest: number;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
xFan: {
|
|
76
|
+
code: string;
|
|
77
|
+
value: {
|
|
78
|
+
off: number;
|
|
79
|
+
on: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
light: {
|
|
83
|
+
code: string;
|
|
84
|
+
value: {
|
|
85
|
+
off: number;
|
|
86
|
+
on: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
quietMode: {
|
|
90
|
+
code: string;
|
|
91
|
+
value: {
|
|
92
|
+
off: number;
|
|
93
|
+
on: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
powerfulMode: {
|
|
97
|
+
code: string;
|
|
98
|
+
value: {
|
|
99
|
+
off: number;
|
|
100
|
+
on: number;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
HeatCoolType: {
|
|
104
|
+
code: string;
|
|
105
|
+
};
|
|
106
|
+
energySaving: {
|
|
107
|
+
code: string;
|
|
108
|
+
};
|
|
109
|
+
sleepMode: {
|
|
110
|
+
code: string;
|
|
111
|
+
value: {
|
|
112
|
+
off: number;
|
|
113
|
+
on: number;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
time: {
|
|
117
|
+
code: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export default commands;
|
|
121
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsHb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const commands = {
|
|
4
|
+
power: {
|
|
5
|
+
code: 'Pow',
|
|
6
|
+
value: {
|
|
7
|
+
off: 0,
|
|
8
|
+
on: 1,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
mode: {
|
|
12
|
+
code: 'Mod',
|
|
13
|
+
value: {
|
|
14
|
+
auto: 0,
|
|
15
|
+
cool: 1,
|
|
16
|
+
dry: 2,
|
|
17
|
+
fan: 3,
|
|
18
|
+
heat: 4,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
targetTemperature: {
|
|
22
|
+
code: 'SetTem',
|
|
23
|
+
},
|
|
24
|
+
temperature: {
|
|
25
|
+
code: 'TemSen',
|
|
26
|
+
},
|
|
27
|
+
units: {
|
|
28
|
+
code: 'TemUn',
|
|
29
|
+
value: {
|
|
30
|
+
celsius: 0,
|
|
31
|
+
fahrenheit: 1,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
temperatureOffset: {
|
|
35
|
+
code: 'TemRec',
|
|
36
|
+
},
|
|
37
|
+
speed: {
|
|
38
|
+
code: 'WdSpd',
|
|
39
|
+
value: {
|
|
40
|
+
auto: 0,
|
|
41
|
+
low: 1,
|
|
42
|
+
mediumLow: 2,
|
|
43
|
+
medium: 3,
|
|
44
|
+
mediumHigh: 4,
|
|
45
|
+
high: 5,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
swingHorizontal: {
|
|
49
|
+
code: 'SwingLfRig',
|
|
50
|
+
value: {
|
|
51
|
+
default: 0,
|
|
52
|
+
full: 1,
|
|
53
|
+
left: 2,
|
|
54
|
+
centerLeft: 3,
|
|
55
|
+
center: 4,
|
|
56
|
+
centerRight: 5,
|
|
57
|
+
right: 6,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
swingVertical: {
|
|
61
|
+
code: 'SwUpDn',
|
|
62
|
+
value: {
|
|
63
|
+
default: 0,
|
|
64
|
+
full: 1,
|
|
65
|
+
fixedHighest: 2,
|
|
66
|
+
fixedHigher: 3,
|
|
67
|
+
fixedMiddle: 4,
|
|
68
|
+
fixedLower: 5,
|
|
69
|
+
fixedLowest: 6,
|
|
70
|
+
swingLowest: 7,
|
|
71
|
+
swingLower: 8,
|
|
72
|
+
swingMiddle: 9,
|
|
73
|
+
swingHigher: 10,
|
|
74
|
+
swingHighest: 11, // swing in the upmost region (1/5)
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
xFan: {
|
|
78
|
+
code: 'Blo',
|
|
79
|
+
value: {
|
|
80
|
+
off: 0,
|
|
81
|
+
on: 1,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
light: {
|
|
85
|
+
code: 'Lig',
|
|
86
|
+
value: {
|
|
87
|
+
off: 0,
|
|
88
|
+
on: 1,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
quietMode: {
|
|
92
|
+
code: 'Quiet',
|
|
93
|
+
value: {
|
|
94
|
+
off: 0,
|
|
95
|
+
on: 2,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
powerfulMode: {
|
|
99
|
+
code: 'Tur',
|
|
100
|
+
value: {
|
|
101
|
+
off: 0,
|
|
102
|
+
on: 1,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
HeatCoolType: {
|
|
106
|
+
code: 'HeatCoolType',
|
|
107
|
+
},
|
|
108
|
+
energySaving: {
|
|
109
|
+
code: 'SvSt',
|
|
110
|
+
},
|
|
111
|
+
sleepMode: {
|
|
112
|
+
code: 'SwhSlp',
|
|
113
|
+
value: {
|
|
114
|
+
off: 0,
|
|
115
|
+
on: 1,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
time: {
|
|
119
|
+
code: 'time',
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
exports.default = commands;
|
|
123
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG;IACf,KAAK,EAAE;QACL,IAAI,EAAE,KAAK;QACX,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,KAAK,EAAE;YACL,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;SACR;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;KACf;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;KACf;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,CAAC;SACd;KACF;IACD,iBAAiB,EAAE;QACjB,IAAI,EAAE,QAAQ;KACf;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,CAAC;YACT,UAAU,EAAE,CAAC;YACb,IAAI,EAAE,CAAC;SACR;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE;YACL,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,CAAC;YACP,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,CAAC;YACT,WAAW,EAAE,CAAC;YACd,KAAK,EAAE,CAAC;SACT;KACF;IACD,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE;YACL,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,CAAC;YACP,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,EAAE;YACf,YAAY,EAAE,EAAE,EAAE,mCAAmC;SACtD;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,KAAK,EAAE;QACL,IAAI,EAAE,KAAK;QACX,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,SAAS,EAAE;QACT,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;KACrB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM;KACb;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,EAAE,EAAE,CAAC;SACN;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;KACb;CACF,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";;;;AAIA,wBAUE"}
|
package/dist/crypto.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
7
|
+
const genericKey = 'a3K8Bx%2r8Y7#xDh';
|
|
8
|
+
exports.default = {
|
|
9
|
+
encrypt: (data, key = genericKey) => {
|
|
10
|
+
const string = JSON.stringify(data);
|
|
11
|
+
const cipher = crypto_1.default.createCipheriv('aes-128-ecb', key, null);
|
|
12
|
+
return cipher.update(string, 'utf8', 'base64') + cipher.final('base64');
|
|
13
|
+
},
|
|
14
|
+
decrypt: (data, key = genericKey) => {
|
|
15
|
+
const decipher = crypto_1.default.createDecipheriv('aes-128-ecb', key, null);
|
|
16
|
+
return JSON.parse(decipher.update(data, 'base64', 'utf8') + decipher.final('utf8'));
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,kBAAe;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,UAAU,EAAE,EAAE;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,gBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,UAAU,EAAE,EAAE;QAClC,MAAM,QAAQ,GAAG,gBAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACtF,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAKjC;;GAEG;8BACY,GAAG;AAAlB,kBAEE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,yCAA2C;AAC3C,yCAA4C;AAK5C,iBAAS,CAAC,GAAQ,EAAE,EAAE;IACpB,GAAG,CAAC,gBAAgB,CAAC,wBAAa,EAAE,yBAAc,CAAC,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
|
|
2
|
+
import { GreeAirConditioner } from './platformAccessory';
|
|
3
|
+
/**
|
|
4
|
+
* HomebridgePlatform
|
|
5
|
+
* This class is the main constructor for your plugin, this is where you should
|
|
6
|
+
* parse the user config and discover/register accessories with Homebridge.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GreeACPlatform implements DynamicPlatformPlugin {
|
|
9
|
+
readonly log: Logger;
|
|
10
|
+
readonly config: PlatformConfig;
|
|
11
|
+
readonly api: API;
|
|
12
|
+
readonly Service: typeof Service;
|
|
13
|
+
readonly Characteristic: typeof Characteristic;
|
|
14
|
+
private devices;
|
|
15
|
+
private initializedDevices;
|
|
16
|
+
private skippedDevices;
|
|
17
|
+
private socket;
|
|
18
|
+
private timer;
|
|
19
|
+
private scanCount;
|
|
20
|
+
constructor(log: Logger, config: PlatformConfig, api: API);
|
|
21
|
+
/**
|
|
22
|
+
* This function is invoked when homebridge restores cached accessories from disk at startup.
|
|
23
|
+
* It should be used to setup event handlers for characteristics and update respective values.
|
|
24
|
+
*/
|
|
25
|
+
configureAccessory(accessory: PlatformAccessory): void;
|
|
26
|
+
/**
|
|
27
|
+
* Accessories must only be registered once, previously created accessories
|
|
28
|
+
* must not be registered again to prevent "duplicate UUID" errors.
|
|
29
|
+
*/
|
|
30
|
+
discoverDevices(): void;
|
|
31
|
+
handleMessage: (msg: any, rinfo: any) => void;
|
|
32
|
+
registerDevice: (deviceInfo: any) => GreeAirConditioner | undefined;
|
|
33
|
+
broadcastScan(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAc,MAAM,YAAY,CAAC;AAGxI,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD;;;;GAIG;AACH,qBAAa,cAAe,YAAW,qBAAqB;aAaxC,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAd1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAwB;IAC/D,SAAgB,cAAc,EAAE,OAAO,cAAc,CAA+B;IAGpF,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,kBAAkB,CAA0B;IACpD,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,SAAS,CAAS;gBAGR,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IAqB1B;;;OAGG;IACH,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAgB/C;;;OAGG;IACH,eAAe;IA6Bf,aAAa,iCAkBX;IAEF,cAAc,sDAqFZ;IAEF,aAAa;CASd"}
|