@switchbot/homebridge-switchbot 3.7.1-beta.2 → 3.7.1-beta.21
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 +10 -0
- package/README.md +14 -0
- package/assets/security-privacy-bluetooth.png +0 -0
- package/config.schema.json +74 -2
- package/dist/device/blindtilt.d.ts +21 -9
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +167 -96
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot-old.d.ts +132 -0
- package/dist/device/bot-old.d.ts.map +1 -0
- package/dist/device/bot-old.js +1482 -0
- package/dist/device/bot-old.js.map +1 -0
- package/dist/device/bot.d.ts +10 -9
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +186 -187
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +14 -13
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +87 -97
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +13 -12
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +92 -105
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +6 -5
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +71 -68
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +17 -5
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +184 -118
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +18 -18
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +33 -36
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts +9 -8
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +94 -101
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +6 -5
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +69 -65
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +6 -5
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +89 -104
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +6 -5
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +72 -66
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +7 -6
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +85 -99
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +10 -9
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +89 -79
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +6 -5
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +72 -65
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +6 -5
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +72 -64
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +6 -5
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +65 -58
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +13 -12
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +68 -52
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +12 -11
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +93 -82
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts +6 -5
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +73 -63
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/server.js +2 -2
- package/dist/homebridge-ui/server.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +8 -8
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +61 -105
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +10 -10
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +22 -42
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +9 -9
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +15 -25
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +8 -8
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +21 -40
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +11 -11
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +14 -22
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +9 -9
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +24 -47
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +9 -9
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +40 -83
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +9 -9
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +29 -54
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +5 -5
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +11 -21
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +5 -5
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +11 -22
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +24 -23
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +509 -723
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +5 -2
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/types/bledevicestatus.d.ts +9 -9
- package/dist/types/bledevicestatus.d.ts.map +1 -1
- package/dist/types/devicelist.d.ts +6 -6
- package/dist/types/devicelist.d.ts.map +1 -1
- package/dist/types/deviceresponse.d.ts +4 -4
- package/dist/types/deviceresponse.d.ts.map +1 -1
- package/dist/types/devicestatus.d.ts +2 -2
- package/dist/types/devicestatus.d.ts.map +1 -1
- package/dist/types/devicewebhookstatus.d.ts +5 -5
- package/dist/types/devicewebhookstatus.d.ts.map +1 -1
- package/dist/types/irdevicelist.d.ts +4 -4
- package/dist/types/irdevicelist.d.ts.map +1 -1
- package/dist/types/pushbody.d.ts +2 -2
- package/dist/types/pushbody.d.ts.map +1 -1
- package/dist/utils.d.ts +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +9 -13
- package/dist/utils.js.map +1 -1
- package/eslint.config.js +48 -93
- package/package.json +64 -57
- package/src/device/blindtilt.ts +537 -456
- package/src/device/bot-old.ts +1540 -0
- package/src/device/bot.ts +732 -725
- package/src/device/ceilinglight.ts +359 -368
- package/src/device/colorbulb.ts +441 -453
- package/src/device/contact.ts +229 -226
- package/src/device/curtain.ts +526 -444
- package/src/device/device.ts +206 -208
- package/src/device/fan.ts +336 -345
- package/src/device/hub.ts +213 -214
- package/src/device/humidifier.ts +326 -347
- package/src/device/iosensor.ts +211 -209
- package/src/device/lightstrip.ts +391 -404
- package/src/device/lock.ts +292 -282
- package/src/device/meter.ts +212 -210
- package/src/device/meterplus.ts +212 -209
- package/src/device/motion.ts +198 -190
- package/src/device/plug.ts +203 -182
- package/src/device/robotvacuumcleaner.ts +280 -269
- package/src/device/waterdetector.ts +198 -189
- package/src/homebridge-ui/server.ts +16 -15
- package/src/index.ts +5 -6
- package/src/irdevice/airconditioner.ts +277 -326
- package/src/irdevice/airpurifier.ts +124 -143
- package/src/irdevice/camera.ts +58 -64
- package/src/irdevice/fan.ts +106 -123
- package/src/irdevice/irdevice.ts +116 -119
- package/src/irdevice/light.ts +119 -143
- package/src/irdevice/other.ts +417 -461
- package/src/irdevice/tv.ts +155 -177
- package/src/irdevice/vacuumcleaner.ts +54 -60
- package/src/irdevice/waterheater.ts +56 -63
- package/src/platform.ts +1491 -1681
- package/src/settings.ts +172 -169
- package/src/types/bledevicestatus.ts +252 -256
- package/src/types/devicelist.ts +79 -79
- package/src/types/deviceresponse.ts +12 -13
- package/src/types/devicestatus.ts +124 -124
- package/src/types/devicewebhookstatus.ts +126 -131
- package/src/types/irdevicelist.ts +10 -10
- package/src/types/pushbody.ts +5 -5
- package/src/utils.ts +64 -65
- package/tsconfig.json +10 -9
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
*
|
|
3
3
|
* airpurifier.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
|
|
7
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
|
-
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
|
-
|
|
7
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
|
+
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
+
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
|
+
|
|
11
|
+
import { irdeviceBase } from './irdevice.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Platform Accessory
|
|
@@ -17,48 +18,48 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
|
|
|
17
18
|
export class AirPurifier extends irdeviceBase {
|
|
18
19
|
// Services
|
|
19
20
|
private AirPurifier: {
|
|
20
|
-
Name: CharacteristicValue
|
|
21
|
-
Service: Service
|
|
22
|
-
Active: CharacteristicValue
|
|
23
|
-
RotationSpeed: CharacteristicValue
|
|
24
|
-
CurrentAirPurifierState: CharacteristicValue
|
|
25
|
-
TargetAirPurifierState: CharacteristicValue
|
|
26
|
-
CurrentHeaterCoolerState: CharacteristicValue
|
|
27
|
-
}
|
|
21
|
+
Name: CharacteristicValue
|
|
22
|
+
Service: Service
|
|
23
|
+
Active: CharacteristicValue
|
|
24
|
+
RotationSpeed: CharacteristicValue
|
|
25
|
+
CurrentAirPurifierState: CharacteristicValue
|
|
26
|
+
TargetAirPurifierState: CharacteristicValue
|
|
27
|
+
CurrentHeaterCoolerState: CharacteristicValue
|
|
28
|
+
}
|
|
28
29
|
|
|
29
30
|
private TemperatureSensor: {
|
|
30
|
-
Name: CharacteristicValue
|
|
31
|
-
Service: Service
|
|
32
|
-
CurrentTemperature: CharacteristicValue
|
|
33
|
-
}
|
|
31
|
+
Name: CharacteristicValue
|
|
32
|
+
Service: Service
|
|
33
|
+
CurrentTemperature: CharacteristicValue
|
|
34
|
+
}
|
|
34
35
|
|
|
35
36
|
// Characteristic Values
|
|
36
|
-
APActive!: CharacteristicValue
|
|
37
|
-
CurrentAPTemp!: CharacteristicValue
|
|
38
|
-
CurrentAPMode!: CharacteristicValue
|
|
39
|
-
CurrentAPFanSpeed!: CharacteristicValue
|
|
37
|
+
APActive!: CharacteristicValue
|
|
38
|
+
CurrentAPTemp!: CharacteristicValue
|
|
39
|
+
CurrentAPMode!: CharacteristicValue
|
|
40
|
+
CurrentAPFanSpeed!: CharacteristicValue
|
|
40
41
|
|
|
41
42
|
// Others
|
|
42
|
-
Busy: any
|
|
43
|
-
Timeout: any = null
|
|
44
|
-
static IDLE: number
|
|
45
|
-
CurrentMode!: number
|
|
46
|
-
static INACTIVE: number
|
|
47
|
-
LastTemperature!: number
|
|
48
|
-
CurrentFanSpeed!: number
|
|
49
|
-
static PURIFYING_AIR: number
|
|
43
|
+
Busy: any
|
|
44
|
+
Timeout: any = null
|
|
45
|
+
static IDLE: number
|
|
46
|
+
CurrentMode!: number
|
|
47
|
+
static INACTIVE: number
|
|
48
|
+
LastTemperature!: number
|
|
49
|
+
CurrentFanSpeed!: number
|
|
50
|
+
static PURIFYING_AIR: number
|
|
50
51
|
|
|
51
52
|
constructor(
|
|
52
53
|
readonly platform: SwitchBotPlatform,
|
|
53
54
|
accessory: PlatformAccessory,
|
|
54
55
|
device: irdevice & irDevicesConfig,
|
|
55
56
|
) {
|
|
56
|
-
super(platform, accessory, device)
|
|
57
|
+
super(platform, accessory, device)
|
|
57
58
|
// Set category
|
|
58
|
-
accessory.category = this.hap.Categories.AIR_PURIFIER
|
|
59
|
+
accessory.category = this.hap.Categories.AIR_PURIFIER
|
|
59
60
|
|
|
60
61
|
// Initialize AirPurifier Service
|
|
61
|
-
accessory.context.AirPurifier = accessory.context.AirPurifier ?? {}
|
|
62
|
+
accessory.context.AirPurifier = accessory.context.AirPurifier ?? {}
|
|
62
63
|
this.AirPurifier = {
|
|
63
64
|
Name: accessory.displayName,
|
|
64
65
|
Service: accessory.getService(this.hap.Service.AirPurifier) ?? accessory.addService(this.hap.Service.AirPurifier) as Service,
|
|
@@ -67,207 +68,187 @@ export class AirPurifier extends irdeviceBase {
|
|
|
67
68
|
CurrentAirPurifierState: accessory.context.CurrentAirPurifierState ?? this.hap.Characteristic.CurrentAirPurifierState.INACTIVE,
|
|
68
69
|
TargetAirPurifierState: accessory.context.TargetAirPurifierState ?? this.hap.Characteristic.TargetAirPurifierState.AUTO,
|
|
69
70
|
CurrentHeaterCoolerState: accessory.context.CurrentHeaterCoolerState ?? this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE,
|
|
70
|
-
}
|
|
71
|
-
accessory.context.AirPurifier = this.AirPurifier as object
|
|
71
|
+
}
|
|
72
|
+
accessory.context.AirPurifier = this.AirPurifier as object
|
|
72
73
|
|
|
73
|
-
this.AirPurifier.Service
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.onGet(() => {
|
|
77
|
-
return this.AirPurifier.Active;
|
|
78
|
-
})
|
|
79
|
-
.onSet(this.ActiveSet.bind(this));
|
|
74
|
+
this.AirPurifier.Service.setCharacteristic(this.hap.Characteristic.Name, this.AirPurifier.Name).getCharacteristic(this.hap.Characteristic.Active).onGet(() => {
|
|
75
|
+
return this.AirPurifier.Active
|
|
76
|
+
}).onSet(this.ActiveSet.bind(this))
|
|
80
77
|
|
|
81
|
-
this.AirPurifier.Service
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
return this.CurrentAirPurifierStateGet();
|
|
85
|
-
});
|
|
78
|
+
this.AirPurifier.Service.getCharacteristic(this.hap.Characteristic.CurrentAirPurifierState).onGet(() => {
|
|
79
|
+
return this.CurrentAirPurifierStateGet()
|
|
80
|
+
})
|
|
86
81
|
|
|
87
|
-
this.AirPurifier.Service
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return this.AirPurifier.TargetAirPurifierState;
|
|
91
|
-
})
|
|
92
|
-
.onSet(this.TargetAirPurifierStateSet.bind(this));
|
|
82
|
+
this.AirPurifier.Service.getCharacteristic(this.hap.Characteristic.TargetAirPurifierState).onGet(() => {
|
|
83
|
+
return this.AirPurifier.TargetAirPurifierState
|
|
84
|
+
}).onSet(this.TargetAirPurifierStateSet.bind(this))
|
|
93
85
|
|
|
94
86
|
// Initialize TemperatureSensor Service
|
|
95
|
-
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {}
|
|
87
|
+
accessory.context.TemperatureSensor = accessory.context.TemperatureSensor ?? {}
|
|
96
88
|
this.TemperatureSensor = {
|
|
97
89
|
Name: `${accessory.displayName} Temperature Sensor`,
|
|
98
90
|
Service: accessory.getService(this.hap.Service.TemperatureSensor) ?? accessory.addService(this.hap.Service.TemperatureSensor) as Service,
|
|
99
91
|
CurrentTemperature: accessory.context.CurrentTemperature || 24,
|
|
100
|
-
}
|
|
101
|
-
accessory.context.TemperatureSensor = this.TemperatureSensor as object
|
|
92
|
+
}
|
|
93
|
+
accessory.context.TemperatureSensor = this.TemperatureSensor as object
|
|
102
94
|
|
|
103
|
-
this.TemperatureSensor.Service
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.onGet(() => {
|
|
107
|
-
return this.TemperatureSensor.CurrentTemperature;
|
|
108
|
-
});
|
|
95
|
+
this.TemperatureSensor.Service.setCharacteristic(this.hap.Characteristic.Name, this.TemperatureSensor.Name).getCharacteristic(this.hap.Characteristic.CurrentTemperature).onGet(() => {
|
|
96
|
+
return this.TemperatureSensor.CurrentTemperature
|
|
97
|
+
})
|
|
109
98
|
}
|
|
110
99
|
|
|
111
100
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
112
|
-
await this.debugLog(`Set Active: ${value}`)
|
|
101
|
+
await this.debugLog(`Set Active: ${value}`)
|
|
113
102
|
|
|
114
|
-
this.AirPurifier.Active = value
|
|
103
|
+
this.AirPurifier.Active = value
|
|
115
104
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
116
|
-
this.pushAirPurifierOnChanges()
|
|
105
|
+
this.pushAirPurifierOnChanges()
|
|
117
106
|
} else {
|
|
118
|
-
this.pushAirPurifierOffChanges()
|
|
107
|
+
this.pushAirPurifierOffChanges()
|
|
119
108
|
}
|
|
120
109
|
}
|
|
121
110
|
|
|
122
111
|
async TargetAirPurifierStateSet(value: CharacteristicValue): Promise<void> {
|
|
123
112
|
switch (value) {
|
|
124
113
|
case this.hap.Characteristic.CurrentAirPurifierState.PURIFYING_AIR:
|
|
125
|
-
this.CurrentMode = AirPurifier.PURIFYING_AIR
|
|
126
|
-
break
|
|
114
|
+
this.CurrentMode = AirPurifier.PURIFYING_AIR
|
|
115
|
+
break
|
|
127
116
|
case this.hap.Characteristic.CurrentAirPurifierState.IDLE:
|
|
128
|
-
this.CurrentMode = AirPurifier.IDLE
|
|
129
|
-
break
|
|
117
|
+
this.CurrentMode = AirPurifier.IDLE
|
|
118
|
+
break
|
|
130
119
|
case this.hap.Characteristic.CurrentAirPurifierState.INACTIVE:
|
|
131
|
-
this.CurrentMode = AirPurifier.INACTIVE
|
|
132
|
-
break
|
|
120
|
+
this.CurrentMode = AirPurifier.INACTIVE
|
|
121
|
+
break
|
|
133
122
|
default:
|
|
134
|
-
break
|
|
123
|
+
break
|
|
135
124
|
}
|
|
136
125
|
}
|
|
137
126
|
|
|
138
127
|
async CurrentAirPurifierStateGet(): Promise<number> {
|
|
139
128
|
if (this.AirPurifier.Active === 1) {
|
|
140
|
-
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.PURIFYING_AIR
|
|
129
|
+
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.PURIFYING_AIR
|
|
141
130
|
} else {
|
|
142
|
-
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.INACTIVE
|
|
131
|
+
this.AirPurifier.CurrentAirPurifierState = this.hap.Characteristic.CurrentAirPurifierState.INACTIVE
|
|
143
132
|
}
|
|
144
|
-
return this.AirPurifier.CurrentAirPurifierState
|
|
133
|
+
return this.AirPurifier.CurrentAirPurifierState
|
|
145
134
|
}
|
|
146
135
|
|
|
147
136
|
/**
|
|
148
137
|
* Pushes the requested changes to the SwitchBot API
|
|
149
|
-
* deviceType
|
|
150
|
-
* AirPurifier: "command" "turnOn" "default"
|
|
151
|
-
* AirPurifier: "command" "turnOff" "default"
|
|
152
|
-
* AirPurifier: "command" "swing" "default"
|
|
153
|
-
* AirPurifier: "command" "timer" "default"
|
|
154
|
-
* AirPurifier: "command" "lowSpeed" "default"
|
|
155
|
-
* AirPurifier: "command" "middleSpeed" "default"
|
|
156
|
-
* AirPurifier: "command" "highSpeed" "default"
|
|
138
|
+
* deviceType commandType Command command parameter Description
|
|
139
|
+
* AirPurifier: "command" "turnOn" "default" = every home appliance can be turned on by default
|
|
140
|
+
* AirPurifier: "command" "turnOff" "default" = every home appliance can be turned off by default
|
|
141
|
+
* AirPurifier: "command" "swing" "default" = swing
|
|
142
|
+
* AirPurifier: "command" "timer" "default" = timer
|
|
143
|
+
* AirPurifier: "command" "lowSpeed" "default" = fan speed to low
|
|
144
|
+
* AirPurifier: "command" "middleSpeed" "default" = fan speed to medium
|
|
145
|
+
* AirPurifier: "command" "highSpeed" "default" = fan speed to high
|
|
157
146
|
*/
|
|
158
147
|
async pushAirPurifierOnChanges(): Promise<void> {
|
|
159
|
-
await this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}
|
|
160
|
-
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
148
|
+
await this.debugLog(`pushAirPurifierOnChanges Active: ${this.AirPurifier.Active}, disablePushOn: ${this.disablePushOn}`)
|
|
161
149
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
162
|
-
const commandType: string = await this.commandType()
|
|
163
|
-
const command: string = await this.commandOn()
|
|
150
|
+
const commandType: string = await this.commandType()
|
|
151
|
+
const command: string = await this.commandOn()
|
|
164
152
|
const bodyChange = JSON.stringify({
|
|
165
|
-
command
|
|
153
|
+
command,
|
|
166
154
|
parameter: 'default',
|
|
167
|
-
commandType
|
|
168
|
-
})
|
|
169
|
-
await this.pushChanges(bodyChange)
|
|
155
|
+
commandType,
|
|
156
|
+
})
|
|
157
|
+
await this.pushChanges(bodyChange)
|
|
170
158
|
}
|
|
171
159
|
}
|
|
172
160
|
|
|
173
161
|
async pushAirPurifierOffChanges(): Promise<void> {
|
|
174
|
-
await this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}
|
|
175
|
-
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
162
|
+
await this.debugLog(`pushAirPurifierOffChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}`)
|
|
176
163
|
if (this.AirPurifier.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
177
|
-
const commandType: string = await this.commandType()
|
|
178
|
-
const command: string = await this.commandOff()
|
|
164
|
+
const commandType: string = await this.commandType()
|
|
165
|
+
const command: string = await this.commandOff()
|
|
179
166
|
const bodyChange = JSON.stringify({
|
|
180
|
-
command
|
|
167
|
+
command,
|
|
181
168
|
parameter: 'default',
|
|
182
|
-
commandType
|
|
183
|
-
})
|
|
184
|
-
await this.pushChanges(bodyChange)
|
|
169
|
+
commandType,
|
|
170
|
+
})
|
|
171
|
+
await this.pushChanges(bodyChange)
|
|
185
172
|
}
|
|
186
173
|
}
|
|
187
174
|
|
|
188
175
|
async pushAirPurifierStatusChanges(): Promise<void> {
|
|
189
|
-
await this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}
|
|
190
|
-
+ ` disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`);
|
|
176
|
+
await this.debugLog(`pushAirPurifierStatusChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
|
|
191
177
|
if (!this.Busy) {
|
|
192
|
-
this.Busy = true
|
|
193
|
-
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
|
|
178
|
+
this.Busy = true
|
|
179
|
+
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.IDLE
|
|
194
180
|
}
|
|
195
|
-
clearTimeout(this.Timeout)
|
|
181
|
+
clearTimeout(this.Timeout)
|
|
196
182
|
|
|
197
183
|
// Make a new Timeout set to go off in 1000ms (1 second)
|
|
198
|
-
this.Timeout = setTimeout(this.pushAirPurifierDetailsChanges.bind(this), 1500)
|
|
184
|
+
this.Timeout = setTimeout(this.pushAirPurifierDetailsChanges.bind(this), 1500)
|
|
199
185
|
}
|
|
200
186
|
|
|
201
187
|
async pushAirPurifierDetailsChanges(): Promise<void> {
|
|
202
|
-
await this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}
|
|
203
|
-
|
|
204
|
-
this.
|
|
205
|
-
this.
|
|
206
|
-
this.
|
|
207
|
-
|
|
208
|
-
const parameter = `${this.CurrentAPTemp},${this.CurrentAPMode},${this.CurrentAPFanSpeed},${this.APActive}`;
|
|
188
|
+
await this.debugLog(`pushAirPurifierDetailsChanges Active: ${this.AirPurifier.Active}, disablePushOff: ${this.disablePushOff}, disablePushOn: ${this.disablePushOn}`)
|
|
189
|
+
this.CurrentAPTemp = this.TemperatureSensor!.CurrentTemperature ?? 24
|
|
190
|
+
this.CurrentAPMode = this.CurrentMode ?? 1
|
|
191
|
+
this.CurrentAPFanSpeed = this.CurrentFanSpeed ?? 1
|
|
192
|
+
this.APActive = this.AirPurifier.Active === 1 ? 'on' : 'off'
|
|
193
|
+
const parameter = `${this.CurrentAPTemp},${this.CurrentAPMode},${this.CurrentAPFanSpeed},${this.APActive}`
|
|
209
194
|
const bodyChange = JSON.stringify({
|
|
210
195
|
command: 'setAll',
|
|
211
196
|
parameter: `${parameter}`,
|
|
212
197
|
commandType: 'command',
|
|
213
|
-
})
|
|
198
|
+
})
|
|
214
199
|
if (this.AirPurifier.Active === 1) {
|
|
215
200
|
if ((Number(this.TemperatureSensor!.CurrentTemperature) || 24) < (this.LastTemperature || 30)) {
|
|
216
|
-
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING
|
|
201
|
+
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.COOLING
|
|
217
202
|
} else {
|
|
218
|
-
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.HEATING
|
|
203
|
+
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.HEATING
|
|
219
204
|
}
|
|
220
205
|
} else {
|
|
221
|
-
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE
|
|
206
|
+
this.AirPurifier.CurrentHeaterCoolerState = this.hap.Characteristic.CurrentHeaterCoolerState.INACTIVE
|
|
222
207
|
}
|
|
223
|
-
await this.pushChanges(bodyChange)
|
|
208
|
+
await this.pushChanges(bodyChange)
|
|
224
209
|
}
|
|
225
210
|
|
|
226
211
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
227
|
-
await this.debugLog('pushChanges')
|
|
212
|
+
await this.debugLog('pushChanges')
|
|
228
213
|
if (this.device.connectionType === 'OpenAPI') {
|
|
229
|
-
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`)
|
|
214
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`)
|
|
230
215
|
try {
|
|
231
|
-
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
232
|
-
const deviceStatus: any = await body.json()
|
|
233
|
-
await this.pushStatusCodes(statusCode, deviceStatus)
|
|
216
|
+
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
217
|
+
const deviceStatus: any = await body.json()
|
|
218
|
+
await this.pushStatusCodes(statusCode, deviceStatus)
|
|
234
219
|
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
235
|
-
await this.successfulPushChange(statusCode, deviceStatus, bodyChange)
|
|
236
|
-
await this.updateHomeKitCharacteristics()
|
|
220
|
+
await this.successfulPushChange(statusCode, deviceStatus, bodyChange)
|
|
221
|
+
await this.updateHomeKitCharacteristics()
|
|
237
222
|
} else {
|
|
238
|
-
await this.statusCode(statusCode)
|
|
239
|
-
await this.statusCode(deviceStatus.statusCode)
|
|
223
|
+
await this.statusCode(statusCode)
|
|
224
|
+
await this.statusCode(deviceStatus.statusCode)
|
|
240
225
|
}
|
|
241
226
|
} catch (e: any) {
|
|
242
|
-
await this.apiError(e)
|
|
243
|
-
await this.pushChangeError(e)
|
|
227
|
+
await this.apiError(e)
|
|
228
|
+
await this.pushChangeError(e)
|
|
244
229
|
}
|
|
245
230
|
} else {
|
|
246
|
-
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
231
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
247
232
|
}
|
|
248
233
|
}
|
|
249
234
|
|
|
250
235
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
251
|
-
await this.debugLog('updateHomeKitCharacteristics')
|
|
236
|
+
await this.debugLog('updateHomeKitCharacteristics')
|
|
252
237
|
// Active
|
|
253
|
-
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.Active,
|
|
254
|
-
this.AirPurifier.Active, 'Active');
|
|
238
|
+
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.Active, this.AirPurifier.Active, 'Active')
|
|
255
239
|
// CurrentAirPurifierState
|
|
256
|
-
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.CurrentAirPurifierState,
|
|
257
|
-
this.AirPurifier.CurrentAirPurifierState, 'CurrentAirPurifierState');
|
|
240
|
+
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.CurrentAirPurifierState, this.AirPurifier.CurrentAirPurifierState, 'CurrentAirPurifierState')
|
|
258
241
|
// CurrentHeaterCoolerState
|
|
259
|
-
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.CurrentHeaterCoolerState,
|
|
260
|
-
this.AirPurifier.CurrentHeaterCoolerState, 'CurrentHeaterCoolerState');
|
|
242
|
+
await this.updateCharacteristic(this.AirPurifier.Service, this.hap.Characteristic.CurrentHeaterCoolerState, this.AirPurifier.CurrentHeaterCoolerState, 'CurrentHeaterCoolerState')
|
|
261
243
|
// CurrentTemperature
|
|
262
|
-
await this.updateCharacteristic(this.TemperatureSensor.Service, this.hap.Characteristic.CurrentTemperature,
|
|
263
|
-
this.TemperatureSensor.CurrentTemperature, 'CurrentTemperature');
|
|
244
|
+
await this.updateCharacteristic(this.TemperatureSensor.Service, this.hap.Characteristic.CurrentTemperature, this.TemperatureSensor.CurrentTemperature, 'CurrentTemperature')
|
|
264
245
|
}
|
|
265
246
|
|
|
266
247
|
async apiError(e: any): Promise<void> {
|
|
267
|
-
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.Active, e)
|
|
268
|
-
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.TargetAirPurifierState, e)
|
|
269
|
-
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentAirPurifierState, e)
|
|
270
|
-
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e)
|
|
271
|
-
this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e)
|
|
248
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.Active, e)
|
|
249
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.TargetAirPurifierState, e)
|
|
250
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentAirPurifierState, e)
|
|
251
|
+
this.AirPurifier.Service.updateCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState, e)
|
|
252
|
+
this.TemperatureSensor.Service.updateCharacteristic(this.hap.Characteristic.CurrentTemperature, e)
|
|
272
253
|
}
|
|
273
254
|
}
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
*
|
|
3
3
|
* camera.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
6
|
|
|
7
|
-
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
|
-
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
-
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
|
-
|
|
7
|
+
import type { SwitchBotPlatform } from '../platform.js'
|
|
8
|
+
import type { irDevicesConfig } from '../settings.js'
|
|
9
|
+
import type { irdevice } from '../types/irdevicelist.js'
|
|
10
|
+
|
|
11
|
+
import { irdeviceBase } from './irdevice.js'
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Platform Accessory
|
|
@@ -17,121 +18,114 @@ import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge
|
|
|
17
18
|
export class Camera extends irdeviceBase {
|
|
18
19
|
// Services
|
|
19
20
|
private Switch: {
|
|
20
|
-
Name: CharacteristicValue
|
|
21
|
-
Service: Service
|
|
22
|
-
On: CharacteristicValue
|
|
23
|
-
}
|
|
21
|
+
Name: CharacteristicValue
|
|
22
|
+
Service: Service
|
|
23
|
+
On: CharacteristicValue
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
constructor(
|
|
26
27
|
readonly platform: SwitchBotPlatform,
|
|
27
28
|
accessory: PlatformAccessory,
|
|
28
29
|
device: irdevice & irDevicesConfig,
|
|
29
30
|
) {
|
|
30
|
-
super(platform, accessory, device)
|
|
31
|
+
super(platform, accessory, device)
|
|
31
32
|
// Set category
|
|
32
|
-
accessory.category = this.hap.Categories.CAMERA
|
|
33
|
+
accessory.category = this.hap.Categories.CAMERA
|
|
33
34
|
|
|
34
35
|
// Initialize Switch Service
|
|
35
|
-
accessory.context.Switch = accessory.context.Switch ?? {}
|
|
36
|
+
accessory.context.Switch = accessory.context.Switch ?? {}
|
|
36
37
|
this.Switch = {
|
|
37
38
|
Name: accessory.displayName,
|
|
38
39
|
Service: accessory.getService(this.hap.Service.Switch) ?? accessory.addService(this.hap.Service.Switch) as Service,
|
|
39
40
|
On: accessory.context.On ?? false,
|
|
40
|
-
}
|
|
41
|
-
accessory.context.Switch = this.Switch as object
|
|
41
|
+
}
|
|
42
|
+
accessory.context.Switch = this.Switch as object
|
|
42
43
|
|
|
43
|
-
this.Switch.Service
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.onGet(() => {
|
|
47
|
-
return this.Switch.On;
|
|
48
|
-
})
|
|
49
|
-
.onSet(this.OnSet.bind(this));
|
|
44
|
+
this.Switch.Service.setCharacteristic(this.hap.Characteristic.Name, this.Switch.Name).getCharacteristic(this.hap.Characteristic.On).onGet(() => {
|
|
45
|
+
return this.Switch.On
|
|
46
|
+
}).onSet(this.OnSet.bind(this))
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
53
|
-
await this.debugLog(`On: ${value}`)
|
|
50
|
+
await this.debugLog(`On: ${value}`)
|
|
54
51
|
|
|
55
|
-
this.Switch.On = value
|
|
52
|
+
this.Switch.On = value
|
|
56
53
|
if (this.Switch.On) {
|
|
57
|
-
this.pushOnChanges()
|
|
54
|
+
this.pushOnChanges()
|
|
58
55
|
} else {
|
|
59
|
-
this.pushOffChanges()
|
|
56
|
+
this.pushOffChanges()
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
/**
|
|
64
61
|
* Pushes the requested changes to the SwitchBot API
|
|
65
|
-
* deviceType
|
|
66
|
-
* Camera - "command" "turnOff" "default"
|
|
67
|
-
* Camera - "command" "turnOn" "default"
|
|
68
|
-
* Camera - "command" "volumeAdd" "default"
|
|
69
|
-
* Camera - "command" "volumeSub" "default"
|
|
70
|
-
* Camera - "command" "channelAdd" "default"
|
|
71
|
-
* Camera - "command" "channelSub" "default"
|
|
62
|
+
* deviceType commandType Command command parameter Description
|
|
63
|
+
* Camera - "command" "turnOff" "default" = set to OFF state
|
|
64
|
+
* Camera - "command" "turnOn" "default" = set to ON state
|
|
65
|
+
* Camera - "command" "volumeAdd" "default" = volume up
|
|
66
|
+
* Camera - "command" "volumeSub" "default" = volume down
|
|
67
|
+
* Camera - "command" "channelAdd" "default" = next channel
|
|
68
|
+
* Camera - "command" "channelSub" "default" = previous channel
|
|
72
69
|
*/
|
|
73
70
|
async pushOnChanges(): Promise<void> {
|
|
74
|
-
await this.debugLog(`pushOnChanges On: ${this.Switch.On}
|
|
75
|
-
+ ` disablePushOn: ${this.disablePushOn}`);
|
|
71
|
+
await this.debugLog(`pushOnChanges On: ${this.Switch.On}, disablePushOn: ${this.disablePushOn}`)
|
|
76
72
|
if (this.Switch.On && !this.disablePushOn) {
|
|
77
|
-
const commandType: string = await this.commandType()
|
|
78
|
-
const command: string = await this.commandOn()
|
|
73
|
+
const commandType: string = await this.commandType()
|
|
74
|
+
const command: string = await this.commandOn()
|
|
79
75
|
const bodyChange = JSON.stringify({
|
|
80
|
-
command
|
|
76
|
+
command,
|
|
81
77
|
parameter: 'default',
|
|
82
|
-
commandType
|
|
83
|
-
})
|
|
84
|
-
await this.pushChanges(bodyChange)
|
|
78
|
+
commandType,
|
|
79
|
+
})
|
|
80
|
+
await this.pushChanges(bodyChange)
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
async pushOffChanges(): Promise<void> {
|
|
89
|
-
await this.debugLog(`pushOffChanges On: ${this.Switch.On}
|
|
90
|
-
+ ` disablePushOff: ${this.disablePushOff}`);
|
|
85
|
+
await this.debugLog(`pushOffChanges On: ${this.Switch.On}, disablePushOff: ${this.disablePushOff}`)
|
|
91
86
|
if (!this.Switch.On && !this.disablePushOff) {
|
|
92
|
-
const commandType: string = await this.commandType()
|
|
93
|
-
const command: string = await this.commandOff()
|
|
87
|
+
const commandType: string = await this.commandType()
|
|
88
|
+
const command: string = await this.commandOff()
|
|
94
89
|
const bodyChange = JSON.stringify({
|
|
95
|
-
command
|
|
90
|
+
command,
|
|
96
91
|
parameter: 'default',
|
|
97
|
-
commandType
|
|
98
|
-
})
|
|
99
|
-
await this.pushChanges(bodyChange)
|
|
92
|
+
commandType,
|
|
93
|
+
})
|
|
94
|
+
await this.pushChanges(bodyChange)
|
|
100
95
|
}
|
|
101
96
|
}
|
|
102
97
|
|
|
103
98
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
104
|
-
await this.debugLog('pushChanges')
|
|
99
|
+
await this.debugLog('pushChanges')
|
|
105
100
|
if (this.device.connectionType === 'OpenAPI') {
|
|
106
|
-
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`)
|
|
101
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${bodyChange},`)
|
|
107
102
|
try {
|
|
108
|
-
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
109
|
-
const deviceStatus: any = await body.json()
|
|
110
|
-
await this.pushStatusCodes(statusCode, deviceStatus)
|
|
103
|
+
const { body, statusCode } = await this.pushChangeRequest(bodyChange)
|
|
104
|
+
const deviceStatus: any = await body.json()
|
|
105
|
+
await this.pushStatusCodes(statusCode, deviceStatus)
|
|
111
106
|
if (await this.successfulStatusCodes(statusCode, deviceStatus)) {
|
|
112
|
-
await this.successfulPushChange(statusCode, deviceStatus, bodyChange)
|
|
113
|
-
await this.updateHomeKitCharacteristics()
|
|
107
|
+
await this.successfulPushChange(statusCode, deviceStatus, bodyChange)
|
|
108
|
+
await this.updateHomeKitCharacteristics()
|
|
114
109
|
} else {
|
|
115
|
-
await this.statusCode(statusCode)
|
|
116
|
-
await this.statusCode(deviceStatus.statusCode)
|
|
110
|
+
await this.statusCode(statusCode)
|
|
111
|
+
await this.statusCode(deviceStatus.statusCode)
|
|
117
112
|
}
|
|
118
113
|
} catch (e: any) {
|
|
119
|
-
await this.apiError(e)
|
|
120
|
-
await this.pushChangeError(e)
|
|
114
|
+
await this.apiError(e)
|
|
115
|
+
await this.pushChangeError(e)
|
|
121
116
|
}
|
|
122
117
|
} else {
|
|
123
|
-
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
118
|
+
await this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
124
119
|
}
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
128
|
-
await this.debugLog('updateHomeKitCharacteristics')
|
|
123
|
+
await this.debugLog('updateHomeKitCharacteristics')
|
|
129
124
|
// Active
|
|
130
|
-
await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On,
|
|
131
|
-
this.Switch.On, 'On');
|
|
125
|
+
await this.updateCharacteristic(this.Switch.Service, this.hap.Characteristic.On, this.Switch.On, 'On')
|
|
132
126
|
}
|
|
133
127
|
|
|
134
128
|
async apiError(e: any): Promise<void> {
|
|
135
|
-
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, e)
|
|
129
|
+
this.Switch.Service.updateCharacteristic(this.hap.Characteristic.On, e)
|
|
136
130
|
}
|
|
137
131
|
}
|