Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

feat: Add /thermostats/off #292

Merged
merged 2 commits into from
Nov 8, 2023
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
27 changes: 14 additions & 13 deletions docs/classes/Seam.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions docs/modules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions src/seam-connect/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
EventGetRequest,
ClientSessionsGetRequest,
ThermostatSetFanModeRequest,
ThermostatOffRequest,
ThermostatCoolRequest,
ThermostatHeatRequest,
} from "../types/route-requests"
Expand Down Expand Up @@ -625,15 +626,21 @@ export abstract class Routes {
method: "POST",
data: params,
}),
heat: (params: ThermostatHeatRequest) =>
this.createActionAttemptAndWait({
url: "/thermostats/heat",
method: "POST",
data: params,
}),
cool: (params: ThermostatCoolRequest) =>
this.createActionAttemptAndWait({
url: "/thermostats/cool",
method: "POST",
data: params,
}),
heat: (params: ThermostatHeatRequest) =>
off: (params: ThermostatOffRequest) =>
this.createActionAttemptAndWait({
url: "/thermostats/heat",
url: "/thermostats/off",
method: "POST",
data: params,
}),
Expand Down
11 changes: 8 additions & 3 deletions src/types/route-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,21 @@ export type ThermostatSetFanModeRequest = {
fan_mode_setting: FanModeSetting
}

export type ThermostatHeatRequest = {
device_id: string
sync?: boolean
heating_set_point_celsius?: number
heating_set_point_fahrenheit?: number
}

export type ThermostatCoolRequest = {
device_id: string
sync?: boolean
cooling_set_point_celsius?: number
cooling_set_point_fahrenheit?: number
}

export type ThermostatHeatRequest = {
export type ThermostatOffRequest = {
device_id: string
sync?: boolean
heating_set_point_celsius?: number
heating_set_point_fahrenheit?: number
}
13 changes: 13 additions & 0 deletions tests/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,19 @@ test(
},
"{}"
)
test(
testAPIMethod("thermostats.off"),
{
args: (seed) => [
{
device_id: seed.devices.nest.id1,
},
],
load_devices_from: ["nest"],
modifiesState: true,
},
"{}"
)
test(
testAPIMethod("thermostats.climateSettingSchedules.get"),
{
Expand Down