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

Commit

Permalink
feat: Add /thermostats/off (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
xplato authored Nov 8, 2023
1 parent 591f3aa commit 1b88a4b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 20 deletions.
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

0 comments on commit 1b88a4b

Please sign in to comment.