Time-bound access codes automatically activate and deactivate at specified times. They require timezone configuration.
Prerequisites: 1. Device timezone must be configured (see Configuring
Ultraloq Device Timezones) 2.
Device must not have the ultraloq_time_zone_unknown warning
import { Seam } from 'seam'const seam = new Seam()// Define time range in UTCconst startsAt = new Date(Date.now() + 24 * 60 * 60 * 1000) // Tomorrowconst endsAt = new Date(startsAt.getTime() + 2 * 24 * 60 * 60 * 1000) // +2 days// Create time-bound access codeconst accessCode = await seam.accessCodes.create({ device_id: 'your-device-id', name: 'Weekend Guest', code: '5678', // Optional: auto-generated if omitted starts_at: startsAt.toISOString(), ends_at: endsAt.toISOString(),})console.log(`Access code created: ${accessCode.code}`)console.log(`Active from ${accessCode.starts_at} to ${accessCode.ends_at}`)console.log(`Status: ${accessCode.status}`)
# Invalid codes"123" # Too short (< 4 digits)"123456789" # Too long (> 8 digits)"abcd" # Non-numeric characters"12-34" # Special characters not allowed
import { Seam } from 'seam'const seam = new Seam()const accessCode = await seam.accessCodes.get({ access_code_id: 'your-access-code-id',})// Check for disabled warningconst isDisabled = accessCode.warnings.some( (w) => w.warning_code === 'ultraloq_access_code_disabled',)if (isDisabled) { console.log('⚠️ Code is disabled on Ultraloq device') console.log('User must re-enable it in the Ultraloq mobile app')}
Resolution: The user must re-enable the code in the Ultraloq mobile app.
Seam cannot programmatically re-enable disabled codes. Once re-enabled in the
app, Seam will automatically detect the change and clear the warning.
2. Check Timezone Before Creating Time-Bound Codes
Always verify timezone configuration before attempting to create time-bound codes:
device = seam.devices.get(device_id="your-device-id")if not any(w.warning_code == "ultraloq_time_zone_unknown" for w in device.warnings): # Safe to create time-bound codes seam.access_codes.create(device_id=device.device_id, starts_at="...", ends_at="...")else: # Configure timezone first print("Configure timezone before creating time-bound codes")
Regularly check access code warnings to detect disabled codes:
access_codes = seam.access_codes.list(device_id="your-device-id")disabled_codes = [ code for code in access_codes if any(w.warning_code == "ultraloq_access_code_disabled" for w in code.warnings)]if disabled_codes: print(f"⚠️ {len(disabled_codes)} codes are disabled") # Notify user to re-enable in Ultraloq app