@switchbot/homebridge-switchbot 2.10.1-beta.1 → 2.10.1-beta.2
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/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +23 -0
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +23 -0
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +23 -0
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +36 -0
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +25 -0
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +22 -0
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +92 -6
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +24 -0
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +35 -0
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +21 -0
- package/dist/device/lock.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +21 -0
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +21 -0
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +22 -0
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +23 -0
- package/src/device/bot.ts +23 -0
- package/src/device/ceilinglight.ts +23 -0
- package/src/device/colorbulb.ts +43 -0
- package/src/device/contact.ts +25 -0
- package/src/device/curtain.ts +22 -0
- package/src/device/hub.ts +94 -6
- package/src/device/humidifier.ts +24 -0
- package/src/device/lightstrip.ts +42 -0
- package/src/device/lock.ts +21 -0
- package/src/device/motion.ts +21 -0
- package/src/device/plug.ts +21 -0
- package/src/device/robotvacuumcleaner.ts +22 -0
package/src/device/plug.ts
CHANGED
|
@@ -88,6 +88,27 @@ export class Plug {
|
|
|
88
88
|
await this.refreshStatus();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
//regisiter webhook event handler
|
|
92
|
+
if (this.device.webhook) {
|
|
93
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} is listening webhook.`);
|
|
94
|
+
this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
|
|
95
|
+
try {
|
|
96
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
|
|
97
|
+
const { powerState } = context;
|
|
98
|
+
const { On } = this;
|
|
99
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
100
|
+
'(powerState) = ' +
|
|
101
|
+
`Webhook:(${powerState}), ` +
|
|
102
|
+
`current:(${On})`);
|
|
103
|
+
this.On = powerState === 'ON' ? true : false;
|
|
104
|
+
this.updateHomeKitCharacteristics();
|
|
105
|
+
} catch (e: any) {
|
|
106
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
107
|
+
+ `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
91
112
|
// Watch for Plug change events
|
|
92
113
|
// We put in a debounce of 100ms so we don't make duplicate calls
|
|
93
114
|
this.doPlugUpdate
|
|
@@ -120,6 +120,28 @@ export class RobotVacuumCleaner {
|
|
|
120
120
|
await this.refreshStatus();
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
+
//regisiter webhook event handler
|
|
124
|
+
if (this.device.webhook) {
|
|
125
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} is listening webhook.`);
|
|
126
|
+
this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
|
|
127
|
+
try {
|
|
128
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
|
|
129
|
+
const { onlineStatus, battery } = context;
|
|
130
|
+
const { On, BatteryLevel } = this;
|
|
131
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
132
|
+
'(onlineStatus, battery) = ' +
|
|
133
|
+
`Webhook:(${onlineStatus}, ${battery}), ` +
|
|
134
|
+
`current:(${On}, ${BatteryLevel})`);
|
|
135
|
+
this.On = onlineStatus === 'online' ? true : false;
|
|
136
|
+
this.BatteryLevel = battery;
|
|
137
|
+
this.updateHomeKitCharacteristics();
|
|
138
|
+
} catch (e: any) {
|
|
139
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
140
|
+
+ `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
123
145
|
// Watch for Plug change events
|
|
124
146
|
// We put in a debounce of 100ms so we don't make duplicate calls
|
|
125
147
|
this.doRobotVacuumCleanerUpdate
|