diff --git a/docs/_media/smartlock_t85l0_small.jpg b/docs/_media/smartlock_t85l0_small.jpg new file mode 100644 index 0000000..9719e47 Binary files /dev/null and b/docs/_media/smartlock_t85l0_small.jpg differ diff --git a/docs/supported_devices.md b/docs/supported_devices.md index 8967ea7..db49cbe 100644 --- a/docs/supported_devices.md +++ b/docs/supported_devices.md @@ -64,6 +64,7 @@ | ![T8503 image](_media/smartlock_t8503_small.jpg) | Retrofit Smart Lock E110 (T8503; Smart Lock R10) | :heavy_check_mark: | Firmware: 1.0.7.7 (20230622) | | ![T8504 image](_media/smartlock_t8504_small.jpg) | Retrofit Smart Lock E130 (T8504; Smart Lock R20) | :heavy_exclamation_mark: | | | ![T8510P image](_media/smartlock_t8510P_t8520P_small.jpg) | Smart Lock S230 (T8510P) | :heavy_check_mark: | Firmware: 1.1.0.0 (20240123) | +| ![T85L0 image](_media/smartlock_t85l0_small.jpg) | Smart Lock C33 (T85L0) | :heavy_check_mark: | Firmware: 1.0.7.1 (20240801) | | ![T8520P image](_media/smartlock_t8510P_t8520P_small.jpg) | Smart Lock S231 (T8520P) | :heavy_check_mark: | Firmware: ? (20240818) | | ![T8960 image](_media/keypad_small.jpg) | Keypad (T8960) | :heavy_check_mark: | | | ![T7400 image](_media/smartsafe_s10_t7400_small.jpg) | Smart Safe S10 (T7400) | :heavy_check_mark: | Firmware: 1.0.3.4 (20221029) | diff --git a/src/eufysecurity.ts b/src/eufysecurity.ts index 86649c7..ce156c3 100644 --- a/src/eufysecurity.ts +++ b/src/eufysecurity.ts @@ -1883,9 +1883,9 @@ export class EufySecurity extends TypedEmitter { } } this.getStationDevice(station.getSerial(), result.channel).then((device: Device) => { - if ((result.customData !== undefined && result.customData.property !== undefined && !device.isLockWifiR10() && !device.isLockWifiR20() && !device.isSmartSafe() && !device.isLockWifiT8506() && !device.isLockWifiT8502() && !device.isLockWifiT8510P() && !device.isLockWifiT8520P()) || + if ((result.customData !== undefined && result.customData.property !== undefined && !device.isLockWifiR10() && !device.isLockWifiR20() && !device.isSmartSafe() && !device.isLockWifiT8506() && !device.isLockWifiT8502() && !device.isLockWifiT8510P() && !device.isLockWifiT8520P() && !device.isLockWifiT85L0()) || (result.customData !== undefined && result.customData.property !== undefined && device.isSmartSafe() && result.command_type !== CommandType.CMD_SMARTSAFE_SETTINGS) || - (result.customData !== undefined && result.customData.property !== undefined && (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) && result.command_type !== CommandType.CMD_DOORLOCK_SET_PUSH_MODE)) { + (result.customData !== undefined && result.customData.property !== undefined && (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) && result.command_type !== CommandType.CMD_DOORLOCK_SET_PUSH_MODE)) { if (device.hasProperty(result.customData.property.name)) { const metadata = device.getPropertyMetadata(result.customData.property.name); if (typeof result.customData.property.value !== "object" || metadata.type === "object") { @@ -2484,7 +2484,7 @@ export class EufySecurity extends TypedEmitter { let found = false; for (const user of users) { if (user.user_name === username) { - if ((device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) && user.password_list.length > 0) { + if ((device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) && user.password_list.length > 0) { for (const entry of user.password_list) { if (entry.password_type === UserPasswordType.PIN) { let schedule = entry.schedule; diff --git a/src/http/device.ts b/src/http/device.ts index e1ba1c6..ee28a95 100644 --- a/src/http/device.ts +++ b/src/http/device.ts @@ -6,7 +6,7 @@ import { DeviceListResponse, Voice, GarageDoorSensorsProperty, FloodlightDetecti import { ParameterHelper } from "./parameter"; import { DeviceEvents, PropertyValue, PropertyValues, PropertyMetadataAny, IndexedProperty, RawValues, PropertyMetadataNumeric, PropertyMetadataBoolean, PropertyMetadataString, Schedule, Voices, PropertyMetadataObject, DeviceConfig } from "./interfaces"; import { CommandType, ESLAnkerBleConstant, TrackerCommandType } from "../p2p/types"; -import { calculateCellularSignalLevel, calculateWifiSignalLevel, getAbsoluteFilePath, getDistances, getImagePath, getLockEventType, hexDate, hexTime, hexWeek, isFloodlightT8425NotitficationEnabled, isHB3DetectionModeEnabled, isIndoorNotitficationEnabled, isIndoorS350DetectionModeEnabled, isPrioritySourceType, isSmartLockNotification, isT8170DetectionModeEnabled, loadEventImage, WritePayload } from "./utils"; +import { calculateCellularSignalLevel, calculateWifiSignalLevel, getAbsoluteFilePath, getDistances, getImagePath, getLockEventType, hexDate, hexTime, hexWeek, isFloodlightT8425NotificationEnabled, isHB3DetectionModeEnabled, isIndoorNotificationEnabled, isIndoorS350DetectionModeEnabled, isPrioritySourceType, isSmartLockNotification, isT8170DetectionModeEnabled, loadEventImage, WritePayload } from "./utils"; import { DecimalToRGBColor, eslTimestamp, getCurrentTimeInSeconds, isCharging } from "../p2p/utils"; import { CusPushEvent, DoorbellPushEvent, LockPushEvent, IndoorPushEvent, SmartSafeEvent, HB3PairedDevicePushEvent, GarageDoorPushEvent, SmartDropOpen, SmartDropOpenedBy, SmartDropPushEvent } from "../push/types"; import { PushMessage, SmartSafeEventValueDetail } from "../push/models"; @@ -643,7 +643,7 @@ export class Device extends TypedEmitter { ) && this.isIndoorPanAndTiltCameraS350()) { const booleanProperty = property as PropertyMetadataBoolean; try { - return isIndoorNotitficationEnabled(Number.parseInt(value), property.name === PropertyName.DeviceNotificationAllOtherMotion ? IndoorS350NotificationTypes.ALL_OTHER_MOTION : property.name === PropertyName.DeviceNotificationPerson ? IndoorS350NotificationTypes.HUMAN : property.name === PropertyName.DeviceNotificationPet ? IndoorS350NotificationTypes.PET : property.name === PropertyName.DeviceNotificationCrying ? IndoorS350NotificationTypes.CRYING : IndoorS350NotificationTypes.ALL_SOUND); + return isIndoorNotificationEnabled(Number.parseInt(value), property.name === PropertyName.DeviceNotificationAllOtherMotion ? IndoorS350NotificationTypes.ALL_OTHER_MOTION : property.name === PropertyName.DeviceNotificationPerson ? IndoorS350NotificationTypes.HUMAN : property.name === PropertyName.DeviceNotificationPet ? IndoorS350NotificationTypes.PET : property.name === PropertyName.DeviceNotificationCrying ? IndoorS350NotificationTypes.CRYING : IndoorS350NotificationTypes.ALL_SOUND); } catch (err) { const error = ensureError(err); rootHTTPLogger.error("Device convert raw property - IndoorPanAndTiltCameraS350 notification Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value }); @@ -657,7 +657,7 @@ export class Device extends TypedEmitter { ) && this.isFloodLightT8425()) { const booleanProperty = property as PropertyMetadataBoolean; try { - return isFloodlightT8425NotitficationEnabled(Number.parseInt(value), property.name === PropertyName.DeviceNotificationAllOtherMotion ? FloodlightT8425NotificationTypes.ALL_OTHER_MOTION : property.name === PropertyName.DeviceNotificationPerson ? FloodlightT8425NotificationTypes.HUMAN : property.name === PropertyName.DeviceNotificationPet ? FloodlightT8425NotificationTypes.PET : FloodlightT8425NotificationTypes.VEHICLE); + return isFloodlightT8425NotificationEnabled(Number.parseInt(value), property.name === PropertyName.DeviceNotificationAllOtherMotion ? FloodlightT8425NotificationTypes.ALL_OTHER_MOTION : property.name === PropertyName.DeviceNotificationPerson ? FloodlightT8425NotificationTypes.HUMAN : property.name === PropertyName.DeviceNotificationPet ? FloodlightT8425NotificationTypes.PET : FloodlightT8425NotificationTypes.VEHICLE); } catch (err) { const error = ensureError(err); rootHTTPLogger.error("Device convert raw property - FloodLightT8425 notification Error", { error: getError(error), deviceSN: this.getSerial(), property: property, value: value }); @@ -1059,6 +1059,7 @@ export class Device extends TypedEmitter { type == DeviceType.LOCK_85A3 || type == DeviceType.LOCK_8506 || type == DeviceType.LOCK_8502 || + type == DeviceType.LOCK_85L0 || type == DeviceType.SMART_SAFE_7400 || type == DeviceType.SMART_SAFE_7401 || type == DeviceType.SMART_SAFE_7402 || @@ -1202,7 +1203,8 @@ export class Device extends TypedEmitter { Device.isLockWifiR20(type) || Device.isLockWifiVideo(type) || Device.isLockWifiT8506(type) || - Device.isLockWifiT8502(type); + Device.isLockWifiT8502(type) || + Device.isLockWifiT85L0(type); } static isLockKeypad(type: number): boolean { @@ -1265,6 +1267,10 @@ export class Device extends TypedEmitter { return false; } + static isLockWifiT85L0(type: number): boolean { + return DeviceType.LOCK_85L0 == type; + } + static isBatteryDoorbell1(type: number): boolean { return DeviceType.BATTERY_DOORBELL == type; } @@ -1469,7 +1475,8 @@ export class Device extends TypedEmitter { sn.startsWith("T8502") || sn.startsWith("T8504") || sn.startsWith("T8506") || - sn.startsWith("T8530"); + sn.startsWith("T8530") || + sn.startsWith("T85L0"); } static isGarageCameraBySn(sn: string): boolean { @@ -1624,6 +1631,10 @@ export class Device extends TypedEmitter { return Device.isLockWifiT8520P(this.rawDevice.device_type, this.rawDevice.device_sn); } + public isLockWifiT85L0(): boolean { + return Device.isLockWifiT85L0(this.rawDevice.device_type); + } + public isBatteryDoorbell1(): boolean { return Device.isBatteryDoorbell1(this.rawDevice.device_type); } @@ -2195,7 +2206,7 @@ export class Camera extends Device { this.updateProperty(PropertyName.DeviceStrangerPersonDetected, false); this.eventTimeouts.delete(DeviceEvent.StrangerPersonDetected); }, eventDurationSeconds * 1000)); - + if (this.config.simultaneousDetections) { this.updateProperty(PropertyName.DevicePersonDetected, true); this.clearEventTimeout(DeviceEvent.PersonDetected); diff --git a/src/http/station.ts b/src/http/station.ts index 060fbc4..7b9dc2f 100644 --- a/src/http/station.ts +++ b/src/http/station.ts @@ -109,7 +109,7 @@ export class Station extends TypedEmitter { static async getInstance(api: HTTPApi, stationData: StationListResponse, ipAddress?: string, listeningPort?: number, enableEmbeddedPKCS1Support?: boolean): Promise { let publicKey: string | undefined; - if (Device.isLock(stationData.device_type) && !Device.isLockWifiT8506(stationData.device_type) && !Device.isLockWifiT8502(stationData.device_type) && !Device.isLockWifiT8510P(stationData.device_type, stationData.station_sn) && !Device.isLockWifiT8520P(stationData.device_type, stationData.station_sn)) { + if (Device.isLock(stationData.device_type) && !Device.isLockWifiT8506(stationData.device_type) && !Device.isLockWifiT8502(stationData.device_type) && !Device.isLockWifiT8510P(stationData.device_type, stationData.station_sn) && !Device.isLockWifiT8520P(stationData.device_type, stationData.station_sn) && !Device.isLockWifiT85L0(stationData.device_type)) { publicKey = await api.getPublicKey(stationData.station_sn, PublicKeyType.LOCK); } return new Station(api, stationData, ipAddress, listeningPort, publicKey, enableEmbeddedPKCS1Support); @@ -5316,7 +5316,7 @@ export class Station extends TypedEmitter { this._sendLockV12P2PCommand(command, { property: propertyData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -6351,7 +6351,7 @@ export class Station extends TypedEmitter { command: commandData }); rootHTTPLogger.debug("Station calibrate lock - Calibrate lock...", { station: this.getSerial(), device: device.getSerial(), admin_user_id: this.rawStation.member.admin_user_id }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -7969,7 +7969,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceScramblePasscode, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceScramblePasscode, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceScramblePasscode, value); } else if (device.isSmartSafe()) { this.setSmartSafeParams(device, PropertyName.DeviceScramblePasscode, value); @@ -7994,7 +7994,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceWrongTryProtection, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceWrongTryProtection, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceWrongTryProtection, value); } else if (device.isSmartSafe()) { this.setSmartSafeParams(device, PropertyName.DeviceWrongTryProtection, value); @@ -8019,7 +8019,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceWrongTryAttempts, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceWrongTryAttempts, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceWrongTryAttempts, value); } else if (device.isSmartSafe()) { this.setSmartSafeParams(device, PropertyName.DeviceWrongTryAttempts, value); @@ -8044,7 +8044,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceWrongTryLockdownTime, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceWrongTryLockdownTime, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceWrongTryLockdownTime, value); } else if (device.isSmartSafe()) { this.setSmartSafeParams(device, PropertyName.DeviceWrongTryLockdownTime, value); @@ -8484,7 +8484,7 @@ export class Station extends TypedEmitter { }, { command: commandData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -8576,7 +8576,7 @@ export class Station extends TypedEmitter { }, { command: commandData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -8676,7 +8676,7 @@ export class Station extends TypedEmitter { }, { command: commandData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -8773,7 +8773,7 @@ export class Station extends TypedEmitter { }, { command: commandData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -8921,7 +8921,7 @@ export class Station extends TypedEmitter { validValue(propertyMetadata, value); rootHTTPLogger.debug(`Station set smart lock settings - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), property: property, value: value }); - if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { let payload: Buffer; switch (property) { case PropertyName.DeviceWrongTryProtection: @@ -9055,7 +9055,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceAutoLock, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceAutoLock, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceAutoLock, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9078,7 +9078,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceAutoLockSchedule, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceAutoLockSchedule, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceAutoLockSchedule, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9101,7 +9101,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceAutoLockScheduleStartTime, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceAutoLockScheduleStartTime, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceAutoLockScheduleStartTime, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9124,7 +9124,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceAutoLockScheduleEndTime, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceAutoLockScheduleEndTime, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceAutoLockScheduleEndTime, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9147,7 +9147,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceAutoLockTimer, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceAutoLockTimer, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceAutoLockTimer, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9170,7 +9170,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceOneTouchLocking, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceOneTouchLocking, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceOneTouchLocking, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9193,7 +9193,7 @@ export class Station extends TypedEmitter { this.setAdvancedLockParams(device, PropertyName.DeviceSound, value); } else if (device.isLockWifiR10() || device.isLockWifiR20()) { this.setLockV12Params(device, PropertyName.DeviceSound, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { this.setSmartLockParams(device, PropertyName.DeviceSound, value); } else { throw new NotSupportedError("This functionality is not implemented or supported by this device", { context: { device: device.getSerial(), station: this.getSerial(), propertyName: propertyData.name, propertyValue: propertyData.value } }); @@ -9225,7 +9225,7 @@ export class Station extends TypedEmitter { }, { property: propertyData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiR10() || device.isLockWifiR20()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0() || device.isLockWifiR10() || device.isLockWifiR20()) { let oldvalue = 0; const rawproperty = device.getRawProperty(CommandType.CMD_DOORLOCK_SET_PUSH_MODE); if (rawproperty !== undefined) { @@ -9272,7 +9272,7 @@ export class Station extends TypedEmitter { rootHTTPLogger.debug(`Station set notification locked - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value }); if (device.isLockWifi() || device.isLockWifiNoFinger() || device.isLockWifiVideo()) { this.setAdvancedLockParams(device, PropertyName.DeviceNotificationLocked, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiR10() || device.isLockWifiR20()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0() || device.isLockWifiR10() || device.isLockWifiR20()) { let oldvalue = 0; const rawproperty = device.getRawProperty(CommandType.CMD_DOORLOCK_SET_PUSH_MODE); if (rawproperty !== undefined) { @@ -9319,7 +9319,7 @@ export class Station extends TypedEmitter { rootHTTPLogger.debug(`Station set notification unlocked - sending command`, { stationSN: this.getSerial(), deviceSN: device.getSerial(), value: value }); if (device.isLockWifi() || device.isLockWifiNoFinger() || device.isLockWifiVideo()) { this.setAdvancedLockParams(device, PropertyName.DeviceNotificationUnlocked, value); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiR10() || device.isLockWifiR20()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0() || device.isLockWifiR10() || device.isLockWifiR20()) { let oldvalue = 0; const rawproperty = device.getRawProperty(CommandType.CMD_DOORLOCK_SET_PUSH_MODE); if (rawproperty !== undefined) { @@ -9448,7 +9448,7 @@ export class Station extends TypedEmitter { }, { command: commandData }); - } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P()) { + } else if (device.isLockWifiT8506() || device.isLockWifiT8502() || device.isLockWifiT8510P() || device.isLockWifiT8520P() || device.isLockWifiT85L0()) { const command = getSmartLockP2PCommand( this.rawStation.station_sn, this.rawStation.member.admin_user_id, @@ -11000,7 +11000,7 @@ export class Station extends TypedEmitter { public getLockParameters(): void { //TODO: Implement support for other Locks - if (Device.isLockWifiT8506(this.getDeviceType()) || Device.isLockWifiT8502(this.getDeviceType()) || Device.isLockWifiT8510P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT8520P(this.getDeviceType(), this.getSerial())) { + if (Device.isLockWifiT8506(this.getDeviceType()) || Device.isLockWifiT8502(this.getDeviceType()) || Device.isLockWifiT8510P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT8520P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT85L0(this.getDeviceType())) { rootHTTPLogger.debug(`Station smart lock send get lock parameters command`, { stationSN: this.getSerial() }); const command = getSmartLockP2PCommand( this.rawStation.station_sn, @@ -11028,7 +11028,7 @@ export class Station extends TypedEmitter { public getLockStatus(): void { //TODO: Implement support for other Locks - if (Device.isLockWifiT8506(this.getDeviceType()) || Device.isLockWifiT8502(this.getDeviceType()) || Device.isLockWifiT8510P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT8520P(this.getDeviceType(), this.getSerial())) { + if (Device.isLockWifiT8506(this.getDeviceType()) || Device.isLockWifiT8502(this.getDeviceType()) || Device.isLockWifiT8510P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT8520P(this.getDeviceType(), this.getSerial()) || Device.isLockWifiT85L0(this.getDeviceType())) { rootHTTPLogger.debug(`Station smart lock send get lock status command`, { stationSN: this.getSerial() }); const command = getSmartLockP2PCommand( this.rawStation.station_sn, diff --git a/src/http/types.ts b/src/http/types.ts index ee6a321..b62a39d 100644 --- a/src/http/types.ts +++ b/src/http/types.ts @@ -74,6 +74,7 @@ export enum DeviceType { SMART_TRACK_CARD = 159, //T87B2 LOCK_8502 = 180, LOCK_8506 = 184, + LOCK_85L0 = 201, WALL_LIGHT_CAM_81A0 = 10005, } @@ -1006,6 +1007,7 @@ export const GenericTypeProperty: PropertyMetadataNumeric = { 159: "SmartTrack Card (T87B2)", 180: "Smart Lock C210 (T8502)", 184: "Smart Lock C220 (T8506)", + 201: "Smart Lock C33 (T85L0)", 10005: "Solar Wall Light Cam S120 (T81A0)", }, } @@ -7132,6 +7134,29 @@ export const DeviceProperties: Properties = { [PropertyName.DeviceLockEventOrigin]: DeviceLockEventOriginProperty, [PropertyName.DevicePersonName]: DevicePersonNameProperty, }, + [DeviceType.LOCK_85L0]: { + ...GenericDeviceProperties, + [PropertyName.DeviceBattery]: DeviceBatteryLockProperty, + [PropertyName.DeviceLocked]: DeviceLockedProperty, + [PropertyName.DeviceLockStatus]: DeviceAdvancedLockStatusProperty, + [PropertyName.DeviceAutoLock]: DeviceAutoLockProperty, + [PropertyName.DeviceAutoLockTimer]: DeviceAutoLockTimerProperty, + [PropertyName.DeviceAutoLockSchedule]: DeviceAutoLockScheduleProperty, + [PropertyName.DeviceAutoLockScheduleStartTime]: DeviceAutoLockScheduleStartTimeProperty, + [PropertyName.DeviceAutoLockScheduleEndTime]: DeviceAutoLockScheduleEndTimeProperty, + [PropertyName.DeviceOneTouchLocking]: DeviceOneTouchLockingProperty, + [PropertyName.DeviceWrongTryProtection]: DeviceWrongTryProtectionProperty, + [PropertyName.DeviceWrongTryAttempts]: DeviceWrongTryAttemptsProperty, + [PropertyName.DeviceWrongTryLockdownTime]: DeviceWrongTryLockdownTimeProperty, + [PropertyName.DeviceScramblePasscode]: DeviceScramblePasscodeProperty, + [PropertyName.DeviceSound]: DeviceSoundProperty, + [PropertyName.DeviceNotification]: DeviceNotificationSmartLockProperty, + [PropertyName.DeviceNotificationUnlocked]: DeviceNotificationUnlockedSmartLockProperty, + [PropertyName.DeviceNotificationLocked]: DeviceNotificationLockedSmartLockProperty, + [PropertyName.DeviceLowBatteryAlert]: DeviceLowBatteryAlertProperty, + [PropertyName.DeviceLockEventOrigin]: DeviceLockEventOriginProperty, + [PropertyName.DevicePersonName]: DevicePersonNameProperty, + }, [DeviceType.LOCK_8502]: { ...GenericDeviceProperties, [PropertyName.DeviceBattery]: DeviceBatteryLockProperty, @@ -8625,6 +8650,9 @@ export const StationProperties: Properties = { [DeviceType.LOCK_8506]: { ...BaseStationProperties, }, + [DeviceType.LOCK_85L0]: { + ...BaseStationProperties, + }, [DeviceType.LOCK_8502]: { ...BaseStationProperties, }, @@ -9168,6 +9196,14 @@ export const DeviceCommands: Commands = { CommandName.DeviceUpdateUserSchedule, CommandName.DeviceUpdateUsername, ], + [DeviceType.LOCK_85L0]: [ + CommandName.DeviceLockCalibration, + CommandName.DeviceAddUser, + CommandName.DeviceDeleteUser, + CommandName.DeviceUpdateUserPasscode, + CommandName.DeviceUpdateUserSchedule, + CommandName.DeviceUpdateUsername, + ], [DeviceType.LOCK_8502]: [ CommandName.DeviceLockCalibration, CommandName.DeviceAddUser, diff --git a/src/http/utils.ts b/src/http/utils.ts index e8f29b5..6cff811 100644 --- a/src/http/utils.ts +++ b/src/http/utils.ts @@ -683,7 +683,7 @@ export const getIndoorS350DetectionMode = function(value: number, type: IndoorS3 return result; } -export const isIndoorNotitficationEnabled = function(value: number, type: IndoorS350NotificationTypes): boolean { +export const isIndoorNotificationEnabled = function(value: number, type: IndoorS350NotificationTypes): boolean { return (type & value) == type; } @@ -697,7 +697,7 @@ export const getIndoorNotification = function(value: number, type: IndoorS350Not return result; } -export const isFloodlightT8425NotitficationEnabled = function(value: number, type: FloodlightT8425NotificationTypes): boolean { +export const isFloodlightT8425NotificationEnabled = function(value: number, type: FloodlightT8425NotificationTypes): boolean { return (type & value) == type; } diff --git a/src/p2p/session.ts b/src/p2p/session.ts index c2c65d5..eaf7afe 100644 --- a/src/p2p/session.ts +++ b/src/p2p/session.ts @@ -1768,10 +1768,10 @@ export class P2PClientProtocol extends TypedEmitter { if (payload.lock_cmd > 0) { if (Device.isLockWifiR10(this.rawStation.devices[0]?.device_type) || Device.isLockWifiR20(this.rawStation.devices[0]?.device_type)) { this.emit("sequence error", message.channel, ESLCommand[ESLBleCommand[payload.lock_cmd] as unknown as number] as unknown as number, payload.seq_num, payload.dev_sn); - } else if (Device.isLockWifiT8506(this.rawStation.devices[0]?.device_type) || Device.isLockWifiT8502(this.rawStation.devices[0]?.device_type) || Device.isLockWifiT8510P(this.rawStation.devices[0]?.device_type, this.rawStation.devices[0]?.device_sn) || Device.isLockWifiT8520P(this.rawStation.devices[0]?.device_type, this.rawStation.devices[0]?.device_sn)) { + } else if (Device.isLockWifiT8506(this.rawStation.devices[0]?.device_type) || Device.isLockWifiT8502(this.rawStation.devices[0]?.device_type) || Device.isLockWifiT8510P(this.rawStation.devices[0]?.device_type, this.rawStation.devices[0]?.device_sn) || Device.isLockWifiT8520P(this.rawStation.devices[0]?.device_type, this.rawStation.devices[0]?.device_sn) || Device.isLockWifiT85L0(this.rawStation.devices[0]?.device_type)) { this.emit("sequence error", message.channel, SmartLockCommand[payload.bus_type! == SmartLockFunctionType.TYPE_2 ? SmartLockBleCommandFunctionType2[payload.lock_cmd] as unknown as number : SmartLockBleCommandFunctionType1[payload.lock_cmd] as unknown as number] as unknown as number, payload.seq_num, payload.dev_sn); } else { - rootP2PLogger.debug(`Handle DATA ${P2PDataType[message.dataType]} - CMD_NOTIFY_PAYLOAD - Lock sequence number - Unknwon device`, { stationSN: this.rawStation.station_sn, oldSequenceNumber: this.lockSeqNumber, newSequenceNumber: this.lockSeqNumber + 1, payload: payload }); + rootP2PLogger.debug(`Handle DATA ${P2PDataType[message.dataType]} - CMD_NOTIFY_PAYLOAD - Lock sequence number - Unknown device`, { stationSN: this.rawStation.station_sn, oldSequenceNumber: this.lockSeqNumber, newSequenceNumber: this.lockSeqNumber + 1, payload: payload }); } } }