@@ -44,7 +44,7 @@ class LockState:
44
44
opened : bool | None = None
45
45
sensor_battery : int | None = None
46
46
47
- auto_lock_seconds : int | None = None
47
+ auto_lock_seconds : int = 0
48
48
auto_lock : bool | None = None
49
49
passage_mode_config : PassageModeConfig | None = None
50
50
@@ -74,9 +74,10 @@ def auto_lock_delay(self, current_date: datetime) -> int | None:
74
74
75
75
if self .passage_mode_active (current_date ):
76
76
return None
77
-
77
+
78
78
return self .auto_lock_seconds
79
79
80
+
80
81
@contextmanager
81
82
def lock_action (controller : LockUpdateCoordinator ):
82
83
"""Wrap a lock action so that in-progress state is managed correctly."""
@@ -150,21 +151,26 @@ async def _async_update_data(self) -> LockState:
150
151
pass
151
152
152
153
new_data .auto_lock_seconds = details .autoLockTime
153
- new_data .auto_lock = True if details .autoLockTime > 0 else False
154
+ if details .autoLockSeconds > 0 :
155
+ new_data .auto_lock = True
156
+ else :
157
+ new_data .auto_lock = False
154
158
new_data .lock_sound = details .lockSound == 1
155
159
156
160
new_data .passage_mode_config = await self .api .get_lock_passage_mode_config (
157
161
self .lock_id
158
162
)
159
-
160
- if Features .door_sensor in Features .from_feature_value (details .featureValue ):
163
+
164
+ if Features .door_sensor in Features .from_feature_value (
165
+ details .featureValue
166
+ ):
161
167
sensor = await self .api .get_sensor (self .lock_id )
162
168
if sensor .battery_level is not None :
163
169
new_data .sensor_battery = sensor .battery_level
164
170
new_data .sensor = True
165
171
else :
166
172
new_data .sensor = False
167
-
173
+
168
174
return new_data
169
175
except Exception as err :
170
176
raise UpdateFailed (err ) from err
0 commit comments