homebridge-gree-ac 2.2.2-beta.5 → 2.2.2-beta.6
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 +8 -4
- package/LICENSE +175 -175
- package/README.md +511 -500
- package/config.schema.json +520 -509
- package/dist/commands.d.ts +35 -160
- package/dist/commands.js +160 -162
- package/dist/commands.js.map +1 -1
- package/dist/crypto.d.ts +10 -11
- package/dist/crypto.js +28 -33
- package/dist/crypto.js.map +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +47 -43
- package/dist/platform.js +585 -549
- package/dist/platform.js.map +1 -1
- package/dist/platformAccessory.d.ts +108 -102
- package/dist/platformAccessory.js +1763 -1726
- package/dist/platformAccessory.js.map +1 -1
- package/dist/settings.d.ts +72 -113
- package/dist/settings.js +97 -103
- package/dist/settings.js.map +1 -1
- package/dist/tsAccessory.d.ts +32 -34
- package/dist/tsAccessory.js +69 -71
- package/dist/tsAccessory.js.map +1 -1
- package/dist/version.d.ts +1 -2
- package/dist/version.js +2 -5
- package/dist/version.js.map +1 -1
- package/greedevice.jpg +0 -0
- package/greedevinfo.jpg +0 -0
- package/greemac.jpg +0 -0
- package/ha_fan.jpg +0 -0
- package/ha_settings.jpg +0 -0
- package/package.json +56 -52
- package/uiconfig.jpg +0 -0
- package/uiconfigcustdef.jpg +0 -0
- package/uiconfigmin.jpg +0 -0
- package/dist/commands.d.ts.map +0 -1
- package/dist/crypto.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/platform.d.ts.map +0 -1
- package/dist/platformAccessory.d.ts.map +0 -1
- package/dist/settings.d.ts.map +0 -1
- package/dist/tsAccessory.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
package/dist/settings.d.ts
CHANGED
|
@@ -1,113 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
3
|
-
*/
|
|
4
|
-
export declare const PLATFORM_NAME = "GREEAirConditioner";
|
|
5
|
-
/**
|
|
6
|
-
* This must match the name of your plugin as defined the package.json
|
|
7
|
-
*/
|
|
8
|
-
export declare const PLUGIN_NAME = "homebridge-gree-ac";
|
|
9
|
-
export declare const MODIFY_VERTICAL_SWING_POSITION: {
|
|
10
|
-
never: number;
|
|
11
|
-
overrideDefPowerOn: number;
|
|
12
|
-
overrideDefPowerOnOscDisable: number;
|
|
13
|
-
setPowerOn: number;
|
|
14
|
-
setPowerOnOscDisable: number;
|
|
15
|
-
};
|
|
16
|
-
export declare const ENCRYPTION_VERSION: {
|
|
17
|
-
auto: number;
|
|
18
|
-
v1: number;
|
|
19
|
-
v2: number;
|
|
20
|
-
};
|
|
21
|
-
export declare const TS_TYPE: {
|
|
22
|
-
disabled: string;
|
|
23
|
-
separate: string;
|
|
24
|
-
child: string;
|
|
25
|
-
};
|
|
26
|
-
export declare const TEMPERATURE_STEPS: {
|
|
27
|
-
celsius: number;
|
|
28
|
-
fahrenheit: number;
|
|
29
|
-
};
|
|
30
|
-
export interface DeviceConfig {
|
|
31
|
-
name?: string;
|
|
32
|
-
model?: string;
|
|
33
|
-
speedSteps: number;
|
|
34
|
-
statusUpdateInterval: number;
|
|
35
|
-
sensorOffset: number;
|
|
36
|
-
minimumTargetTemperature: number;
|
|
37
|
-
maximumTargetTemperature: number;
|
|
38
|
-
xFanEnabled: boolean;
|
|
39
|
-
temperatureSensor: string;
|
|
40
|
-
temperatureStepSize?: number;
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
defaultVerticalSwing?: number;
|
|
43
|
-
defaultFanVerticalSwing?: number;
|
|
44
|
-
overrideDefaultVerticalSwing?: number;
|
|
45
|
-
modifyVerticalSwingPosition?: number;
|
|
46
|
-
encryptionVersion?: number;
|
|
47
|
-
port?: number;
|
|
48
|
-
ip?: string;
|
|
49
|
-
fanControlEnabled?: boolean;
|
|
50
|
-
silentTimeRange?: string;
|
|
51
|
-
}
|
|
52
|
-
interface DefaultDeviceConfig extends DeviceConfig {
|
|
53
|
-
temperatureStepSize: number;
|
|
54
|
-
defaultVerticalSwing: number;
|
|
55
|
-
defaultFanVerticalSwing: number;
|
|
56
|
-
modifyVerticalSwingPosition: number;
|
|
57
|
-
encryptionVersion: number;
|
|
58
|
-
}
|
|
59
|
-
export declare const DEFAULT_DEVICE_CONFIG: DefaultDeviceConfig;
|
|
60
|
-
export declare const TEMPERATURE_LIMITS: {
|
|
61
|
-
coolingMinimum: number;
|
|
62
|
-
coolingMaximum: number;
|
|
63
|
-
heatingMinimum: number;
|
|
64
|
-
heatingMaximum: number;
|
|
65
|
-
};
|
|
66
|
-
export declare const UDP_SCAN_PORT = 7000;
|
|
67
|
-
export declare const TEMPERATURE_TABLE: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'11,0': number;
|
|
74
|
-
'11,1': number;
|
|
75
|
-
'12,0': number;
|
|
76
|
-
'12,1': number;
|
|
77
|
-
'13,0': number;
|
|
78
|
-
'13,1': number;
|
|
79
|
-
'14,0': number;
|
|
80
|
-
'14,1': number;
|
|
81
|
-
'15,0': number;
|
|
82
|
-
'15,1': number;
|
|
83
|
-
'16,0': number;
|
|
84
|
-
'17,0': number;
|
|
85
|
-
'17,1': number;
|
|
86
|
-
'18,0': number;
|
|
87
|
-
'18,1': number;
|
|
88
|
-
'19,0': number;
|
|
89
|
-
'19,1': number;
|
|
90
|
-
'20,0': number;
|
|
91
|
-
'21,0': number;
|
|
92
|
-
'21,1': number;
|
|
93
|
-
'22,0': number;
|
|
94
|
-
'22,1': number;
|
|
95
|
-
'23,0': number;
|
|
96
|
-
'23,1': number;
|
|
97
|
-
'24,0': number;
|
|
98
|
-
'24,1': number;
|
|
99
|
-
'25,0': number;
|
|
100
|
-
'26,0': number;
|
|
101
|
-
'26,1': number;
|
|
102
|
-
'27,0': number;
|
|
103
|
-
'27,1': number;
|
|
104
|
-
'28,0': number;
|
|
105
|
-
'28,1': number;
|
|
106
|
-
'29,0': number;
|
|
107
|
-
'29,1': number;
|
|
108
|
-
'30,0': number;
|
|
109
|
-
};
|
|
110
|
-
export declare const DEF_SCAN_INTERVAL = 60;
|
|
111
|
-
export declare const BINDING_TIMEOUT = 60000;
|
|
112
|
-
export {};
|
|
113
|
-
//# sourceMappingURL=settings.d.ts.map
|
|
1
|
+
/**
|
|
2
|
+
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
3
|
+
*/
|
|
4
|
+
export declare const PLATFORM_NAME = "GREEAirConditioner";
|
|
5
|
+
/**
|
|
6
|
+
* This must match the name of your plugin as defined the package.json `name` property
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLUGIN_NAME = "homebridge-gree-ac";
|
|
9
|
+
export declare const MODIFY_VERTICAL_SWING_POSITION: {
|
|
10
|
+
never: number;
|
|
11
|
+
overrideDefPowerOn: number;
|
|
12
|
+
overrideDefPowerOnOscDisable: number;
|
|
13
|
+
setPowerOn: number;
|
|
14
|
+
setPowerOnOscDisable: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const ENCRYPTION_VERSION: {
|
|
17
|
+
auto: number;
|
|
18
|
+
v1: number;
|
|
19
|
+
v2: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const TS_TYPE: {
|
|
22
|
+
disabled: string;
|
|
23
|
+
separate: string;
|
|
24
|
+
child: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const TEMPERATURE_STEPS: {
|
|
27
|
+
celsius: number;
|
|
28
|
+
fahrenheit: number;
|
|
29
|
+
};
|
|
30
|
+
export interface DeviceConfig {
|
|
31
|
+
name?: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
speedSteps: number;
|
|
34
|
+
statusUpdateInterval: number;
|
|
35
|
+
sensorOffset: number;
|
|
36
|
+
minimumTargetTemperature: number;
|
|
37
|
+
maximumTargetTemperature: number;
|
|
38
|
+
xFanEnabled: boolean;
|
|
39
|
+
temperatureSensor: string;
|
|
40
|
+
temperatureStepSize?: number;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
defaultVerticalSwing?: number;
|
|
43
|
+
defaultFanVerticalSwing?: number;
|
|
44
|
+
overrideDefaultVerticalSwing?: number;
|
|
45
|
+
modifyVerticalSwingPosition?: number;
|
|
46
|
+
encryptionVersion?: number;
|
|
47
|
+
port?: number;
|
|
48
|
+
ip?: string;
|
|
49
|
+
fanControlEnabled?: boolean;
|
|
50
|
+
silentTimeRange?: string;
|
|
51
|
+
}
|
|
52
|
+
interface DefaultDeviceConfig extends DeviceConfig {
|
|
53
|
+
temperatureStepSize: number;
|
|
54
|
+
defaultVerticalSwing: number;
|
|
55
|
+
defaultFanVerticalSwing: number;
|
|
56
|
+
modifyVerticalSwingPosition: number;
|
|
57
|
+
encryptionVersion: number;
|
|
58
|
+
}
|
|
59
|
+
export declare const DEFAULT_DEVICE_CONFIG: DefaultDeviceConfig;
|
|
60
|
+
export declare const TEMPERATURE_LIMITS: {
|
|
61
|
+
coolingMinimum: number;
|
|
62
|
+
coolingMaximum: number;
|
|
63
|
+
heatingMinimum: number;
|
|
64
|
+
heatingMaximum: number;
|
|
65
|
+
};
|
|
66
|
+
export declare const UDP_SCAN_PORT = 7000;
|
|
67
|
+
export declare const TEMPERATURE_TABLE: {
|
|
68
|
+
[key: string]: number;
|
|
69
|
+
};
|
|
70
|
+
export declare const DEF_SCAN_INTERVAL = 60;
|
|
71
|
+
export declare const BINDING_TIMEOUT = 60000;
|
|
72
|
+
export {};
|
package/dist/settings.js
CHANGED
|
@@ -1,104 +1,98 @@
|
|
|
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
|
-
'29,0': 29,
|
|
99
|
-
'29,1': 29.5,
|
|
100
|
-
'30,0': 30, // 86 30
|
|
101
|
-
};
|
|
102
|
-
exports.DEF_SCAN_INTERVAL = 60; // seconds
|
|
103
|
-
exports.BINDING_TIMEOUT = 60000; // milliseconds
|
|
1
|
+
import commands from './commands.js';
|
|
2
|
+
/**
|
|
3
|
+
* This is the name of the platform that users will use to register the plugin in the Homebridge config.json
|
|
4
|
+
*/
|
|
5
|
+
export const PLATFORM_NAME = 'GREEAirConditioner';
|
|
6
|
+
/**
|
|
7
|
+
* This must match the name of your plugin as defined the package.json `name` property
|
|
8
|
+
*/
|
|
9
|
+
export const PLUGIN_NAME = 'homebridge-gree-ac';
|
|
10
|
+
export const MODIFY_VERTICAL_SWING_POSITION = {
|
|
11
|
+
never: 0,
|
|
12
|
+
overrideDefPowerOn: 1,
|
|
13
|
+
overrideDefPowerOnOscDisable: 2,
|
|
14
|
+
setPowerOn: 3,
|
|
15
|
+
setPowerOnOscDisable: 4,
|
|
16
|
+
};
|
|
17
|
+
export const ENCRYPTION_VERSION = {
|
|
18
|
+
auto: 0,
|
|
19
|
+
v1: 1,
|
|
20
|
+
v2: 2,
|
|
21
|
+
};
|
|
22
|
+
export const TS_TYPE = {
|
|
23
|
+
disabled: 'disabled',
|
|
24
|
+
separate: 'separate',
|
|
25
|
+
child: 'child',
|
|
26
|
+
};
|
|
27
|
+
export const TEMPERATURE_STEPS = {
|
|
28
|
+
celsius: 1,
|
|
29
|
+
fahrenheit: 0.5,
|
|
30
|
+
};
|
|
31
|
+
export const DEFAULT_DEVICE_CONFIG = {
|
|
32
|
+
speedSteps: 5,
|
|
33
|
+
statusUpdateInterval: 10,
|
|
34
|
+
sensorOffset: 40,
|
|
35
|
+
minimumTargetTemperature: 16,
|
|
36
|
+
maximumTargetTemperature: 30,
|
|
37
|
+
xFanEnabled: true,
|
|
38
|
+
temperatureSensor: TS_TYPE.disabled,
|
|
39
|
+
temperatureStepSize: TEMPERATURE_STEPS.fahrenheit,
|
|
40
|
+
defaultVerticalSwing: commands.swingVertical.value.default,
|
|
41
|
+
defaultFanVerticalSwing: commands.swingVertical.value.default,
|
|
42
|
+
modifyVerticalSwingPosition: MODIFY_VERTICAL_SWING_POSITION.never,
|
|
43
|
+
encryptionVersion: ENCRYPTION_VERSION.auto,
|
|
44
|
+
};
|
|
45
|
+
export const TEMPERATURE_LIMITS = {
|
|
46
|
+
coolingMinimum: 16,
|
|
47
|
+
coolingMaximum: 30,
|
|
48
|
+
heatingMinimum: 8,
|
|
49
|
+
heatingMaximum: 30,
|
|
50
|
+
};
|
|
51
|
+
export const UDP_SCAN_PORT = 7000;
|
|
52
|
+
export const TEMPERATURE_TABLE = {
|
|
53
|
+
//key: 1/2°C °F °F->°C
|
|
54
|
+
'8,0': 8, // 46 7.77
|
|
55
|
+
'8,1': 8.5, // 47 8.33
|
|
56
|
+
'9,0': 9, // 48 8.88
|
|
57
|
+
'9,1': 9.5, // 49 9.44
|
|
58
|
+
'10,0': 10, // 50 10
|
|
59
|
+
'11,0': 10.5, // 51 10.55
|
|
60
|
+
'11,1': 11, // 52 11.11
|
|
61
|
+
'12,0': 11.5, // 53 11.66
|
|
62
|
+
'12,1': 12, // 54 12.22
|
|
63
|
+
'13,0': 13, // 55 12.77
|
|
64
|
+
'13,1': 13.5, // 56 13.33
|
|
65
|
+
'14,0': 14, // 57 13.88
|
|
66
|
+
'14,1': 14.5, // 58 14.44
|
|
67
|
+
'15,0': 15, // 59 15
|
|
68
|
+
'15,1': 15.5, // 60 15.55
|
|
69
|
+
'16,0': 16, // 61 16.11
|
|
70
|
+
'17,0': 16.5, // 62 16.66
|
|
71
|
+
'17,1': 17, // 63 17.22
|
|
72
|
+
'18,0': 18, // 64 17.77
|
|
73
|
+
'18,1': 18.5, // 65 18.33
|
|
74
|
+
'19,0': 19, // 66 18.88
|
|
75
|
+
'19,1': 19.5, // 67 19.44
|
|
76
|
+
'20,0': 20, // 68 20
|
|
77
|
+
'21,0': 20.5, // 69 20.55
|
|
78
|
+
'21,1': 21, // 70 21.11
|
|
79
|
+
'22,0': 21.5, // 71 21.66
|
|
80
|
+
'22,1': 22, // 72 22.22
|
|
81
|
+
'23,0': 23, // 73 22.77
|
|
82
|
+
'23,1': 23.5, // 74 23.33
|
|
83
|
+
'24,0': 24, // 75 23.88
|
|
84
|
+
'24,1': 24.5, // 76 24.44
|
|
85
|
+
'25,0': 25, // 77 25
|
|
86
|
+
'26,0': 25.5, // 78 25.55
|
|
87
|
+
'26,1': 26, // 79 26.11
|
|
88
|
+
'27,0': 26.5, // 80 26.66
|
|
89
|
+
'27,1': 27, // 81 27.22
|
|
90
|
+
'28,0': 28, // 82 27.77
|
|
91
|
+
'28,1': 28.5, // 83 28.33
|
|
92
|
+
'29,0': 29, // 84 28.88
|
|
93
|
+
'29,1': 29.5, // 85 29.44
|
|
94
|
+
'30,0': 30, // 86 30
|
|
95
|
+
};
|
|
96
|
+
export const DEF_SCAN_INTERVAL = 60; // seconds
|
|
97
|
+
export const BINDING_TIMEOUT = 60000; // milliseconds
|
|
104
98
|
//# sourceMappingURL=settings.js.map
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEhD,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,KAAK,EAAE,CAAC;IACR,kBAAkB,EAAE,CAAC;IACrB,4BAA4B,EAAE,CAAC;IAC/B,UAAU,EAAE,CAAC;IACb,oBAAoB,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACN,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,K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AAe,GAAG,KAAK,CAAC,CAAC,eAAe"}
|
package/dist/tsAccessory.d.ts
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GreeACPlatform, MyPlatformAccessory } from './platform';
|
|
3
|
-
/**
|
|
4
|
-
* Platform Accessory
|
|
5
|
-
* An instance of this class is created for each accessory your platform registers
|
|
6
|
-
* Each accessory may expose multiple services of different service types.
|
|
7
|
-
*/
|
|
8
|
-
export declare class GreeAirConditionerTS {
|
|
9
|
-
private readonly platform;
|
|
10
|
-
private readonly accessory;
|
|
11
|
-
TemperatureSensor: Service;
|
|
12
|
-
private currentTemperature;
|
|
13
|
-
constructor(platform: GreeACPlatform, accessory: MyPlatformAccessory);
|
|
14
|
-
/**
|
|
15
|
-
* Handle the "GET" requests from HomeKit
|
|
16
|
-
* These are sent when HomeKit wants to know the current state of the accessory
|
|
17
|
-
*
|
|
18
|
-
* GET requests should return as fast as
|
|
19
|
-
* HomeKit being unresponsive and a bad user experience in general.
|
|
20
|
-
*
|
|
21
|
-
* If your device takes time to respond you should update the status of your device
|
|
22
|
-
* asynchronously instead using the `updateCharacteristic` method instead.
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=tsAccessory.d.ts.map
|
|
1
|
+
import type { CharacteristicValue, Service } from 'homebridge';
|
|
2
|
+
import type { GreeACPlatform, MyPlatformAccessory } from './platform.js';
|
|
3
|
+
/**
|
|
4
|
+
* Platform Accessory
|
|
5
|
+
* An instance of this class is created for each accessory your platform registers
|
|
6
|
+
* Each accessory may expose multiple services of different service types.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GreeAirConditionerTS {
|
|
9
|
+
private readonly platform;
|
|
10
|
+
private readonly accessory;
|
|
11
|
+
TemperatureSensor: Service;
|
|
12
|
+
private currentTemperature;
|
|
13
|
+
constructor(platform: GreeACPlatform, accessory: MyPlatformAccessory);
|
|
14
|
+
/**
|
|
15
|
+
* Handle the "GET" requests from HomeKit
|
|
16
|
+
* These are sent when HomeKit wants to know the current state of the accessory, for example, checking if a Light bulb is on.
|
|
17
|
+
*
|
|
18
|
+
* GET requests should return as fast as possible. A long delay here will result in
|
|
19
|
+
* HomeKit being unresponsive and a bad user experience in general.
|
|
20
|
+
*
|
|
21
|
+
* If your device takes time to respond you should update the status of your device
|
|
22
|
+
* asynchronously instead using the `updateCharacteristic` method instead.
|
|
23
|
+
* In this case, you may decide not to implement `onGet` handlers, which may speed up
|
|
24
|
+
* the responsiveness of your device in the Home app.
|
|
25
|
+
|
|
26
|
+
* @example
|
|
27
|
+
* this.service.updateCharacteristic(this.platform.Characteristic.On, true)
|
|
28
|
+
*/
|
|
29
|
+
getCurrentTemperature(): Promise<CharacteristicValue>;
|
|
30
|
+
setCurrentTemperature(value: number): void;
|
|
31
|
+
getDeviceLabel(): string;
|
|
32
|
+
}
|
package/dist/tsAccessory.js
CHANGED
|
@@ -1,72 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
// register accessory in homebridge by api if not registered before
|
|
16
|
-
if (!this.accessory.registered) {
|
|
17
|
-
this.platform.log.debug(`[${this.getDeviceLabel()}] registering new accessory in homebridge:`, this.accessory.context.device.mac, this.accessory.UUID);
|
|
18
|
-
this.platform.api.registerPlatformAccessories(
|
|
19
|
-
// set static accessory information
|
|
20
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
21
|
-
.setCharacteristic(this.platform.Characteristic.Manufacturer, this.accessory.context.device.brand || 'Gree')
|
|
22
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, this.accessory.context.device.mac)
|
|
23
|
-
.setCharacteristic(this.platform.Characteristic.Model, this.accessory.context.device.model || this.accessory.context.device.name || 'Air Conditioner')
|
|
24
|
-
.setCharacteristic(this.platform.Characteristic.HardwareRevision, this.accessory.context.device.ver ?
|
|
25
|
-
this.accessory.context.device.ver.substring(this.accessory.context.device.ver.lastIndexOf('V') + 1) : '1.0.0')
|
|
26
|
-
.setCharacteristic(this.platform.Characteristic.Name, this.accessory.displayName);
|
|
27
|
-
}
|
|
28
|
-
// set accessory information
|
|
29
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
30
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.accessory.context.device.hid && this.accessory.context.device.hid.lastIndexOf('V') >= 0 &&
|
|
31
|
-
this.accessory.context.device.hid.lastIndexOf('V') < this.accessory.context.device.hid.lastIndexOf('.') ?
|
|
32
|
-
this.accessory.context.device.hid.substring(this.accessory.context.device.hid.lastIndexOf('V') + 1, this.accessory.context.device.hid.lastIndexOf('.')) : '1.0.0');
|
|
33
|
-
this.platform.api.updatePlatformAccessories([this.accessory]);
|
|
34
|
-
// get the TemperatureSensor service if it exists, otherwise create a new TemperatureSensor service
|
|
35
|
-
// we don't use subtype because we add only one service with this type
|
|
36
|
-
this.TemperatureSensor = this.accessory.getService(this.platform.Service.TemperatureSensor) ||
|
|
37
|
-
this.accessory.addService(this.platform.Service.TemperatureSensor, this.accessory.displayName, undefined);
|
|
38
|
-
// register handlers for the Current Temperature Characteristic
|
|
39
|
-
this.TemperatureSensor.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
40
|
-
.onGet(this.getCurrentTemperature.bind(this));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Handle the "GET" requests from HomeKit
|
|
44
|
-
* These are sent when HomeKit wants to know the current state of the accessory
|
|
45
|
-
*
|
|
46
|
-
* GET requests should return as fast as
|
|
47
|
-
* HomeKit being unresponsive and a bad user experience in general.
|
|
48
|
-
*
|
|
49
|
-
* If your device takes time to respond you should update the status of your device
|
|
50
|
-
* asynchronously instead using the `updateCharacteristic` method instead.
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
exports.GreeAirConditionerTS = GreeAirConditionerTS;
|
|
1
|
+
import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';
|
|
2
|
+
/**
|
|
3
|
+
* Platform Accessory
|
|
4
|
+
* An instance of this class is created for each accessory your platform registers
|
|
5
|
+
* Each accessory may expose multiple services of different service types.
|
|
6
|
+
*/
|
|
7
|
+
export class GreeAirConditionerTS {
|
|
8
|
+
platform;
|
|
9
|
+
accessory;
|
|
10
|
+
TemperatureSensor;
|
|
11
|
+
currentTemperature = 25;
|
|
12
|
+
constructor(platform, accessory) {
|
|
13
|
+
this.platform = platform;
|
|
14
|
+
this.accessory = accessory;
|
|
15
|
+
// register accessory in homebridge by api if not registered before
|
|
16
|
+
if (!this.accessory.registered) {
|
|
17
|
+
this.platform.log.debug(`[${this.getDeviceLabel()}] registering new accessory in homebridge:`, this.accessory.context.device.mac, this.accessory.UUID);
|
|
18
|
+
this.platform.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [this.accessory]);
|
|
19
|
+
// set static accessory information
|
|
20
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
21
|
+
.setCharacteristic(this.platform.Characteristic.Manufacturer, this.accessory.context.device.brand || 'Gree')
|
|
22
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, this.accessory.context.device.mac)
|
|
23
|
+
.setCharacteristic(this.platform.Characteristic.Model, this.accessory.context.device.model || this.accessory.context.device.name || 'Air Conditioner')
|
|
24
|
+
.setCharacteristic(this.platform.Characteristic.HardwareRevision, this.accessory.context.device.ver ?
|
|
25
|
+
this.accessory.context.device.ver.substring(this.accessory.context.device.ver.lastIndexOf('V') + 1) : '1.0.0')
|
|
26
|
+
.setCharacteristic(this.platform.Characteristic.Name, this.accessory.displayName);
|
|
27
|
+
}
|
|
28
|
+
// set accessory information
|
|
29
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
30
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.accessory.context.device.hid && this.accessory.context.device.hid.lastIndexOf('V') >= 0 &&
|
|
31
|
+
this.accessory.context.device.hid.lastIndexOf('V') < this.accessory.context.device.hid.lastIndexOf('.') ?
|
|
32
|
+
this.accessory.context.device.hid.substring(this.accessory.context.device.hid.lastIndexOf('V') + 1, this.accessory.context.device.hid.lastIndexOf('.')) : '1.0.0');
|
|
33
|
+
this.platform.api.updatePlatformAccessories([this.accessory]);
|
|
34
|
+
// get the TemperatureSensor service if it exists, otherwise create a new TemperatureSensor service
|
|
35
|
+
// we don't use subtype because we add only one service with this type
|
|
36
|
+
this.TemperatureSensor = this.accessory.getService(this.platform.Service.TemperatureSensor) ||
|
|
37
|
+
this.accessory.addService(this.platform.Service.TemperatureSensor, this.accessory.displayName, undefined);
|
|
38
|
+
// register handlers for the Current Temperature Characteristic
|
|
39
|
+
this.TemperatureSensor.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
40
|
+
.onGet(this.getCurrentTemperature.bind(this));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Handle the "GET" requests from HomeKit
|
|
44
|
+
* These are sent when HomeKit wants to know the current state of the accessory, for example, checking if a Light bulb is on.
|
|
45
|
+
*
|
|
46
|
+
* GET requests should return as fast as possible. A long delay here will result in
|
|
47
|
+
* HomeKit being unresponsive and a bad user experience in general.
|
|
48
|
+
*
|
|
49
|
+
* If your device takes time to respond you should update the status of your device
|
|
50
|
+
* asynchronously instead using the `updateCharacteristic` method instead.
|
|
51
|
+
* In this case, you may decide not to implement `onGet` handlers, which may speed up
|
|
52
|
+
* the responsiveness of your device in the Home app.
|
|
53
|
+
|
|
54
|
+
* @example
|
|
55
|
+
* this.service.updateCharacteristic(this.platform.Characteristic.On, true)
|
|
56
|
+
*/
|
|
57
|
+
async getCurrentTemperature() {
|
|
58
|
+
this.platform.log.debug(`[${this.getDeviceLabel()}] Get CurrentTemperature ->`, this.currentTemperature);
|
|
59
|
+
return this.currentTemperature;
|
|
60
|
+
}
|
|
61
|
+
// helper functions
|
|
62
|
+
setCurrentTemperature(value) {
|
|
63
|
+
this.currentTemperature = value;
|
|
64
|
+
this.platform.log.debug(`[${this.getDeviceLabel()}] updateStatus (Current Temperature) ->`, this.currentTemperature);
|
|
65
|
+
}
|
|
66
|
+
getDeviceLabel() {
|
|
67
|
+
return `${this.accessory.displayName} -- ${this.accessory.context.device.address}:${this.accessory.context.device.port}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
72
70
|
//# sourceMappingURL=tsAccessory.js.map
|
package/dist/tsAccessory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsAccessory.js","sourceRoot":"","sources":["../src/tsAccessory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tsAccessory.js","sourceRoot":"","sources":["../src/tsAccessory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3D;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAKR;IACA;IALhB,iBAAiB,CAAU;IAC1B,kBAAkB,GAAG,EAAE,CAAC;IAEhC,YACuB,QAAwB,EACxB,SAA8B;QAD9B,aAAQ,GAAR,QAAQ,CAAgB;QACxB,cAAS,GAAT,SAAS,CAAqB;QAEnD,mEAAmE;QACnE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;YAC/B,IAAI,CAAC,QA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