@beenoco/homebridge-samsung-ac 0.1.0-beta.1 → 0.2.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.
@@ -54,6 +54,7 @@
54
54
  "title": "Device Token",
55
55
  "type": "string",
56
56
  "required": true,
57
+ "format": "password",
57
58
  "placeholder": "xxxxxxxxxx",
58
59
  "description": "The device token retrieved from the Wi-Fi Kit during pairing"
59
60
  },
@@ -0,0 +1,36 @@
1
+ import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
2
+ import { BeenocoSamsungAcPlatform } from './platform';
3
+ import * as API from './api';
4
+ export declare class BeenocoSamsungAcPlatformAccessory {
5
+ private readonly platform;
6
+ private readonly accessory;
7
+ private api;
8
+ private service;
9
+ private fanService;
10
+ private deviceStatusPromise;
11
+ constructor(platform: BeenocoSamsungAcPlatform, accessory: PlatformAccessory);
12
+ createService(): Service;
13
+ createFanService(): Service;
14
+ updateService(device: API.DeviceStatus): void;
15
+ updateFanService(device: API.DeviceStatus): void;
16
+ getDeviceStatus(): Promise<API.DeviceStatus>;
17
+ handleTargetTemperatureGet(): Promise<CharacteristicValue>;
18
+ handleCurrentHeatingCoolingStateGet(): Promise<CharacteristicValue>;
19
+ handleTargetHeatingCoolingStateGet(): Promise<CharacteristicValue>;
20
+ handleTargetHeatingCoolingStateSet(value: CharacteristicValue): Promise<void>;
21
+ handleCurrentTemperatureGet(): Promise<CharacteristicValue>;
22
+ handleTargetTemperatureSet(value: CharacteristicValue): Promise<void>;
23
+ handleTemperatureDisplayUnitsGet(): Promise<CharacteristicValue>;
24
+ handleTemperatureDisplayUnitsSet(value: CharacteristicValue): Promise<void>;
25
+ getCurrentState(device: API.DeviceStatus): CharacteristicValue;
26
+ getTargetState(device: API.DeviceStatus): CharacteristicValue;
27
+ getUnit(temperature: API.TemperatureStatus): 0 | 1;
28
+ handleFanActiveGet(): Promise<CharacteristicValue>;
29
+ handleFanCurrentStateGet(): Promise<CharacteristicValue>;
30
+ handleFanRotationSpeedGet(): Promise<CharacteristicValue>;
31
+ handleFanRotationSpeedSet(value: CharacteristicValue): Promise<void>;
32
+ getFanActive(device: API.DeviceStatus): CharacteristicValue;
33
+ getFanCurrentState(device: API.DeviceStatus): CharacteristicValue;
34
+ getFanRotationSpeed(device: API.DeviceStatus): CharacteristicValue;
35
+ }
36
+ //# sourceMappingURL=accessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessory.d.ts","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,qBAAa,iCAAiC;IAQ1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAP5B,OAAO,CAAC,GAAG,CAA2B;IACtC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,mBAAmB,CAA0C;gBAGlD,QAAQ,EAAE,wBAAwB,EAClC,SAAS,EAAE,iBAAiB;IAmB/C,aAAa,IAAK,OAAO;IAuBzB,gBAAgB,IAAK,OAAO;IAoB5B,aAAa,CAAC,MAAM,EAAG,GAAG,CAAC,YAAY;IAWvC,gBAAgB,CAAC,MAAM,EAAG,GAAG,CAAC,YAAY;IASpC,eAAe,IAAK,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAW7C,0BAA0B,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAS3D,mCAAmC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IASpE,kCAAkC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAKnE,kCAAkC,CAAC,KAAK,EAAE,mBAAmB;IAe7D,2BAA2B,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAK5D,0BAA0B,CAAC,KAAK,EAAE,mBAAmB;IAIrD,gCAAgC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAKjE,gCAAgC,CAAC,KAAK,EAAE,mBAAmB;IAMjE,eAAe,CAAC,MAAM,EAAG,GAAG,CAAC,YAAY,GAAI,mBAAmB;IAchE,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,GAAI,mBAAmB;IAY9D,OAAO,CAAC,WAAW,EAAG,GAAG,CAAC,iBAAiB;IAMrC,kBAAkB,IAAK,OAAO,CAAC,mBAAmB,CAAC;IASnD,wBAAwB,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAKzD,yBAAyB,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAS1D,yBAAyB,CAAC,KAAK,EAAE,mBAAmB;IAe1D,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,GAAI,mBAAmB;IAM5D,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,GAAI,mBAAmB;IAMlE,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,GAAI,mBAAmB;CAgBpE"}
@@ -0,0 +1,255 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.BeenocoSamsungAcPlatformAccessory = void 0;
27
+ const API = __importStar(require("./api"));
28
+ class BeenocoSamsungAcPlatformAccessory {
29
+ constructor(platform, accessory) {
30
+ this.platform = platform;
31
+ this.accessory = accessory;
32
+ this.deviceStatusPromise = null;
33
+ this.accessory.getService(this.platform.Service.AccessoryInformation)
34
+ .setCharacteristic(this.platform.Characteristic.Manufacturer, 'Samsung')
35
+ .setCharacteristic(this.platform.Characteristic.Model, this.platform.config.deviceModel)
36
+ .setCharacteristic(this.platform.Characteristic.SerialNumber, this.platform.config.deviceMACAddress);
37
+ this.service = this.createService();
38
+ this.fanService = this.createFanService();
39
+ this.api = new API.BeenocoSamsungAcApi(platform, accessory);
40
+ setInterval(async () => {
41
+ const device = await this.getDeviceStatus();
42
+ this.updateService(device);
43
+ this.updateFanService(device);
44
+ }, this.platform.config.devicePollInterval * 1000);
45
+ }
46
+ createService() {
47
+ const service = this.accessory.getService(this.platform.Service.Thermostat) ||
48
+ this.accessory.addService(this.platform.Service.Thermostat);
49
+ service.setCharacteristic(this.platform.Characteristic.Name, 'Air Conditioner');
50
+ service.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState)
51
+ .onGet(this.handleCurrentHeatingCoolingStateGet.bind(this));
52
+ service.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState)
53
+ .onGet(this.handleTargetHeatingCoolingStateGet.bind(this))
54
+ .onSet(this.handleTargetHeatingCoolingStateSet.bind(this));
55
+ service.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
56
+ .onGet(this.handleCurrentTemperatureGet.bind(this));
57
+ service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
58
+ .onGet(this.handleTargetTemperatureGet.bind(this))
59
+ .onSet(this.handleTargetTemperatureSet.bind(this))
60
+ .setProps({
61
+ minValue: 16,
62
+ maxValue: 30,
63
+ minStep: 1,
64
+ });
65
+ return service;
66
+ }
67
+ createFanService() {
68
+ const fanService = this.accessory.getService(this.platform.Service.Fan) ||
69
+ this.accessory.addService(this.platform.Service.Fanv2);
70
+ fanService.setCharacteristic(this.platform.Characteristic.Name, 'Air Conditioner Fan');
71
+ fanService.getCharacteristic(this.platform.Characteristic.Active)
72
+ .onGet(this.handleFanActiveGet.bind(this));
73
+ fanService.getCharacteristic(this.platform.Characteristic.RotationSpeed)
74
+ .onGet(this.handleFanRotationSpeedGet.bind(this))
75
+ .onSet(this.handleFanRotationSpeedSet.bind(this))
76
+ .setProps({
77
+ minValue: 0,
78
+ maxValue: 100,
79
+ minStep: 25,
80
+ });
81
+ fanService.getCharacteristic(this.platform.Characteristic.CurrentFanState)
82
+ .onGet(this.handleFanCurrentStateGet.bind(this));
83
+ return fanService;
84
+ }
85
+ updateService(device) {
86
+ this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState, this.getCurrentState(device));
87
+ this.service.updateCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState, this.getTargetState(device));
88
+ this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, device.Temperatures[0].current);
89
+ this.service.updateCharacteristic(this.platform.Characteristic.TargetTemperature, device.Temperatures[0].desired);
90
+ }
91
+ updateFanService(device) {
92
+ this.fanService.updateCharacteristic(this.platform.Characteristic.Active, this.getFanActive(device));
93
+ this.fanService.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getFanRotationSpeed(device));
94
+ this.fanService.updateCharacteristic(this.platform.Characteristic.CurrentFanState, this.getFanCurrentState(device));
95
+ }
96
+ async getDeviceStatus() {
97
+ if (!this.deviceStatusPromise) {
98
+ const device = this.api.getDeviceStatus()
99
+ .finally(() => {
100
+ this.deviceStatusPromise = null;
101
+ });
102
+ this.deviceStatusPromise = device;
103
+ }
104
+ return this.deviceStatusPromise;
105
+ }
106
+ async handleTargetTemperatureGet() {
107
+ const device = await this.getDeviceStatus();
108
+ const val = device.Temperatures[0].desired;
109
+ if (this.platform.config.debug) {
110
+ this.platform.log.debug('Device desired temp: %i', val);
111
+ }
112
+ return val;
113
+ }
114
+ async handleCurrentHeatingCoolingStateGet() {
115
+ const device = await this.getDeviceStatus();
116
+ const val = this.getCurrentState(device);
117
+ if (this.platform.config.debug) {
118
+ this.platform.log.debug('Device current state: %s', val);
119
+ }
120
+ return val;
121
+ }
122
+ async handleTargetHeatingCoolingStateGet() {
123
+ const device = await this.getDeviceStatus();
124
+ return this.getTargetState(device);
125
+ }
126
+ async handleTargetHeatingCoolingStateSet(value) {
127
+ if (value === this.platform.Characteristic.TargetHeatingCoolingState.OFF) {
128
+ await this.api.putPower("Off" /* API.Power.OFF */);
129
+ }
130
+ else {
131
+ let mode = "Opmode_Auto" /* API.Mode.AUTO */;
132
+ if (value === this.platform.Characteristic.TargetHeatingCoolingState.COOL) {
133
+ mode = "Opmode_Cool" /* API.Mode.COOL */;
134
+ }
135
+ else if (value === this.platform.Characteristic.TargetHeatingCoolingState.HEAT) {
136
+ mode = "Opmode_Heat" /* API.Mode.HEAT */;
137
+ }
138
+ await this.api.putPower("On" /* API.Power.ON */);
139
+ await this.api.putMode(mode);
140
+ }
141
+ }
142
+ async handleCurrentTemperatureGet() {
143
+ const device = await this.getDeviceStatus();
144
+ return device.Temperatures[0].current;
145
+ }
146
+ async handleTargetTemperatureSet(value) {
147
+ await this.api.putDesiredTemperature(value);
148
+ }
149
+ async handleTemperatureDisplayUnitsGet() {
150
+ const device = await this.getDeviceStatus();
151
+ return this.getUnit(device.Temperatures[0]);
152
+ }
153
+ async handleTemperatureDisplayUnitsSet(value) {
154
+ const unit = value === this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS ?
155
+ "Celsius" /* API.Unit.CELSIUS */ : "Fahrenheit" /* API.Unit.FAHRENHEIT */;
156
+ await this.api.putTemperatureUnit(unit);
157
+ }
158
+ getCurrentState(device) {
159
+ if (device.Operation.power === "On" /* API.Power.ON */ && (device.Mode.modes[0] === "Opmode_Cool" /* API.Mode.COOL */ ||
160
+ (device.Mode.modes[0] === "Opmode_Auto" /* API.Mode.AUTO */ &&
161
+ device.Temperatures[0].desired < device.Temperatures[0].current))) {
162
+ return this.platform.Characteristic.CurrentHeatingCoolingState.COOL;
163
+ }
164
+ else if (device.Operation.power === "On" /* API.Power.ON */ && (device.Mode.modes[0] === "Opmode_Heat" /* API.Mode.HEAT */ ||
165
+ (device.Mode.modes[0] === "Opmode_Auto" /* API.Mode.AUTO */ &&
166
+ device.Temperatures[0].desired > device.Temperatures[0].current))) {
167
+ return this.platform.Characteristic.CurrentHeatingCoolingState.HEAT;
168
+ }
169
+ else {
170
+ return this.platform.Characteristic.CurrentHeatingCoolingState.OFF;
171
+ }
172
+ }
173
+ getTargetState(device) {
174
+ if (device.Operation.power === "On" /* API.Power.ON */ && device.Mode.modes[0] === "Opmode_Cool" /* API.Mode.COOL */) {
175
+ return this.platform.Characteristic.TargetHeatingCoolingState.COOL;
176
+ }
177
+ else if (device.Operation.power === "On" /* API.Power.ON */ && device.Mode.modes[0] === "Opmode_Heat" /* API.Mode.HEAT */) {
178
+ return this.platform.Characteristic.TargetHeatingCoolingState.HEAT;
179
+ }
180
+ else if (device.Operation.power === "On" /* API.Power.ON */ && device.Mode.modes[0] === "Opmode_Auto" /* API.Mode.AUTO */) {
181
+ return this.platform.Characteristic.TargetHeatingCoolingState.AUTO;
182
+ }
183
+ else {
184
+ return this.platform.Characteristic.TargetHeatingCoolingState.OFF;
185
+ }
186
+ }
187
+ getUnit(temperature) {
188
+ return temperature.unit === "Celsius" /* API.Unit.CELSIUS */ ?
189
+ this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS :
190
+ this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT;
191
+ }
192
+ async handleFanActiveGet() {
193
+ const device = await this.getDeviceStatus();
194
+ const val = this.getFanActive(device);
195
+ if (this.platform.config.debug) {
196
+ this.platform.log.debug('Device fan active: %s', val);
197
+ }
198
+ return val;
199
+ }
200
+ async handleFanCurrentStateGet() {
201
+ const device = await this.getDeviceStatus();
202
+ return this.getCurrentState(device);
203
+ }
204
+ async handleFanRotationSpeedGet() {
205
+ const device = await this.getDeviceStatus();
206
+ const val = this.getFanRotationSpeed(device);
207
+ if (this.platform.config.debug) {
208
+ this.platform.log.debug('Device fan speed: %d', val);
209
+ }
210
+ return val;
211
+ }
212
+ async handleFanRotationSpeedSet(value) {
213
+ let speedLevel = 0 /* API.WindSpeedLevel.AUTO */;
214
+ if (value === 25) {
215
+ speedLevel = 4 /* API.WindSpeedLevel.LOW */;
216
+ }
217
+ else if (value === 50) {
218
+ speedLevel = 3 /* API.WindSpeedLevel.MEDIUM */;
219
+ }
220
+ else if (value === 75) {
221
+ speedLevel = 2 /* API.WindSpeedLevel.HIGH */;
222
+ }
223
+ if (this.platform.config.debug) {
224
+ this.platform.log.debug('Set fan speed level: %d', speedLevel);
225
+ }
226
+ await this.api.putWindSpeedLevel(speedLevel);
227
+ }
228
+ getFanActive(device) {
229
+ return device.Operation.power === "On" /* API.Power.ON */ ?
230
+ this.platform.Characteristic.Active.ACTIVE :
231
+ this.platform.Characteristic.Active.INACTIVE;
232
+ }
233
+ getFanCurrentState(device) {
234
+ return device.Operation.power === "On" /* API.Power.ON */ ?
235
+ this.platform.Characteristic.CurrentFanState.BLOWING_AIR :
236
+ this.platform.Characteristic.CurrentFanState.INACTIVE;
237
+ }
238
+ getFanRotationSpeed(device) {
239
+ if (device.Operation.power === "On" /* API.Power.ON */) {
240
+ switch (device.Wind.speedLevel) {
241
+ case 4 /* API.WindSpeedLevel.LOW */:
242
+ return 25;
243
+ case 3 /* API.WindSpeedLevel.MEDIUM */:
244
+ return 50;
245
+ case 2 /* API.WindSpeedLevel.HIGH */:
246
+ return 75;
247
+ case 0 /* API.WindSpeedLevel.AUTO */:
248
+ return 100;
249
+ }
250
+ }
251
+ return 0;
252
+ }
253
+ }
254
+ exports.BeenocoSamsungAcPlatformAccessory = BeenocoSamsungAcPlatformAccessory;
255
+ //# sourceMappingURL=accessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessory.js","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,2CAA6B;AAE7B,MAAa,iCAAiC;IAO5C,YACmB,QAAkC,EAClC,SAA4B;QAD5B,aAAQ,GAAR,QAAQ,CAA0B;QAClC,cAAS,GAAT,SAAS,CAAmB;QAJvC,wBAAmB,GAAqC,IAAI,CAAC;QAMnE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAE;aACnE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,SAAS,CAAC;aACvE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;aACvF,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAEvG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAE1C,IAAI,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE5D,WAAW,CAAC,KAAK,IAAI,EAAE;YACrB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YAC3B,IAAI,CAAC,gBAAgB,CAAC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YAC3C,QAAQ,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;gBAC9B;oBACE,OAAO,EAAE,CAAC;gBACZ;oBACE,OAAO,EAAE,CAAC;gBACZ;oBACE,OAAO,EAAE,CAAC;gBACZ;oBACE,OAAO,GAAG,CAAC;aACd;SACF;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CAEF;AAlQD,8EAkQC"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,98 @@
1
+ import { PlatformAccessory } from 'homebridge';
2
+ import { BeenocoSamsungAcPlatform } from './platform';
3
+ export declare class BeenocoSamsungAcApi {
4
+ private readonly platform;
5
+ private readonly accessory;
6
+ private tlsCA;
7
+ private tlsCert;
8
+ private tlsKey;
9
+ constructor(platform: BeenocoSamsungAcPlatform, accessory: PlatformAccessory);
10
+ private options;
11
+ /**
12
+ * Send a request to the device
13
+ * @param method the HTTP method to use for the request
14
+ * @param resource the resource to be appended to the device URI
15
+ * @param content the content to send in the body of the request, may be empty
16
+ * @returns a promise resolving to the string response, may be empty
17
+ */
18
+ private request;
19
+ getDeviceStatus(): Promise<DeviceStatus>;
20
+ private put;
21
+ putPower(value: string): Promise<string>;
22
+ putMode(value: Mode): Promise<string>;
23
+ putDesiredTemperature(value: number): Promise<string>;
24
+ putTemperatureUnit(value: string): Promise<string>;
25
+ putWindSpeedLevel(value: WindSpeedLevel): Promise<string>;
26
+ }
27
+ export declare const enum WindSpeedLevel {
28
+ AUTO = 0,
29
+ LOW = 4,
30
+ MEDIUM = 3,
31
+ HIGH = 2
32
+ }
33
+ export declare const enum Mode {
34
+ AUTO = "Opmode_Auto",
35
+ COOL = "Opmode_Cool",
36
+ DRY = "Opmode_Dry",
37
+ FAN = "Opmode_Fan",
38
+ HEAT = "Opmode_Heat"
39
+ }
40
+ export declare const enum Power {
41
+ OFF = "Off",
42
+ ON = "On"
43
+ }
44
+ export declare const enum Unit {
45
+ CELSIUS = "Celsius",
46
+ FAHRENHEIT = "Fahrenheit"
47
+ }
48
+ export interface AlarmStatus {
49
+ alarmType: string;
50
+ code: string;
51
+ id: string;
52
+ triggeredTime: string;
53
+ }
54
+ export interface LinkStatus {
55
+ href: string;
56
+ }
57
+ export interface ModeStatus {
58
+ modes: Mode[];
59
+ options: string[];
60
+ supportedModes: Mode[];
61
+ }
62
+ export interface OperationStatus {
63
+ power: Power;
64
+ }
65
+ export interface TemperatureStatus {
66
+ current: number;
67
+ desired: number;
68
+ id: string;
69
+ increment: number;
70
+ maximum: number;
71
+ minimum: number;
72
+ name: string;
73
+ unit: string;
74
+ }
75
+ export interface WindStatus {
76
+ direction: string;
77
+ speedLevel: WindSpeedLevel;
78
+ supportedWindModes: string[];
79
+ }
80
+ export interface DeviceStatus {
81
+ Alarms: AlarmStatus[];
82
+ ConfigurationLink: LinkStatus;
83
+ InformationLink: LinkStatus;
84
+ Mode: ModeStatus;
85
+ Operation: OperationStatus;
86
+ Temperatures: TemperatureStatus[];
87
+ Wind: WindStatus;
88
+ description: string;
89
+ id: string;
90
+ name: string;
91
+ resources: string[];
92
+ type: string;
93
+ uuid: string;
94
+ }
95
+ export interface DeviceResponse {
96
+ Device: DeviceStatus;
97
+ }
98
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,qBAAa,mBAAmB;IAO5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAN5B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;gBAGJ,QAAQ,EAAE,wBAAwB,EAClC,SAAS,EAAE,iBAAiB;IAQ/C,OAAO,CAAC,OAAO;IAsBf;;;;;;SAMK;YACS,OAAO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,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,cAAc,CAAC;IAC3B,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,iBAAiB,EAAE,UAAU,CAAC;IAC9B,eAAe,EAAE,UAAU,CAAC;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,YAAY,CAAC;CACtB"}
package/dist/api.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BeenocoSamsungAcApi = void 0;
4
+ const fs = require("node:fs");
5
+ const https = require("node:https");
6
+ class BeenocoSamsungAcApi {
7
+ constructor(platform, accessory) {
8
+ this.platform = platform;
9
+ this.accessory = accessory;
10
+ const tlsDir = __dirname + '/../tls';
11
+ this.tlsCA = fs.readFileSync(tlsDir + '/ca.pem');
12
+ this.tlsCert = fs.readFileSync(tlsDir + '/cert.pem');
13
+ this.tlsKey = fs.readFileSync(tlsDir + '/key.pem');
14
+ }
15
+ options(method, resource, contentLength) {
16
+ return {
17
+ hostname: this.platform.config.deviceIPAddress,
18
+ port: 8888,
19
+ path: '/devices/' + this.accessory.context.device.id + resource,
20
+ method: method,
21
+ rejectUnauthorized: false,
22
+ secureProtocol: 'TLSv1_method',
23
+ agent: new https.Agent({
24
+ ca: this.tlsCA,
25
+ cert: this.tlsCert,
26
+ key: this.tlsKey,
27
+ ciphers: 'DEFAULT:@SECLEVEL=0',
28
+ }),
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ 'Content-Length': contentLength,
32
+ 'Authorization': 'Bearer ' + this.platform.config.deviceToken,
33
+ },
34
+ };
35
+ }
36
+ /**
37
+ * Send a request to the device
38
+ * @param method the HTTP method to use for the request
39
+ * @param resource the resource to be appended to the device URI
40
+ * @param content the content to send in the body of the request, may be empty
41
+ * @returns a promise resolving to the string response, may be empty
42
+ */
43
+ async request(method, resource = '', json = null) {
44
+ const content = json ? JSON.stringify(json) : '';
45
+ return new Promise((resolve, reject) => {
46
+ const request = https.request(this.options(method, resource, content.length), (response) => {
47
+ response.setEncoding('utf8');
48
+ if (response.statusCode && (response.statusCode < 200 || response.statusCode > 299)) {
49
+ reject(new Error('Request error status code: ' + response.statusCode));
50
+ }
51
+ let rawData = '';
52
+ response.on('data', (chunk) => {
53
+ rawData += chunk;
54
+ });
55
+ response.on('end', () => {
56
+ if (rawData && this.platform.config.debug) {
57
+ this.platform.log.debug('Received:', rawData);
58
+ }
59
+ resolve(rawData);
60
+ });
61
+ });
62
+ if (content.length > 0) {
63
+ if (this.platform.config.debug) {
64
+ this.platform.log.debug('Sending:', content);
65
+ }
66
+ request.write(content);
67
+ }
68
+ request.on('error', e => {
69
+ this.platform.log.error('Error', e);
70
+ reject(e);
71
+ });
72
+ request.end();
73
+ });
74
+ }
75
+ async getDeviceStatus() {
76
+ const received = await this.request('GET')
77
+ .catch(e => {
78
+ if (e instanceof Error) {
79
+ this.platform.log.error('Request status failed: {}', e.message);
80
+ }
81
+ throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
82
+ });
83
+ const response = JSON.parse(received);
84
+ return response.Device;
85
+ }
86
+ async put(resource, json) {
87
+ return this.request('PUT', resource, json);
88
+ }
89
+ async putPower(value) {
90
+ return this.put('/operation', { 'Operation': { 'power': value } });
91
+ }
92
+ async putMode(value) {
93
+ return this.put('/mode', { 'Mode': { 'modes': [value] } });
94
+ }
95
+ async putDesiredTemperature(value) {
96
+ return this.put('/temperatures/0', { 'Temperature': { 'desired': value } });
97
+ }
98
+ async putTemperatureUnit(value) {
99
+ return this.put('/temperatures', { 'Temperature': { 'unit': value } });
100
+ }
101
+ async putWindSpeedLevel(value) {
102
+ return this.put('/wind', { 'Wind': { 'speedLevel': value } });
103
+ }
104
+ }
105
+ exports.BeenocoSamsungAcApi = BeenocoSamsungAcApi;
106
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;AAAA,8BAA+B;AAC/B,oCAAqC;AAMrC,MAAa,mBAAmB;IAM9B,YACmB,QAAkC,EAClC,SAA4B;QAD5B,aAAQ,GAAR,QAAQ,CAA0B;QAClC,cAAS,GAAT,SAAS,CAAmB;QAE7C,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;QACrC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;IACrD,CAAC;IAEO,OAAO,CAAC,MAAc,EAAE,QAAgB,EAAE,aAAqB;QACrE,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,eAAe;YAC9C,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,WAAW,GA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;IACtE,CAAC;CACF;AAnHD,kDAmHC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
1
1
  import { API } from 'homebridge';
2
- /**
3
- * This method registers the platform with Homebridge
4
- */
5
2
  declare const _default: (api: API) => void;
6
3
  export = _default;
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;8BAKlB,GAAG;AAAlB,kBAEE"}
package/dist/index.js CHANGED
@@ -2,6 +2,6 @@
2
2
  const settings_1 = require("./settings");
3
3
  const platform_1 = require("./platform");
4
4
  module.exports = (api) => {
5
- api.registerPlatform(settings_1.PLATFORM_NAME, platform_1.BeenocoSamsungACPlatform);
5
+ api.registerPlatform(settings_1.PLATFORM_NAME, platform_1.BeenocoSamsungAcPlatform);
6
6
  };
7
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,yCAA2C;AAC3C,yCAAsD;AAKtD,iBAAS,CAAC,GAAQ,EAAE,EAAE;IACpB,GAAG,CAAC,gBAAgB,CAAC,wBAAa,EAAE,mCAAwB,CAAC,CAAC;AAChE,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,yCAA2C;AAC3C,yCAAsD;AAEtD,iBAAS,CAAC,GAAQ,EAAE,EAAE;IACpB,GAAG,CAAC,gBAAgB,CAAC,wBAAa,EAAE,mCAAwB,CAAC,CAAC;AAChE,CAAC,CAAC"}
@@ -4,7 +4,7 @@ import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig,
4
4
  * This class is the main constructor for your plugin, this is where you should
5
5
  * parse the user config and discover/register accessories with Homebridge.
6
6
  */
7
- export declare class BeenocoSamsungACPlatform implements DynamicPlatformPlugin {
7
+ export declare class BeenocoSamsungAcPlatform implements DynamicPlatformPlugin {
8
8
  readonly log: Logger;
9
9
  readonly config: PlatformConfig;
10
10
  readonly api: API;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5H;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,qBAAqB;aAQlD,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAT1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAwB;IAC/D,SAAgB,cAAc,EAAE,OAAO,cAAc,CAA+B;IAGpF,SAAgB,WAAW,EAAE,iBAAiB,EAAE,CAAM;gBAGpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IAe1B;;;OAGG;IACH,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAO/C;;;;OAIG;IACH,eAAe;CAgEhB"}
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5H;;;;GAIG;AACH,qBAAa,wBAAyB,YAAW,qBAAqB;aAQlD,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAT1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAwB;IAC/D,SAAgB,cAAc,EAAE,OAAO,cAAc,CAA+B;IAGpF,SAAgB,WAAW,EAAE,iBAAiB,EAAE,CAAM;gBAGpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IAe1B;;;OAGG;IACH,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAO/C;;;;OAIG;IACH,eAAe;CAkDhB"}
package/dist/platform.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BeenocoSamsungACPlatform = void 0;
3
+ exports.BeenocoSamsungAcPlatform = void 0;
4
4
  const settings_1 = require("./settings");
5
- const platformAccessory_1 = require("./platformAccessory");
5
+ const accessory_1 = require("./accessory");
6
6
  /**
7
7
  * HomebridgePlatform
8
8
  * This class is the main constructor for your plugin, this is where you should
9
9
  * parse the user config and discover/register accessories with Homebridge.
10
10
  */
11
- class BeenocoSamsungACPlatform {
11
+ class BeenocoSamsungAcPlatform {
12
12
  constructor(log, config, api) {
13
13
  this.log = log;
14
14
  this.config = config;
@@ -43,19 +43,6 @@ class BeenocoSamsungACPlatform {
43
43
  * must not be registered again to prevent "duplicate UUID" errors.
44
44
  */
45
45
  discoverDevices() {
46
- // EXAMPLE ONLY
47
- // A real plugin you would discover accessories from the local network, cloud services
48
- // or a user-defined array in the platform config.
49
- // const exampleDevices = [
50
- // {
51
- // exampleUniqueId: 'ABCD',
52
- // exampleDisplayName: 'Bedroom',
53
- // },
54
- // {
55
- // exampleUniqueId: 'EFGH',
56
- // exampleDisplayName: 'Kitchen',
57
- // },
58
- // ];
59
46
  // loop over the discovered devices and register each one if it has not already been registered
60
47
  for (const device of this.config.devices) {
61
48
  // generate a unique id for the accessory this should be generated from
@@ -73,7 +60,7 @@ class BeenocoSamsungACPlatform {
73
60
  // this.api.updatePlatformAccessories([existingAccessory]);
74
61
  // create the accessory handler for the restored accessory
75
62
  // this is imported from `platformAccessory.ts`
76
- new platformAccessory_1.BeenocoSamsungACPlatformAccessory(this, existingAccessory);
63
+ new accessory_1.BeenocoSamsungAcPlatformAccessory(this, existingAccessory);
77
64
  // it is possible to remove platform accessories at any time using `api.unregisterPlatformAccessories`, eg.:
78
65
  // remove platform accessories when no longer present
79
66
  // this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [existingAccessory]);
@@ -89,12 +76,12 @@ class BeenocoSamsungACPlatform {
89
76
  accessory.context.device = device;
90
77
  // create the accessory handler for the newly create accessory
91
78
  // this is imported from `platformAccessory.ts`
92
- new platformAccessory_1.BeenocoSamsungACPlatformAccessory(this, accessory);
79
+ new accessory_1.BeenocoSamsungAcPlatformAccessory(this, accessory);
93
80
  // link the accessory to your platform
94
81
  this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
95
82
  }
96
83
  }
97
84
  }
98
85
  }
99
- exports.BeenocoSamsungACPlatform = BeenocoSamsungACPlatform;
86
+ exports.BeenocoSamsungAcPlatform = BeenocoSamsungAcPlatform;
100
87
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAEA,yCAAwD;AACxD,2DAAwE;AAExE;;;;GAIG;AACH,MAAa,wBAAwB;IAOnC,YACkB,GAAW,EACX,MAAsB,EACtB,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QATV,YAAO,GAAmB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,mBAAc,GAA0B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAEpF,oDAAoD;QACpC,gBAAW,GAAwB,EAAE,CAAC;QAOpD,IAAI,CAAC,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B;gBAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,0CAA0C,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;gBAEzF,wGAAwG;gBACxG,6CAA6C;gBAC7C,2DAA2D;gBAE3D,0DAA0D;gBAC1D,+CAA+C;gBAC/C,IAAI,6CAAiC,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;gBAE/D,4GAA4G;gBAC5G,qDAAqD;gBACrD,2FAA2F;gBAC3F,2FAA2F;aAC5F;iBAAM;gBACL,4DAA4D;gBAC5D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;gBAEpD,yBAAyB;gBACzB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAEpE,+DAA+D;gBAC/D,wFAAwF;gBACxF,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;gBAElC,8DAA8D;gBAC9D,+CAA+C;gBAC/C,IAAI,6CAAiC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;gBAEvD,sCAAsC;gBACtC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,sBAAW,EAAE,wBAAa,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;aAC/E;SACF;IACH,CAAC;CACF;AA3FD,4DA2FC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "displayName": "Beenoco Samsung AC",
4
4
  "name": "@beenoco/homebridge-samsung-ac",
5
- "version": "0.1.0-beta.1",
5
+ "version": "0.2.0",
6
6
  "description": "Samsung air conditioner plugin for Homebridge by Beenoco.",
7
7
  "license": "Apache-2.0",
8
8
  "repository": {
@@ -13,8 +13,8 @@
13
13
  "url": "https://github.com/beenoco/homebridge-samsung-ac/issues"
14
14
  },
15
15
  "engines": {
16
- "node": "^20.11.0 || ^21.3.0",
17
- "homebridge": "^1.7.0"
16
+ "node": "^20.11.0 || ^21.3.0 || ^24.0.0",
17
+ "homebridge": "^1.7.0 || ^2.1.0"
18
18
  },
19
19
  "main": "dist/index.js",
20
20
  "scripts": {
@@ -1,45 +0,0 @@
1
- /// <reference types="node" />
2
- import { PlatformAccessory, CharacteristicValue } from 'homebridge';
3
- import { BeenocoSamsungACPlatform } from './platform';
4
- import https = require('node:https');
5
- /**
6
- * Platform Accessory
7
- * An instance of this class is created for each accessory your platform registers.
8
- * Each accessory may expose multiple services of different service types.
9
- */
10
- export declare class BeenocoSamsungACPlatformAccessory {
11
- private readonly platform;
12
- private readonly accessory;
13
- private service;
14
- private fanService;
15
- private tlsCA;
16
- private tlsCert;
17
- private tlsKey;
18
- constructor(platform: BeenocoSamsungACPlatform, accessory: PlatformAccessory);
19
- options(method: string, resource: string, contentLength: number): https.RequestOptions;
20
- /**
21
- * Send a request to the device
22
- * @param method the HTTP method to use for the request
23
- * @param resource the resource to be appended to the device URI
24
- * @param json the JSON to send in the body of the request, may be empty
25
- * @returns a promise resolving to the JSON result, may be empty
26
- */
27
- request(method: string, resource?: string, json?: {}): Promise<any>;
28
- getDeviceJson(): Promise<any>;
29
- handleTargetTemperatureGet(): Promise<CharacteristicValue>;
30
- handleCurrentHeatingCoolingStateGet(): Promise<CharacteristicValue>;
31
- handleTargetHeatingCoolingStateGet(): Promise<CharacteristicValue>;
32
- handleTargetHeatingCoolingStateSet(value: CharacteristicValue): Promise<void>;
33
- handleCurrentTemperatureGet(): Promise<CharacteristicValue>;
34
- handleTargetTemperatureSet(value: CharacteristicValue): Promise<void>;
35
- handleTemperatureDisplayUnitsGet(): Promise<CharacteristicValue>;
36
- handleTemperatureDisplayUnitsSet(value: CharacteristicValue): Promise<void>;
37
- fanActiveGet(): Promise<CharacteristicValue>;
38
- fanSpeedGet(): Promise<CharacteristicValue>;
39
- fanSpeedSet(value: CharacteristicValue): Promise<void>;
40
- getCurrentState(jsonDevice: any): CharacteristicValue;
41
- getTargetState(jsonDevice: any): CharacteristicValue;
42
- getUnit(jsonTemperature: any): 0 | 1;
43
- getFanRotationSpeed(jsonDevice: any): CharacteristicValue;
44
- }
45
- //# sourceMappingURL=platformAccessory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"platformAccessory.d.ts","sourceRoot":"","sources":["../src/platformAccessory.ts"],"names":[],"mappings":";AAAA,OAAO,EAAW,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,KAAK,GAAG,QAAQ,YAAY,CAAC,CAAC;AAErC;;;;GAIG;AACH,qBAAa,iCAAiC;IAQ1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAR5B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,UAAU,CAAU;IAC5B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;gBAGJ,QAAQ,EAAE,wBAAwB,EAClC,SAAS,EAAE,iBAAiB;IA6E/C,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAI,KAAK,CAAC,cAAc;IAsBvF;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAG,EAAE,IAAI,KAAG,GAAI,OAAO,CAAC,GAAG,CAAC;IAsCtD,aAAa,IAAK,OAAO,CAAC,GAAG,CAAC;IA2B9B,0BAA0B,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAa3D,mCAAmC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAapE,kCAAkC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAanE,kCAAkC,CAAC,KAAK,EAAE,mBAAmB;IAwB7D,2BAA2B,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAc5D,0BAA0B,CAAC,KAAK,EAAE,mBAAmB;IASrD,gCAAgC,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAajE,gCAAgC,CAAC,KAAK,EAAE,mBAAmB;IAe3D,YAAY,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAmB7C,WAAW,IAAK,OAAO,CAAC,mBAAmB,CAAC;IAe5C,WAAW,CAAC,KAAK,EAAE,mBAAmB;IA0C5C,eAAe,CAAC,UAAU,KAAA,GAAI,mBAAmB;IAcjD,cAAc,CAAC,UAAU,KAAA,GAAI,mBAAmB;IAYhD,OAAO,CAAC,eAAe,KAAA;IAMvB,mBAAmB,CAAC,UAAU,KAAA,GAAI,mBAAmB;CActD"}
@@ -1,386 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BeenocoSamsungACPlatformAccessory = void 0;
4
- const fs = require("node:fs");
5
- const https = require("node:https");
6
- /**
7
- * Platform Accessory
8
- * An instance of this class is created for each accessory your platform registers.
9
- * Each accessory may expose multiple services of different service types.
10
- */
11
- class BeenocoSamsungACPlatformAccessory {
12
- constructor(platform, accessory) {
13
- this.platform = platform;
14
- this.accessory = accessory;
15
- // set accessory information
16
- this.accessory.getService(this.platform.Service.AccessoryInformation)
17
- .setCharacteristic(this.platform.Characteristic.Manufacturer, 'Samsung')
18
- .setCharacteristic(this.platform.Characteristic.Model, this.platform.config.deviceModel)
19
- .setCharacteristic(this.platform.Characteristic.SerialNumber, this.platform.config.deviceMACAddress);
20
- // get the Thermostat service if it exists, otherwise create a new Thermostat service
21
- // you can create multiple services for each accessory
22
- this.service = this.accessory.getService(this.platform.Service.Thermostat) ||
23
- this.accessory.addService(this.platform.Service.Thermostat);
24
- // set the service name, this is what is displayed as the default name on the Home app
25
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
26
- this.service.setCharacteristic(this.platform.Characteristic.Name, this.platform.config.name || 'Air Conditioner');
27
- // this.service.getCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState)
28
- // .onGet(this.handleCurrentHeatingCoolingStateGet.bind(this));
29
- this.service.getCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState)
30
- .onGet(this.handleTargetHeatingCoolingStateGet.bind(this))
31
- .onSet(this.handleTargetHeatingCoolingStateSet.bind(this));
32
- this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
33
- .onGet(this.handleCurrentTemperatureGet.bind(this));
34
- this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
35
- .onGet(this.handleTargetTemperatureGet.bind(this))
36
- .onSet(this.handleTargetTemperatureSet.bind(this));
37
- this.service.getCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits)
38
- .onGet(this.handleTemperatureDisplayUnitsGet.bind(this))
39
- .onSet(this.handleTemperatureDisplayUnitsSet.bind(this));
40
- // get the fan service if
41
- this.fanService = this.accessory.getService(this.platform.Service.Fan) ||
42
- this.accessory.addService(this.platform.Service.Fan);
43
- this.fanService.setCharacteristic(this.platform.Characteristic.Name, 'Air Conditioner Fan');
44
- this.fanService.getCharacteristic(this.platform.Characteristic.Active)
45
- .onGet(this.fanActiveGet.bind(this));
46
- this.fanService.getCharacteristic(this.platform.Characteristic.RotationSpeed)
47
- .onGet(this.fanSpeedGet.bind(this))
48
- .onSet(this.fanSpeedSet.bind(this));
49
- const tlsDir = __dirname + '/../tls';
50
- this.tlsCA = fs.readFileSync(tlsDir + '/ca.pem');
51
- this.tlsCert = fs.readFileSync(tlsDir + '/cert.pem');
52
- this.tlsKey = fs.readFileSync(tlsDir + '/key.pem');
53
- // setInterval(async () => {
54
- // try {
55
- // const json = await this.request('GET');
56
- // this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState,
57
- // this.getCurrentState(json.Device));
58
- // this.service.updateCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState,
59
- // this.getTargetState(json.Device));
60
- // this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature,
61
- // json.Device.Temperatures[0].current);
62
- // this.service.updateCharacteristic(this.platform.Characteristic.TargetTemperature,
63
- // json.Device.Temperatures[0].desired);
64
- // this.service.updateCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits,
65
- // this.getUnit(json.Device.Temperatures[0]));
66
- // } catch(e) {
67
- // if (e instanceof Error) {
68
- // this.platform.log.error('Error from periodic update.', e.message);
69
- // }
70
- // }
71
- // }, this.platform.config.devicePollInterval * 1000);
72
- }
73
- options(method, resource, contentLength) {
74
- return {
75
- hostname: this.platform.config.deviceIPAddress,
76
- port: 8888,
77
- path: '/devices/' + this.accessory.context.device.id + resource,
78
- method: method,
79
- rejectUnauthorized: false,
80
- secureProtocol: 'TLSv1_method',
81
- agent: new https.Agent({
82
- ca: this.tlsCA,
83
- cert: this.tlsCert,
84
- key: this.tlsKey,
85
- ciphers: 'DEFAULT:@SECLEVEL=0',
86
- }),
87
- headers: {
88
- 'Content-Type': 'application/json',
89
- 'Content-Length': contentLength,
90
- 'Authorization': 'Bearer ' + this.platform.config.deviceToken,
91
- },
92
- };
93
- }
94
- /**
95
- * Send a request to the device
96
- * @param method the HTTP method to use for the request
97
- * @param resource the resource to be appended to the device URI
98
- * @param json the JSON to send in the body of the request, may be empty
99
- * @returns a promise resolving to the JSON result, may be empty
100
- */
101
- request(method, resource = '', json = {}) {
102
- let content = '';
103
- if (Object.keys(json).length) {
104
- content = JSON.stringify(json);
105
- }
106
- return new Promise((resolve, reject) => {
107
- const request = https.request(this.options(method, resource, content.length), (response) => {
108
- response.setEncoding('utf8');
109
- if (response.statusCode && (response.statusCode < 200 || response.statusCode > 299)) {
110
- reject(new Error('Request error status code: ' + response.statusCode));
111
- }
112
- let rawData = '';
113
- response.on('data', (chunk) => {
114
- rawData += chunk;
115
- });
116
- response.on('end', () => {
117
- try {
118
- this.platform.log.debug('Received:', rawData);
119
- resolve(rawData.length > 0 ? JSON.parse(rawData) : {});
120
- }
121
- catch (e) {
122
- reject(new Error('Error processing raw data: ' + rawData));
123
- }
124
- });
125
- });
126
- // try {
127
- if (content.length > 0) {
128
- this.platform.log.debug('Sending:', content);
129
- request.write(content);
130
- }
131
- request.on('error', e => {
132
- // this.platform.log.error('Error', e);
133
- reject(e);
134
- });
135
- request.end();
136
- });
137
- }
138
- async getDeviceJson() {
139
- try {
140
- const json = await this.request('GET');
141
- this.service.updateCharacteristic(this.platform.Characteristic.CurrentHeatingCoolingState, this.getCurrentState(json.Device));
142
- this.service.updateCharacteristic(this.platform.Characteristic.TargetHeatingCoolingState, this.getTargetState(json.Device));
143
- this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, json.Device.Temperatures[0].current);
144
- this.service.updateCharacteristic(this.platform.Characteristic.TargetTemperature, json.Device.Temperatures[0].desired);
145
- this.service.updateCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits, this.getUnit(json.Device.Temperatures[0]));
146
- this.fanService.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.getFanRotationSpeed(json.Device));
147
- return json;
148
- }
149
- catch (e) {
150
- if (e instanceof Error) {
151
- this.platform.log.error('Error from periodic update.', e.message);
152
- }
153
- }
154
- }
155
- async handleTargetTemperatureGet() {
156
- try {
157
- const json = await this.request('GET', '/temperatures/0');
158
- return json.Temperature.desired;
159
- }
160
- catch (e) {
161
- if (e instanceof Error) {
162
- this.platform.log.error('Get target temperature failed.', e.message);
163
- }
164
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
165
- }
166
- }
167
- async handleCurrentHeatingCoolingStateGet() {
168
- try {
169
- const json = await this.request('GET');
170
- return this.getCurrentState(json.Device);
171
- }
172
- catch (e) {
173
- if (e instanceof Error) {
174
- this.platform.log.error('Get current heating/cooling state failed.', e.message);
175
- }
176
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
177
- }
178
- }
179
- async handleTargetHeatingCoolingStateGet() {
180
- try {
181
- const json = await this.request('GET');
182
- return this.getTargetState(json.Device);
183
- }
184
- catch (e) {
185
- if (e instanceof Error) {
186
- this.platform.log.error('Get target heating/cooling state failed.', e.message);
187
- }
188
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
189
- }
190
- }
191
- async handleTargetHeatingCoolingStateSet(value) {
192
- try {
193
- if (value === this.platform.Characteristic.TargetHeatingCoolingState.OFF) {
194
- await this.request('PUT', '/operation', { 'Operation': { 'power': 'Off' } })
195
- .catch((reason) => this.platform.log.error('reason:', reason));
196
- }
197
- else {
198
- let mode = 'Opmode_Auto';
199
- if (value === this.platform.Characteristic.TargetHeatingCoolingState.COOL) {
200
- mode = 'Opmode_Cool';
201
- }
202
- else if (value === this.platform.Characteristic.TargetHeatingCoolingState.HEAT) {
203
- mode = 'Opmode_Heat';
204
- }
205
- await this.request('PUT', '/operation', { 'Operation': { 'power': 'On' } });
206
- await this.request('PUT', '/mode', { 'Mode': { 'modes': [mode] } });
207
- }
208
- }
209
- catch (e) {
210
- if (e instanceof Error) {
211
- this.platform.log.error('Set target heating/cooling state failed.', e.message);
212
- }
213
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
214
- }
215
- }
216
- async handleCurrentTemperatureGet() {
217
- try {
218
- const json = await this.request('GET', '/temperatures/0');
219
- // this.exampleStates.CurrentTemperature = json.Temperature.current;
220
- return json.Temperature.current;
221
- }
222
- catch (e) {
223
- if (e instanceof Error) {
224
- this.platform.log.error('Get current temperature failed.', e.message);
225
- }
226
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
227
- }
228
- }
229
- async handleTargetTemperatureSet(value) {
230
- try {
231
- await this.request('PUT', '/temperatures/0', { 'Temperature': { 'desired': value } });
232
- }
233
- catch (_a) {
234
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
235
- }
236
- }
237
- async handleTemperatureDisplayUnitsGet() {
238
- try {
239
- const json = await this.request('GET', '/temperatures/0');
240
- return this.getUnit(json.Temperature);
241
- }
242
- catch (e) {
243
- if (e instanceof Error) {
244
- this.platform.log.error('Get temperature units failed.', e.message);
245
- }
246
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
247
- }
248
- }
249
- async handleTemperatureDisplayUnitsSet(value) {
250
- try {
251
- const unit = value === this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS ?
252
- 'Celsius' : 'Fahrenheit';
253
- await this.request('PUT', '/temperatures', { 'Temperature': { 'unit': unit } })
254
- .catch((e) => this.platform.log.error(e));
255
- }
256
- catch (e) {
257
- if (e instanceof Error) {
258
- this.platform.log.error('Set temperature units failed.', e.message);
259
- }
260
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
261
- }
262
- }
263
- async fanActiveGet() {
264
- try {
265
- const json = await this.request('GET');
266
- // if (this.getCurrentState(json) === ''
267
- // this.platform.log.debug('Fan active result: ', json);
268
- if (json.Device.Operation.power === 'On') {
269
- return this.platform.api.hap.Characteristic.Active.ACTIVE;
270
- }
271
- else {
272
- return this.platform.api.hap.Characteristic.Active.INACTIVE;
273
- }
274
- }
275
- catch (e) {
276
- if (e instanceof Error) {
277
- this.platform.log.error('Get fan active failed');
278
- }
279
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
280
- }
281
- }
282
- async fanSpeedGet() {
283
- try {
284
- const json = await this.request('GET');
285
- return this.getFanRotationSpeed(json.Device);
286
- // this.platform.log.debug();
287
- // this.platform.log.debug('Speed level', json.Wind.speedLevel);
288
- }
289
- catch (e) {
290
- if (e instanceof Error) {
291
- this.platform.log.error('Get fan speed failed', e);
292
- }
293
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
294
- }
295
- }
296
- async fanSpeedSet(value) {
297
- try {
298
- value = value;
299
- if (value < 5) {
300
- this.service.setCharacteristic(this.platform.api.hap.Characteristic.TargetHeatingCoolingState, this.platform.Characteristic.TargetHeatingCoolingState.OFF);
301
- this.fanService.setCharacteristic(this.platform.api.hap.Characteristic.Active, this.platform.Characteristic.Active.INACTIVE);
302
- }
303
- else {
304
- if (this.service.getCharacteristic(this.platform.api.hap.Characteristic.CurrentHeatingCoolingState).value ===
305
- this.platform.Characteristic.CurrentHeatingCoolingState.OFF &&
306
- this.fanService.getCharacteristic(this.platform.api.hap.Characteristic.Active).value ===
307
- this.platform.Characteristic.Active.INACTIVE) {
308
- await this.request('PUT', '/operation', { 'Operation': { 'power': 'On' } });
309
- await this.request('PUT', '/mode', { 'Mode': { 'modes': ['Opmode_Fan'] } });
310
- }
311
- let speedLevel;
312
- if (value < 35) {
313
- speedLevel = 4; // low
314
- }
315
- else if (value < 65) {
316
- speedLevel = 3; // medium
317
- }
318
- else if (value < 95) {
319
- speedLevel = 2; // high
320
- }
321
- else {
322
- speedLevel = 0; // auto
323
- }
324
- // this.platform.log.debug('Set speed level', speedLevel);
325
- await this.request('PUT', '/wind', { 'Wind': { 'speedLevel': speedLevel } });
326
- this.fanService.updateCharacteristic(this.platform.api.hap.Characteristic.Active, this.platform.Characteristic.Active.ACTIVE);
327
- }
328
- }
329
- catch (_a) {
330
- throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
331
- }
332
- }
333
- getCurrentState(jsonDevice) {
334
- if (jsonDevice.Operation.power === 'On' && (jsonDevice.Mode.modes[0] === 'Opmode_Cool' ||
335
- (jsonDevice.Mode.modes[0] === 'Opmode_Auto' &&
336
- jsonDevice.Temperatures[0].desired < jsonDevice.Temperatures[0].current))) {
337
- return this.platform.Characteristic.CurrentHeatingCoolingState.COOL;
338
- }
339
- else if (jsonDevice.Operation.power === 'On' && (jsonDevice.Mode.modes[0] === 'Opmode_Heat' ||
340
- (jsonDevice.Mode.modes[0] === 'Opmode_Auto' &&
341
- jsonDevice.Temperatures[0].desired > jsonDevice.Temperatures[0].current))) {
342
- return this.platform.Characteristic.CurrentHeatingCoolingState.HEAT;
343
- }
344
- else {
345
- return this.platform.Characteristic.CurrentHeatingCoolingState.OFF;
346
- }
347
- }
348
- getTargetState(jsonDevice) {
349
- if (jsonDevice.Operation.power === 'On' && jsonDevice.Mode.modes[0] === 'Opmode_Cool') {
350
- return this.platform.Characteristic.TargetHeatingCoolingState.COOL;
351
- }
352
- else if (jsonDevice.Operation.power === 'On' && jsonDevice.Mode.modes[0] === 'Opmode_Heat') {
353
- return this.platform.Characteristic.TargetHeatingCoolingState.HEAT;
354
- }
355
- else if (jsonDevice.Operation.power === 'On' && jsonDevice.Mode.modes[0] === 'Opmode_Auto') {
356
- return this.platform.Characteristic.TargetHeatingCoolingState.AUTO;
357
- }
358
- else {
359
- return this.platform.Characteristic.TargetHeatingCoolingState.OFF;
360
- }
361
- }
362
- getUnit(jsonTemperature) {
363
- return jsonTemperature.unit === 'Celsius' ?
364
- this.platform.Characteristic.TemperatureDisplayUnits.CELSIUS :
365
- this.platform.Characteristic.TemperatureDisplayUnits.FAHRENHEIT;
366
- }
367
- getFanRotationSpeed(jsonDevice) {
368
- if (jsonDevice.Operation.power === 'Off') {
369
- return 0; // off
370
- }
371
- else if (jsonDevice.Wind.speedLevel === 4) {
372
- return 25; // low
373
- }
374
- else if (jsonDevice.Wind.speedLevel === 3) {
375
- return 50; // medium
376
- }
377
- else if (jsonDevice.Wind.speedLevel === 2) {
378
- return 75; //high
379
- }
380
- else {
381
- return 100; // auto
382
- }
383
- }
384
- }
385
- exports.BeenocoSamsungACPlatformAccessory = BeenocoSamsungACPlatformAccessory;
386
- //# sour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