Time Management
Overview
Master Lock Connected Locks are electronic locks that connect to a phone via Bluetooth. They do not have WiFi, so they cannot synchronize their internal clocks with an NTP server. Instead, they rely on a time check / sync that is performed when the SDK communicates with the lock via Bluetooth.
Why Time Management Matters
The time on a lock can be incorrect for two main reasons:
Clock Drift: Electronic clocks drift over time and typically use an NTP server to ensure they stay in sync. Since the locks cannot connect to an NTP server directly, the SDK is used to check and correct the time.
Power Interruption: If a battery dies or power is disturbed, the clock will stop. When power is restored, the clock will resume from where it left off.
Time synchronization is critical for all time based lock features:
Time-Based Access: If an access profile has time restrictions (
ProfileActivation
,ProfileExpiration
, or daily time windows), incorrect time will prevent access.Temporary Codes: Temporary codes rely on synchronized time for proper generation and expiration.
Syncing the Time
When a successful Bluetooth connection is established, the SDK will automatically perform a time check / sync.
This requires the
WriteTime
profile permission in order for the time to be adjusted. If this permission is not included, the time correction will not occur!
Correcting the time requires that the ProfileActivation
and ProfileExpiration
in the access profile be valid for the time that the lock currently thinks it is. If it is not, then the phone will fail to connect to the lock and the time will not be corrected. Therefore, it may be necessary to set the ProfileActivation
to an earlier time, particularly if the battery died. Tracking a "last encountered" time and using that as the ProfileActivation
can help ensure that the start time of the profile is always earlier than the current time on the lock.
Requiring Trusted Time
For additional configuration for the time syncing, see the requiresTrustedTime
property for iOS and Android. This setting ensures that the time sent to the lock is validated against the server's time to ensure that time tampering on the phone has not occurred.
If a lock is in a remote area without reception, this setting could block the time correction since the time cannot be validated. In a situation like this, requiresTrustedTime
could remain false for trusted users of the lock.
Best Practices
- Include
WriteTime
permission in access profiles to ensure automatic time correction. - Enable
requiresTrustedTime
when possible. - Regular connections help maintain time accuracy. Encourage users to connect periodically via Bluetooth.