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
32 changes: 32 additions & 0 deletions src/lib/seam/connect/models/events/devices.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as z from 'zod/v3'

import { custom_metadata } from '../custom-metadata.js'
import { datetime } from '../datetime.js'
import { temperature_controller_mode } from '../devices/temperature-controller.js'
import { climate_setting } from '../thermostats/climate-preset.js'
import {
Expand Down Expand Up @@ -713,6 +714,36 @@ export type ThermostatClimatePresetActivatedEvent = z.infer<
typeof thermostat_climate_preset_activated_event
>

export const thermostat_schedule_climate_preset_activation_may_fail_event =
device_event
.extend({
event_type: z.literal(
'thermostat_schedule.climate_preset_activation_may_fail',
),
thermostat_schedule_id: z
.string()
.uuid()
.describe(
'ID of the thermostat schedule whose climate preset activation may fail.',
),
thermostat_schedule_starts_at: datetime.describe(
'Date and time at which the thermostat schedule starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.',
),
thermostat_schedule_ends_at: datetime.describe(
'Date and time at which the thermostat schedule ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.',
),
})
.extend(device_event_issue_properties).describe(`
---
route_path: /thermostats
---
A [thermostat](https://www.seam.co/docs/capability-guides/thermostats) may fail to activate a [climate preset](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-climate-presets) when a [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts or ends, because the thermostat was offline shortly before the scheduled time. While the thermostat stays offline, the thermostat schedule carries a \`climate_preset_activation_may_fail\` warning until the scheduled time.
`)

export type ThermostatScheduleClimatePresetActivationMayFailEvent = z.infer<
typeof thermostat_schedule_climate_preset_activation_may_fail_event
>

export const thermostat_manually_adjusted_method = z
.enum(['seam', 'external'])
.describe(
Expand Down Expand Up @@ -1079,6 +1110,7 @@ export const device_events = [
lock_door_closed_event,
thermostat_climate_preset_activated_event,
thermostat_manually_adjusted_event,
thermostat_schedule_climate_preset_activation_may_fail_event,
temperature_threshold_exceeded_event,
temperature_threshold_no_longer_exceeded_event,
temperature_reached_set_point_event,
Expand Down
33 changes: 33 additions & 0 deletions src/lib/seam/connect/models/thermostats/thermostat-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@ import * as z from 'zod/v3'

import { datetime } from '../datetime.js'

const climate_preset_activation_may_fail_warning = z
.object({
created_at: datetime.describe(
'Date and time at which Seam created the warning.',
),
message: z
.string()
.describe(
'Detailed description of the warning. Provides insights into the issue and potentially how to rectify it.',
),
warning_code: z
.literal('climate_preset_activation_may_fail')
.describe(
'Unique identifier of the type of warning. Enables quick recognition and categorization of the issue.',
),
})
.describe(
'Indicates that the [thermostat](https://www.seam.co/docs/capability-guides/thermostats) may fail to activate a climate preset when the [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules) starts or ends. The warning message explains the cause. Currently present while the thermostat is offline and the next start or end of the thermostat schedule is less than an hour away; it clears automatically once the thermostat is back online or that time passes.',
)

const thermostat_schedule_warning = z
.discriminatedUnion('warning_code', [
climate_preset_activation_may_fail_warning,
])
.describe(
'Warning associated with the [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules).',
)

export const thermostat_schedule = z.object({
thermostat_schedule_id: z
.string()
Expand Down Expand Up @@ -75,6 +103,11 @@ export const thermostat_schedule = z.object({
.describe(
'Errors associated with the [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules).',
),
warnings: z
.array(thermostat_schedule_warning)
.describe(
'Warnings associated with the [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules).',
),
}).describe(`
---
route_path: /thermostats/schedules
Expand Down
Loading
Loading