Skip to content

Update via seamapi/seam-connect@97390fbdfee5195fc7aaadb3fff720708ac04f5e #1736

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions src/lib/seam/connect/models/access-grants/access-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const access_method = z.object({
.datetime()
.nullable()
.describe('Date and time at which the access method was issued.'),
instant_key_url: z
.string()
.optional()
.describe('URL of instant key for mobile key access methods.'),
}).describe(`
---
undocumented: Unreleased.
Expand Down
28 changes: 6 additions & 22 deletions src/lib/seam/connect/models/acs/acs-users/acs-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,6 @@ const common_acs_user = z
.describe(
'Phone number of the user identity associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management) in E.164 format (for example, `+15555550100`).',
),
latest_desired_state_synced_with_provider_at: z
.string()
.datetime()
.nullable()
.optional().describe(`
---
undocumented: Only used internally.
---
`),
is_latest_desired_state_synced_with_provider: z
.boolean()
.nullable()
.optional().describe(`
---
undocumented: Only used internally.
---
`),
warnings: z
.array(acs_users_warnings)
.describe(
Expand All @@ -326,11 +309,12 @@ const common_acs_user = z
.describe(
'Errors associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management).',
),
pending_mutations: z.array(acs_user_pending_mutations).optional().describe(`
---
undocumented: Experimental.
---
`),
pending_mutations: z
.array(acs_user_pending_mutations)
.optional()
.describe(
'Pending mutations associated with the [ACS user](https://docs.seam.co/latest/capability-guides/access-systems/user-management). Seam is in the process of pushing these mutations to the integrated access system.',
),
})
.merge(user_fields)

Expand Down
89 changes: 62 additions & 27 deletions src/lib/seam/connect/models/acs/acs-users/pending-mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@ import { z } from 'zod'
import { phone_number } from '../../phone-number.js'

const common_pending_mutation = z.object({
created_at: z.string().datetime(),
message: z.string(),
created_at: z
.string()
.datetime()
.describe('Date and time at which the mutation was created.'),
message: z.string().describe('Detailed description of the mutation.'),
})

const creating = common_pending_mutation.extend({
mutation_code: z.literal('creating'),
})
const creating = common_pending_mutation
.extend({
mutation_code: z.literal('creating'),
})
.describe(
'Seam is in the process of pushing a user creation to the integrated access system.',
)

const deleting = common_pending_mutation.extend({
mutation_code: z.literal('deleting'),
})
const deleting = common_pending_mutation
.extend({
mutation_code: z.literal('deleting'),
})
.describe(
'Seam is in the process of pushing a user deletion to the integrated access system.',
)

const acs_user_info = z.object({
email_address: z.string().email().nullable(),
Expand All @@ -33,27 +44,51 @@ const access_schedule = z.object({
ends_at: z.string().datetime().nullable(),
})

const updating_access_schedule_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_access_schedule'),
from: access_schedule,
to: access_schedule,
})
const updating_access_schedule_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_access_schedule'),
from: access_schedule,
to: access_schedule,
})
.describe(
'Seam is in the process of pushing an access schedule update to the integrated access system.',
)

const updating_suspension_state_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_suspension_state'),
from: z.object({ is_suspended: z.boolean() }),
to: z.object({ is_suspended: z.boolean() }),
})
const updating_suspension_state_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_suspension_state'),
from: z.object({ is_suspended: z.boolean() }),
to: z.object({ is_suspended: z.boolean() }),
})
.describe(
'Seam is in the process of pushing a suspension state update to the integrated access system.',
)

const updating_group_membership_mutation = common_pending_mutation.extend({
mutation_code: z.literal('updating_group_membership'),
from: z.object({
acs_access_group_id: z.string().uuid().nullable(),
}),
to: z.object({
acs_access_group_id: z.string().uuid().nullable(),
}),
})
const updating_group_membership_mutation = common_pending_mutation
.extend({
mutation_code: z.literal('updating_group_membership'),
from: z
.object({
acs_access_group_id: z
.string()
.uuid()
.nullable()
.describe('Old access group ID.'),
})
.describe('Old access group membership.'),
to: z
.object({
acs_access_group_id: z
.string()
.uuid()
.nullable()
.describe('New access group ID.'),
})
.describe('New access group membership.'),
})
.describe(
'Seam is in the process of pushing an access group membership update to the integrated access system.',
)

export const acs_user_pending_mutations = z.discriminatedUnion(
'mutation_code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
climate_setting,
fan_mode_setting,
hvac_mode_setting,
thermostat_daily_program,
thermostat_schedule,
thermostat_weekly_program,
} from '../../thermostats/index.js'

export const thermostat_capability_properties = z
Expand Down Expand Up @@ -41,6 +43,13 @@ export const thermostat_capability_properties = z
available_climate_presets: z.array(climate_preset),
fallback_climate_preset_key: z.string().min(1).nullable().default(null),
active_thermostat_schedule: thermostat_schedule.nullable().default(null),
thermostat_daily_programs: z
.array(thermostat_daily_program)
.nullable()
.default(null),
thermostat_weekly_program: thermostat_weekly_program
.nullable()
.default(null),
min_cooling_set_point_celsius: z.number(),
min_cooling_set_point_fahrenheit: z.number(),
max_cooling_set_point_celsius: z.number(),
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/connect/models/thermostats/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './climate-preset.js'
export * from './modes.js'
export * from './thermostat-program.js'
export * from './thermostat-schedule.js'
90 changes: 90 additions & 0 deletions src/lib/seam/connect/models/thermostats/thermostat-program.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { z } from 'zod'

export const thermostat_daily_program_period = z.object({
starts_at_time: z
.string()
.regex(/^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/)
.describe(
'Time at which the thermostat daily program entry starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.',
),
climate_preset_key: z
.string()
.describe(
'Key of the [climate preset](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-climate-presets) to activate at the starts_at_time.',
),
})

export const thermostat_daily_program = z.object({
thermostat_daily_program_id: z
.string()
.uuid()
.describe('ID of the thermostat daily program.'),
device_id: z.string().uuid().describe('ID of the desired thermostat device.'),
name: z
.string()
.optional()
.describe('User-friendly name to identify the thermostat daily program.'),
periods: z
.array(thermostat_daily_program_period)
.describe('Array of thermostat daily program periods.'),
created_at: z
.string()
.datetime()
.describe(
'Date and time at which the thermostat daily program was created.',
),
})

export const thermostat_weekly_program = z.object({
device_id: z
.string()
.uuid()
.describe('ID of the thermostat device the weekly program is for.'),
monday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Mondays.'),
tuesday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Tuesdays.'),
wednesday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Wednesdays.'),
thursday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Thursdays.'),
friday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Fridays.'),
saturday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Saturdays.'),
sunday_program_id: z
.string()
.uuid()
.nullable()
.describe('ID of the thermostat daily program to run on Sundays.'),
created_at: z
.string()
.datetime()
.describe(
'Date and time at which the thermostat weekly program was created.',
),
})

export type ThermostatDailyProgram = z.infer<typeof thermostat_daily_program>
export type ThermostatDailyProgramPeriod = z.infer<
typeof thermostat_daily_program_period
>
export type ThermostatWeeklyProgram = z.infer<typeof thermostat_weekly_program>
10 changes: 3 additions & 7 deletions src/lib/seam/connect/models/thermostats/thermostat-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const thermostat_schedule = z.object({
max_override_period_minutes: z
.number()
.int()
.nonnegative()
.positive()
.nullable()
.optional()
.describe(
Expand All @@ -39,15 +39,11 @@ export const thermostat_schedule = z.object({
.describe(
'Date and time at which the [thermostat schedule](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.',
),
unstable_is_override_allowed: z
is_override_allowed: z
.boolean()
.optional()
.describe(
`
---
undocumented: Unstable
---
Indicates whether a person at the thermostat can change the thermostat's settings after the [thermostat schedule](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts.`,
"Indicates whether a person at the thermostat can change the thermostat's settings after the [thermostat schedule](https://docs.seam.co/latest/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts.",
),
ends_at: z
.string()
Expand Down
Loading