@switchbot/homebridge-switchbot 4.1.1-beta.0 → 4.1.1-beta.10
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 +14 -0
- package/config.schema.json +2 -2
- package/dist/device/blindtilt.js +104 -104
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +86 -86
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +98 -98
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +140 -140
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +47 -47
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +95 -93
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +13 -13
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +46 -46
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +96 -96
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +46 -46
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +85 -87
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +44 -44
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +119 -119
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +75 -75
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +44 -44
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +42 -42
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.js +42 -42
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.js +44 -44
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +60 -60
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +74 -74
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +54 -56
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/airconditioner.js +31 -31
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.js +10 -10
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.js +9 -9
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.js +11 -11
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.js +11 -11
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.js +9 -9
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.js +93 -93
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.js +33 -33
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -9
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.js +9 -9
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.js +228 -228
- package/dist/platform.js.map +1 -1
- package/docs/functions/default.html +1 -1
- package/package.json +9 -9
- package/src/device/blindtilt.ts +104 -104
- package/src/device/bot.ts +86 -86
- package/src/device/ceilinglight.ts +98 -98
- package/src/device/colorbulb.ts +140 -140
- package/src/device/contact.ts +47 -47
- package/src/device/curtain.ts +95 -93
- package/src/device/device.ts +46 -46
- package/src/device/fan.ts +96 -96
- package/src/device/hub.ts +46 -46
- package/src/device/humidifier.ts +85 -87
- package/src/device/iosensor.ts +44 -44
- package/src/device/lightstrip.ts +119 -119
- package/src/device/lock.ts +75 -75
- package/src/device/meter.ts +44 -44
- package/src/device/meterplus.ts +42 -42
- package/src/device/meterpro.ts +42 -42
- package/src/device/motion.ts +44 -44
- package/src/device/plug.ts +62 -62
- package/src/device/robotvacuumcleaner.ts +74 -74
- package/src/device/waterdetector.ts +54 -55
- package/src/irdevice/airconditioner.ts +31 -31
- package/src/irdevice/airpurifier.ts +10 -10
- package/src/irdevice/camera.ts +9 -9
- package/src/irdevice/fan.ts +11 -11
- package/src/irdevice/irdevice.ts +11 -11
- package/src/irdevice/light.ts +9 -9
- package/src/irdevice/other.ts +93 -93
- package/src/irdevice/tv.ts +33 -33
- package/src/irdevice/vacuumcleaner.ts +9 -9
- package/src/irdevice/waterheater.ts +9 -9
- package/src/platform.ts +228 -228
package/src/irdevice/fan.ts
CHANGED
|
@@ -83,7 +83,7 @@ export class IRFan extends irdeviceBase {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
async SwingModeSet(value: CharacteristicValue): Promise<void> {
|
|
86
|
-
|
|
86
|
+
this.debugLog(`SwingMode: ${value}`)
|
|
87
87
|
if (value > this.Fan.SwingMode) {
|
|
88
88
|
this.Fan.SwingMode = 1
|
|
89
89
|
await this.pushFanOnChanges()
|
|
@@ -98,7 +98,7 @@ export class IRFan extends irdeviceBase {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
async RotationSpeedSet(value: CharacteristicValue): Promise<void> {
|
|
101
|
-
|
|
101
|
+
this.debugLog(`RotationSpeed: ${value}`)
|
|
102
102
|
if (value > this.Fan.RotationSpeed) {
|
|
103
103
|
this.Fan.RotationSpeed = 1
|
|
104
104
|
this.pushFanSpeedUpChanges()
|
|
@@ -112,7 +112,7 @@ export class IRFan extends irdeviceBase {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async ActiveSet(value: CharacteristicValue): Promise<void> {
|
|
115
|
-
|
|
115
|
+
this.debugLog(`Active: ${value}`)
|
|
116
116
|
|
|
117
117
|
this.Fan.Active = value
|
|
118
118
|
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE) {
|
|
@@ -132,7 +132,7 @@ export class IRFan extends irdeviceBase {
|
|
|
132
132
|
* Fan - "command" "highSpeed" "default" = fan speed to high
|
|
133
133
|
*/
|
|
134
134
|
async pushFanOnChanges(): Promise<void> {
|
|
135
|
-
|
|
135
|
+
this.debugLog(`pushFanOnChanges Active: ${this.Fan.Active}, disablePushOn: ${this.disablePushOn}`)
|
|
136
136
|
if (this.Fan.Active === this.hap.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
137
137
|
const commandType: string = await this.commandType()
|
|
138
138
|
const command: string = await this.commandOn()
|
|
@@ -146,7 +146,7 @@ export class IRFan extends irdeviceBase {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
async pushFanOffChanges(): Promise<void> {
|
|
149
|
-
|
|
149
|
+
this.debugLog(`pushLightOffChanges Active: ${this.Fan.Active}, disablePushOff: ${this.disablePushOff}`)
|
|
150
150
|
if (this.Fan.Active === this.hap.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
151
151
|
const commandType: string = await this.commandType()
|
|
152
152
|
const command: string = await this.commandOff()
|
|
@@ -187,12 +187,12 @@ export class IRFan extends irdeviceBase {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
async pushChanges(bodyChange: any): Promise<void> {
|
|
190
|
-
|
|
190
|
+
this.debugLog('pushChanges')
|
|
191
191
|
if (this.device.connectionType === 'OpenAPI') {
|
|
192
|
-
|
|
192
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
193
193
|
try {
|
|
194
|
-
const
|
|
195
|
-
const deviceStatus: any =
|
|
194
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
195
|
+
const deviceStatus: any = response.body
|
|
196
196
|
await this.pushStatusCodes(deviceStatus)
|
|
197
197
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
198
198
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -205,12 +205,12 @@ export class IRFan extends irdeviceBase {
|
|
|
205
205
|
await this.pushChangeError(e)
|
|
206
206
|
}
|
|
207
207
|
} else {
|
|
208
|
-
|
|
208
|
+
this.warnLog(`Connection Type: ${this.device.connectionType}, commands will not be sent to OpenAPI`)
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
213
|
-
|
|
213
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
214
214
|
// Active
|
|
215
215
|
await this.updateCharacteristic(this.Fan.Service, this.hap.Characteristic.Active, this.Fan.Active, 'Active')
|
|
216
216
|
// SwingMode
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -51,16 +51,16 @@ export abstract class irdeviceBase {
|
|
|
51
51
|
async getDeviceLogSettings(device: irdevice & irDevicesConfig): Promise<void> {
|
|
52
52
|
if (this.platform.debugMode) {
|
|
53
53
|
this.deviceLogging = this.accessory.context.logging = 'debugMode'
|
|
54
|
-
|
|
54
|
+
this.debugWarnLog(`Using Debug Mode Logging: ${this.deviceLogging}`)
|
|
55
55
|
} else if (device.logging) {
|
|
56
56
|
this.deviceLogging = this.accessory.context.logging = device.logging
|
|
57
|
-
|
|
57
|
+
this.debugWarnLog(`Using Device Config Logging: ${this.deviceLogging}`)
|
|
58
58
|
} else if (this.config.logging) {
|
|
59
59
|
this.deviceLogging = this.accessory.context.logging = this.config.logging
|
|
60
|
-
|
|
60
|
+
this.debugWarnLog(`Using Platform Config Logging: ${this.deviceLogging}`)
|
|
61
61
|
} else {
|
|
62
62
|
this.deviceLogging = this.accessory.context.logging = 'standard'
|
|
63
|
-
|
|
63
|
+
this.debugWarnLog(`Logging Not Set, Using: ${this.deviceLogging}`)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -116,7 +116,7 @@ export abstract class irdeviceBase {
|
|
|
116
116
|
|
|
117
117
|
const deviceFirmwareVersion = device.firmware ?? accessory.context.version ?? this.platform.version ?? '0.0.0'
|
|
118
118
|
const version = deviceFirmwareVersion.toString()
|
|
119
|
-
|
|
119
|
+
this.debugLog(`version: ${version?.replace(/^V|-.*$/g, '')}`)
|
|
120
120
|
let deviceVersion: string
|
|
121
121
|
if (version?.includes('.') === false) {
|
|
122
122
|
const replace = version?.replace(/^V|-.*$/g, '')
|
|
@@ -158,19 +158,19 @@ export abstract class irdeviceBase {
|
|
|
158
158
|
*/
|
|
159
159
|
async updateCharacteristic(Service: Service, Characteristic: any, CharacteristicValue: CharacteristicValue | undefined, CharacteristicName: string): Promise<void> {
|
|
160
160
|
if (CharacteristicValue === undefined) {
|
|
161
|
-
|
|
161
|
+
this.debugLog(`${CharacteristicName}: ${CharacteristicValue}`)
|
|
162
162
|
} else {
|
|
163
163
|
Service.updateCharacteristic(Characteristic, CharacteristicValue)
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
this.debugLog(`updateCharacteristic ${CharacteristicName}: ${CharacteristicValue}`)
|
|
165
|
+
this.debugWarnLog(`${CharacteristicName} context before: ${this.accessory.context[CharacteristicName]}`)
|
|
166
166
|
this.accessory.context[CharacteristicName] = CharacteristicValue
|
|
167
|
-
|
|
167
|
+
this.debugWarnLog(`${CharacteristicName} context after: ${this.accessory.context[CharacteristicName]}`)
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
async pushStatusCodes(deviceStatus: any) {
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
this.debugWarnLog(`deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
173
|
+
this.debugWarnLog(`deviceStatus statusCode: ${deviceStatus.statusCode}`)
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
async successfulPushChange(deviceStatus: any, bodyChange: any) {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -111,7 +111,7 @@ export class Light extends irdeviceBase {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async OnSet(value: CharacteristicValue): Promise<void> {
|
|
114
|
-
|
|
114
|
+
this.debugLog(`On: ${value}`)
|
|
115
115
|
|
|
116
116
|
this.LightBulb!.On = value
|
|
117
117
|
if (this.LightBulb?.On) {
|
|
@@ -128,7 +128,7 @@ export class Light extends irdeviceBase {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
async ProgrammableSwitchOutputStateSetOn(value: CharacteristicValue): Promise<void> {
|
|
131
|
-
|
|
131
|
+
this.debugLog(`On: ${value}`)
|
|
132
132
|
|
|
133
133
|
this.ProgrammableSwitchOn!.ProgrammableSwitchOutputState = value
|
|
134
134
|
if (this.ProgrammableSwitchOn?.ProgrammableSwitchOutputState === 1) {
|
|
@@ -142,7 +142,7 @@ export class Light extends irdeviceBase {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
async ProgrammableSwitchOutputStateSetOff(value: CharacteristicValue): Promise<void> {
|
|
145
|
-
|
|
145
|
+
this.debugLog(`On: ${value}`)
|
|
146
146
|
|
|
147
147
|
this.ProgrammableSwitchOff!.ProgrammableSwitchOutputState = value
|
|
148
148
|
if (this.ProgrammableSwitchOff?.ProgrammableSwitchOutputState === 1) {
|
|
@@ -166,7 +166,7 @@ export class Light extends irdeviceBase {
|
|
|
166
166
|
* Light - "command" "channelSub" "default" = previous channel
|
|
167
167
|
*/
|
|
168
168
|
async pushLightOnChanges(On: boolean): Promise<void> {
|
|
169
|
-
|
|
169
|
+
this.debugLog(`pushLightOnChanges On: ${On}, disablePushOn: ${this.disablePushOn}`)
|
|
170
170
|
if (On === true && this.disablePushOn === false) {
|
|
171
171
|
const commandType: string = await this.commandType()
|
|
172
172
|
const command: string = await this.commandOn()
|
|
@@ -180,7 +180,7 @@ export class Light extends irdeviceBase {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
async pushLightOffChanges(On: boolean): Promise<void> {
|
|
183
|
-
|
|
183
|
+
this.debugLog(`pushLightOffChanges On: ${On}, disablePushOff: ${this.disablePushOff}`)
|
|
184
184
|
if (On === false && this.disablePushOff === false) {
|
|
185
185
|
const commandType: string = await this.commandType()
|
|
186
186
|
const command: string = await this.commandOff()
|
|
@@ -196,10 +196,10 @@ export class Light extends irdeviceBase {
|
|
|
196
196
|
async pushChanges(bodyChange: any, On: boolean): Promise<void> {
|
|
197
197
|
this.debugLog('pushChanges')
|
|
198
198
|
if (this.device.connectionType === 'OpenAPI') {
|
|
199
|
-
|
|
199
|
+
this.infoLog(`Sending request to SwitchBot API, body: ${JSON.stringify(bodyChange)}`)
|
|
200
200
|
try {
|
|
201
|
-
const
|
|
202
|
-
const deviceStatus: any =
|
|
201
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
202
|
+
const deviceStatus: any = response.body
|
|
203
203
|
await this.pushStatusCodes(deviceStatus)
|
|
204
204
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
205
205
|
await this.successfulPushChange(deviceStatus, bodyChange)
|
|
@@ -218,7 +218,7 @@ export class Light extends irdeviceBase {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
221
|
-
|
|
221
|
+
this.debugLog('updateHomeKitCharacteristics')
|
|
222
222
|
if (!(this.device as irLightConfig).stateless && this.LightBulb?.Service) {
|
|
223
223
|
// On
|
|
224
224
|
await this.updateCharacteristic(this.LightBulb.Service, this.hap.Characteristic.On, this.LightBulb.On, 'On')
|