Skip to content

Commit 963682a

Browse files
committed
1 parent 2217a2d commit 963682a

File tree

3 files changed

+648
-114
lines changed

3 files changed

+648
-114
lines changed

src/lib/seam/connect/models/access-codes/managed-access-code.ts

+80-19
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ const august_device_slots_full = common_access_code_error
137137
})
138138
.describe('All access code slots on the device are full.')
139139

140+
const august_lock_temporarily_offline_error = common_access_code_error
141+
.extend({
142+
error_code: z
143+
.literal('august_lock_temporarily_offline')
144+
.describe(error_code_description),
145+
})
146+
.describe('August lock is temporarily offline.')
147+
140148
const august_lock_missing_keypad = common_access_code_error
141149
.extend({
142150
error_code: z
@@ -145,10 +153,10 @@ const august_lock_missing_keypad = common_access_code_error
145153
})
146154
.describe('August lock is missing a keypad.')
147155

148-
const salto_site_user_not_subscribed = common_access_code_error
156+
const salto_ks_user_not_subscribed = common_access_code_error
149157
.extend({
150158
error_code: z
151-
.literal('salto_site_user_not_subscribed')
159+
.literal('salto_ks_user_not_subscribed')
152160
.describe(error_code_description),
153161
})
154162
.describe('Salto site user is not subscribed.')
@@ -169,9 +177,42 @@ const hubitat_no_free_positions_available = common_access_code_error
169177
})
170178
.describe('No free positions available on the device.')
171179

180+
const smartthings_no_free_slots_available = common_access_code_error
181+
.extend({
182+
error_code: z
183+
.literal('smartthings_no_free_slots_available')
184+
.describe(error_code_description),
185+
})
186+
.describe('No free slots available on the device.')
187+
188+
const wyze_duplicate_code_name = common_access_code_error
189+
.extend({
190+
error_code: z
191+
.literal('wyze_duplicate_code_name')
192+
.describe(error_code_description),
193+
})
194+
.describe('Duplicate access code name detected.')
195+
196+
const wyze_potential_duplicate_code = common_access_code_error
197+
.extend({
198+
error_code: z
199+
.literal('wyze_potential_duplicate_code')
200+
.describe(error_code_description),
201+
})
202+
.describe('Potential duplicate access code detected.')
203+
204+
const dormakaba_oracode_no_valid_user_level = common_access_code_error
205+
.extend({
206+
error_code: z
207+
.literal('dormakaba_oracode_no_valid_user_level')
208+
.describe(error_code_description),
209+
})
210+
.describe('No valid user level for Oracode.')
211+
172212
const access_code_error = z.discriminatedUnion('error_code', [
173213
smartthings_failed_to_set_access_code_error,
174214
smartthings_failed_to_set_after_multiple_retries,
215+
smartthings_no_free_slots_available,
175216
failed_to_set_on_device,
176217
failed_to_remove_from_device,
177218
duplicate_code_on_device,
@@ -186,18 +227,25 @@ const access_code_error = z.discriminatedUnion('error_code', [
186227
august_device_programming_delay_error,
187228
august_device_slots_full,
188229
august_lock_missing_keypad,
189-
salto_site_user_not_subscribed,
230+
august_lock_temporarily_offline_error,
231+
salto_ks_user_not_subscribed,
190232
hubitat_device_programming_delay,
191233
hubitat_no_free_positions_available,
234+
wyze_duplicate_code_name,
235+
wyze_potential_duplicate_code,
236+
dormakaba_oracode_no_valid_user_level,
192237
])
193238

194239
export type AccessCodeError = z.infer<typeof access_code_error>
195240

196241
const access_code_error_map = z.object({
197-
smartthings_failed_to_set_access_code_error:
242+
smartthings_failed_to_set_access_code:
198243
smartthings_failed_to_set_access_code_error.optional().nullable(),
199244
smartthings_failed_to_set_after_multiple_retries:
200245
smartthings_failed_to_set_after_multiple_retries.optional().nullable(),
246+
smartthings_no_free_slots_available: smartthings_no_free_slots_available
247+
.optional()
248+
.nullable(),
201249
failed_to_set_on_device: failed_to_set_on_device.optional().nullable(),
202250
failed_to_remove_from_device: failed_to_remove_from_device
203251
.optional()
@@ -224,12 +272,15 @@ const access_code_error_map = z.object({
224272
august_lock_invalid_code_length: august_lock_invalid_code_length
225273
.optional()
226274
.nullable(),
227-
august_device_programming_delay_error: august_device_programming_delay_error
275+
august_device_programming_delay: august_device_programming_delay_error
276+
.optional()
277+
.nullable(),
278+
august_lock_temporarily_offline: august_lock_temporarily_offline_error
228279
.optional()
229280
.nullable(),
230281
august_device_slots_full: august_device_slots_full.optional().nullable(),
231282
august_lock_missing_keypad: august_lock_missing_keypad.optional().nullable(),
232-
salto_site_user_not_subscribed: salto_site_user_not_subscribed
283+
salto_ks_user_not_subscribed: salto_ks_user_not_subscribed
233284
.optional()
234285
.nullable(),
235286
hubitat_device_programming_delay: hubitat_device_programming_delay
@@ -238,6 +289,13 @@ const access_code_error_map = z.object({
238289
hubitat_no_free_positions_available: hubitat_no_free_positions_available
239290
.optional()
240291
.nullable(),
292+
wyze_duplicate_code_name: wyze_duplicate_code_name.optional().nullable(),
293+
wyze_potential_duplicate_code: wyze_potential_duplicate_code
294+
.optional()
295+
.nullable(),
296+
dormakaba_oracode_no_valid_user_level: dormakaba_oracode_no_valid_user_level
297+
.optional()
298+
.nullable(),
241299
})
242300

243301
export type AccessCodeErrorMap = z.infer<typeof access_code_error_map>
@@ -266,6 +324,14 @@ const august_device_programming_delay_warning = common_access_code_warning
266324
})
267325
.describe('Access code has not yet been fully moved to the device.')
268326

327+
const august_lock_temporarily_offline_warning = common_access_code_warning
328+
.extend({
329+
warning_code: z
330+
.literal('august_lock_temporarily_offline')
331+
.describe(error_code_description),
332+
})
333+
.describe('August lock is temporarily offline.')
334+
269335
const code_modified_external_to_seam_warning = common_access_code_warning
270336
.extend({
271337
warning_code: z
@@ -292,14 +358,6 @@ const schlage_creation_outage = common_access_code_warning
292358
})
293359
.describe('Received an error when attempting to create this code.')
294360

295-
const salto_office_mode = common_access_code_warning
296-
.extend({
297-
warning_code: z
298-
.literal('salto_office_mode')
299-
.describe(warning_code_description),
300-
})
301-
.describe('Lock is in Office Mode. Access Codes will not unlock doors.')
302-
303361
const delay_in_setting_on_device = common_access_code_warning
304362
.extend({
305363
warning_code: z
@@ -354,12 +412,12 @@ const access_code_warning = z.discriminatedUnion('warning_code', [
354412
smartthings_failed_to_set_access_code_warning,
355413
schlage_detected_duplicate,
356414
schlage_creation_outage,
357-
salto_office_mode,
358415
code_modified_external_to_seam_warning,
359416
delay_in_setting_on_device,
360417
delay_in_removing_from_device,
361418
third_party_integration_detected,
362419
august_device_programming_delay_warning,
420+
august_lock_temporarily_offline_warning,
363421
igloo_algopin_must_be_used_within_24_hours,
364422
management_transferred,
365423
kwikset_unable_to_confirm_code_warning,
@@ -368,11 +426,10 @@ const access_code_warning = z.discriminatedUnion('warning_code', [
368426
export type AccessCodeWarning = z.infer<typeof access_code_warning>
369427

370428
const access_code_warning_map = z.object({
371-
smartthings_failed_to_set_access_code_warning:
429+
smartthings_failed_to_set_access_code:
372430
smartthings_failed_to_set_access_code_warning.optional().nullable(),
373431
schlage_detected_duplicate: schlage_detected_duplicate.optional().nullable(),
374432
schlage_creation_outage: schlage_creation_outage.optional().nullable(),
375-
salto_office_mode: salto_office_mode.optional().nullable(),
376433
code_modified_external_to_seam_warning: code_modified_external_to_seam_warning
377434
.optional()
378435
.nullable(),
@@ -383,8 +440,12 @@ const access_code_warning_map = z.object({
383440
third_party_integration_detected: third_party_integration_detected
384441
.optional()
385442
.nullable(),
386-
august_device_programming_delay_warning:
387-
august_device_programming_delay_warning.optional().nullable(),
443+
august_device_programming_delay: august_device_programming_delay_warning
444+
.optional()
445+
.nullable(),
446+
august_lock_temporarily_offline: august_lock_temporarily_offline_warning
447+
.optional()
448+
.nullable(),
388449
igloo_algopin_must_be_used_within_24_hours:
389450
igloo_algopin_must_be_used_within_24_hours.optional().nullable(),
390451
management_transferred: management_transferred.optional().nullable(),

0 commit comments

Comments
 (0)