Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
seambot committed Oct 5, 2023
1 parent 853d373 commit 9b71aa0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
17 changes: 16 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,24 @@ 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(),
}),
})

const accessory = z.object({
main_category: z.literal('accessory'),
})

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

export const base_device_model_v1 = z.object({
Expand Down
26 changes: 26 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,19 @@ 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
}
}
| {
main_category: 'accessory'
}
)
}
}
Expand Down Expand Up @@ -230,6 +243,19 @@ 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
}
}
| {
main_category: 'accessory'
}
)
>
}
Expand Down

0 comments on commit 9b71aa0

Please sign in to comment.