优化远程开锁

This commit is contained in:
sky.min 2026-10-19 17:11:58 +08:00
parent ab18b60a3c
commit 261c166ec3
3 changed files with 23 additions and 3 deletions

View File

@ -133,8 +133,8 @@ class S {
? 'Make sure it is safe to unlock the door.'
: '请确认现场安全后再远程开锁。';
static String get remoteUnlockUnavailable => isEn
? 'The lock service reports remote unlock as unsupported or disabled. Enable remote unlock for this lock, then refresh its details and try again.'
: '云端锁详情显示不支持或未开启远程开锁。请在锁端/管理端开启该锁的远程开锁权限,刷新锁详情后重试。';
? 'Remote unlock could not be enabled on this lock. Check the lock Bluetooth connection and permissions, then try again.'
: '远程开锁未能在当前锁上开启,请检查锁的蓝牙连接和操作权限后重试。';
static String get remoteUnlockNeedsGateway => isEn
? 'This lock is not connected to a gateway for remote unlock.'
: '该锁未绑定网关,无法使用网关远程开锁。';

View File

@ -888,7 +888,7 @@ class _VideoTalkTabState extends State<VideoTalkTab> {
if (token.isEmpty) {
throw StateError(S.remoteUnlockNeedsLogin);
}
if (fresh.isOnline != true) {
if (enabledLock.isOnline != true) {
throw StateError(S.remoteUnlockNeedsOnline);
}
await StarCloudClient.instance.device.remoteOpenLock(

View File

@ -83,6 +83,26 @@ class _WifiConfigTabState extends State<WifiConfigTab> {
wifiConfiguredLockId.value = lock.lockId;
_log_(S.logWifiConfigCompleted);
try {
final remoteUnlockReply = await StarCloudClient.instance.lockSetting
.setRemoteUnlockByContext(ctx, enabled: true);
if (remoteUnlockReply.status == 0) {
lock.lockFeature['remoteUnlock'] = 1;
lock.lockSetting.remoteUnlock = 1;
pairedLock.value = null;
pairedLock.value = lock;
_log_(S.isEn
? 'Remote unlock enabled by default.'
: '远程开锁已默认开启。');
} else {
final status = remoteUnlockReply.status;
_log_('Remote unlock default enable failed: '
'status=$status.');
}
} catch (e) {
_log_('Remote unlock default enable failed: $e');
}
try {
final gatewayStatus =
await StarCloudClient.instance.wifi.getGatewayStatus(