Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/lib/seam/connect/models/devices/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,17 @@ const accessory_keypad_setup_required = common_device_warning.extend({
Indicates that the accessory keypad exists, but is not linked to the Igloohome Bridge. Online access code programming will fail until the keypad is linked to the Igloohome Bridge in the Igloohome app.
`)

const accessory_keypad_low_battery = common_device_warning.extend({
warning_code: z
.literal('accessory_keypad_low_battery')
.describe(warning_code_description),
}).describe(`
---
variant_group_key: locks
---
Indicates that the accessory keypad paired with this lock has a low or critically low battery. Replace its batteries so guests can keep entering their access codes.
`)

const unreliable_online_status = common_device_warning.extend({
warning_code: z
.literal('unreliable_online_status')
Expand Down Expand Up @@ -683,6 +694,7 @@ const device_warning = z.discriminatedUnion('warning_code', [
provider_issue,
keynest_unsupported_locker,
accessory_keypad_setup_required,
accessory_keypad_low_battery,
unreliable_online_status,
max_access_codes_reached,
])
Expand Down Expand Up @@ -741,6 +753,9 @@ export const device_warning_map = z.object({
accessory_keypad_setup_required: accessory_keypad_setup_required
.optional()
.nullable(),
accessory_keypad_low_battery: accessory_keypad_low_battery
.optional()
.nullable(),
unreliable_online_status: unreliable_online_status.optional().nullable(),
max_access_codes_reached: max_access_codes_reached.optional().nullable(),
})
Expand Down
7 changes: 7 additions & 0 deletions src/lib/seam/connect/models/events/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const device_battery_status = z
'Battery status of the affected device, calculated from the numeric `battery_level` value.',
)

const battery_source = z
.enum(['lock', 'accessory_keypad'])
.describe(
"Battery that dropped below the low threshold. `lock`: the lock's own battery. `accessory_keypad`: a paired accessory keypad's battery. Omitted for events emitted before this field existed, which always refer to the lock's own battery.",
)

const disconnection_error_code = z
.enum(['account_disconnected', 'hub_disconnected', 'device_disconnected'])
.describe('Error code associated with the disconnection event, if any.')
Expand Down Expand Up @@ -176,6 +182,7 @@ export type DeviceTamperedEvent = z.infer<typeof device_tampered_event>
export const device_low_battery_event = device_event.extend({
event_type: z.literal('device.low_battery'),
battery_level,
battery_source: battery_source.optional(),
}).describe(`
---
route_path: /devices
Expand Down
58 changes: 58 additions & 0 deletions src/lib/seam/connect/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17772,6 +17772,32 @@ const openapi: OpenAPISpec = {
type: 'object',
'x-variant-group-key': 'locks',
},
{
description:
'Indicates that the accessory keypad paired with this lock has a low or critically low battery. Replace its batteries so guests can keep entering their access codes.',
properties: {
created_at: {
description:
'Date and time at which Seam created the warning.',
format: 'date-time',
type: 'string',
},
message: {
description:
'Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
description:
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
enum: ['accessory_keypad_low_battery'],
type: 'string',
},
},
required: ['message', 'created_at', 'warning_code'],
type: 'object',
'x-variant-group-key': 'locks',
},
{
description:
'Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status.',
Expand Down Expand Up @@ -26252,6 +26278,12 @@ const openapi: OpenAPISpec = {
minimum: 0,
type: 'number',
},
battery_source: {
description:
"Battery that dropped below the low threshold. `lock`: the lock's own battery. `accessory_keypad`: a paired accessory keypad's battery. Omitted for events emitted before this field existed, which always refer to the lock's own battery.",
enum: ['lock', 'accessory_keypad'],
type: 'string',
},
connected_account_custom_metadata: {
additionalProperties: {
oneOf: [{ type: 'string' }, { type: 'boolean' }],
Expand Down Expand Up @@ -37770,6 +37802,32 @@ const openapi: OpenAPISpec = {
type: 'object',
'x-variant-group-key': 'locks',
},
{
description:
'Indicates that the accessory keypad paired with this lock has a low or critically low battery. Replace its batteries so guests can keep entering their access codes.',
properties: {
created_at: {
description:
'Date and time at which Seam created the warning.',
format: 'date-time',
type: 'string',
},
message: {
description:
'Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.',
type: 'string',
},
warning_code: {
description:
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
enum: ['accessory_keypad_low_battery'],
type: 'string',
},
},
required: ['message', 'created_at', 'warning_code'],
type: 'object',
'x-variant-group-key': 'locks',
},
{
description:
'Indicates that the device may optimistically be reported as online because the provider does not reliably report its online status.',
Expand Down
Loading
Loading