@switchbot/homebridge-switchbot 3.6.1-beta.1 → 3.6.1-beta.3
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 +11 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +35 -17
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -2
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +186 -396
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +35 -18
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +43 -19
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +35 -18
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +7 -5
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.js +1 -1
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +35 -18
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +35 -16
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +35 -16
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +35 -16
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +35 -16
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +36 -17
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +35 -16
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +35 -16
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +35 -16
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +36 -17
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +35 -16
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +35 -16
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -0
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +186 -228
- package/dist/irdevice/other.js.map +1 -1
- package/dist/platform.js +2 -2
- package/dist/platform.js.map +1 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +32 -17
- package/src/device/bot.ts +179 -406
- package/src/device/ceilinglight.ts +32 -19
- package/src/device/colorbulb.ts +41 -20
- package/src/device/contact.ts +32 -19
- package/src/device/curtain.ts +7 -6
- package/src/device/device.ts +1 -1
- package/src/device/fan.ts +32 -19
- package/src/device/hub.ts +32 -16
- package/src/device/humidifier.ts +32 -16
- package/src/device/iosensor.ts +32 -16
- package/src/device/lightstrip.ts +32 -16
- package/src/device/lock.ts +33 -17
- package/src/device/meter.ts +32 -16
- package/src/device/meterplus.ts +32 -16
- package/src/device/motion.ts +32 -16
- package/src/device/plug.ts +33 -17
- package/src/device/robotvacuumcleaner.ts +32 -16
- package/src/device/waterdetector.ts +32 -16
- package/src/irdevice/other.ts +214 -283
- package/src/platform.ts +2 -2
- package/src/utils.ts +11 -0
package/src/platform.ts
CHANGED
|
@@ -330,9 +330,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
330
330
|
// Set an event handler to monitor advertisement packets
|
|
331
331
|
switchbot.onadvertisement = async (ad: any) => {
|
|
332
332
|
try {
|
|
333
|
-
this.bleEventHandler[ad.
|
|
333
|
+
this.bleEventHandler[ad.address]?.(ad.serviceData);
|
|
334
334
|
} catch (e: any) {
|
|
335
|
-
this.errorLog(`Failed to handle BLE event. Error:${e}`);
|
|
335
|
+
await this.errorLog(`Failed to handle BLE event. Error:${e}`);
|
|
336
336
|
}
|
|
337
337
|
};
|
|
338
338
|
})();
|
package/src/utils.ts
CHANGED
|
@@ -115,6 +115,7 @@ export enum BlindTiltMappingMode {
|
|
|
115
115
|
UseTiltForDirection = 'use_tilt_for_direction',
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
import type { Nullable, CharacteristicValue } from 'homebridge';
|
|
118
119
|
import type { devicesConfig } from './settings.js';
|
|
119
120
|
import type { blindTilt, curtain, curtain3, device } from './types/devicelist.js';
|
|
120
121
|
|
|
@@ -130,6 +131,16 @@ export function sleep(ms: number): Promise<void> {
|
|
|
130
131
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
export function checkName(displayName: string, name: string, value: Nullable<CharacteristicValue>): string {
|
|
135
|
+
if (typeof value === 'string' && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u)).test(value)) {
|
|
136
|
+
return `WARNING: The accessory '${displayName}' has an invalid '${name}' characteristic ('${value}'). Please use only alphanumeric, space, and`
|
|
137
|
+
+ ' apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory '
|
|
138
|
+
+ 'from being added in the Home App or cause unresponsiveness.';
|
|
139
|
+
} else {
|
|
140
|
+
return 'false';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
133
144
|
/**
|
|
134
145
|
* Converts the value to celsius if the temperature units are in Fahrenheit
|
|
135
146
|
**/
|