Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update via seamapi/devicedb@5774a1bec84066d6f570879d5a9c6d8d01be7996 #213

Closed
Closed
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
13 changes: 12 additions & 1 deletion src/lib/seam/devicedb/public-models/device-model-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,20 @@ const relay = z.object({
main_category: z.literal('relay'),
})

const intercom = z.object({
main_category: z.literal('intercom'),
physical_properties: z.object({
has_camera: z.boolean(),
}),
software_features: z.object({
can_remotely_unlock: z.boolean(),
can_program_access_codes: z.boolean(),
}),
})

export const device_model_category_specific_properties = z.discriminatedUnion(
'main_category',
[smartlock, sensor, thermostat, relay],
[smartlock, sensor, thermostat, relay, intercom],
)

export const base_device_model_v1 = z.object({
Expand Down
20 changes: 20 additions & 0 deletions src/lib/seam/devicedb/route-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ export interface Routes {
| {
main_category: 'relay'
}
| {
main_category: 'intercom'
physical_properties: {
has_camera: boolean
}
software_features: {
can_remotely_unlock: boolean
can_program_access_codes: boolean
}
}
)
}
}
Expand Down Expand Up @@ -230,6 +240,16 @@ export interface Routes {
| {
main_category: 'relay'
}
| {
main_category: 'intercom'
physical_properties: {
has_camera: boolean
}
software_features: {
can_remotely_unlock: boolean
can_program_access_codes: boolean
}
}
)
>
}
Expand Down