Class: Seam::Clients::Thermostats

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/thermostats.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ Thermostats

Returns a new instance of Thermostats.



8
9
10
11
# File 'lib/seam/routes/thermostats.rb', line 8

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#activate_climate_preset(climate_preset_key:, device_id:, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Activates a specified climate preset for a specified thermostat.

Parameters:

  • climate_preset_key

    Climate preset key of the climate preset that you want to activate.

  • device_id

    ID of the thermostat device for which you want to activate a climate preset.

Returns:



29
30
31
32
33
34
35
# File 'lib/seam/routes/thermostats.rb', line 29

def activate_climate_preset(climate_preset_key:, device_id:, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/activate_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Sets a specified thermostat to cool mode.

Parameters:

Returns:



42
43
44
45
46
47
48
# File 'lib/seam/routes/thermostats.rb', line 42

def cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/cool", {device_id: device_id, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#create_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: nil, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, ecobee_metadata: nil, fan_mode_setting: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, hvac_mode_setting: nil, manual_override_allowed: nil, name: nil) ⇒ nil

Deprecated.

manual_override_allowed: Use 'thermostat_schedule.is_override_allowed'

Creates a climate preset for a specified thermostat.

Parameters:

  • climate_preset_key

    Unique key to identify the climate preset.

  • device_id

    ID of the thermostat device for which you want create a climate preset.

  • climate_preset_mode (defaults to: nil)

    The climate preset mode for the thermostat, based on the available climate preset modes reported by the device.

  • cooling_set_point_celsius (defaults to: nil)

    Temperature to which the thermostat should cool (in °C). See also Set Points.

  • cooling_set_point_fahrenheit (defaults to: nil)

    Temperature to which the thermostat should cool (in °F). See also Set Points.

  • ecobee_metadata (defaults to: nil)

    Metadata specific to the Ecobee climate, if applicable.

  • fan_mode_setting (defaults to: nil)

    Desired fan mode setting, such as on, auto, or circulate.

  • heating_set_point_celsius (defaults to: nil)

    Temperature to which the thermostat should heat (in °C). See also Set Points.

  • heating_set_point_fahrenheit (defaults to: nil)

    Temperature to which the thermostat should heat (in °F). See also Set Points.

  • hvac_mode_setting (defaults to: nil)

    Desired HVAC mode setting, such as heat, cool, heat_cool, or off.

  • manual_override_allowed (defaults to: nil)

    Indicates whether a person at the thermostat or using the API can change the thermostat's settings.

  • name (defaults to: nil)

    User-friendly name to identify the climate preset.

Returns:

  • (nil)

    OK



65
66
67
68
69
# File 'lib/seam/routes/thermostats.rb', line 65

def create_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: nil, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, ecobee_metadata: nil, fan_mode_setting: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, hvac_mode_setting: nil, manual_override_allowed: nil, name: nil)
  @client.post("/thermostats/create_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id, climate_preset_mode: climate_preset_mode, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, ecobee_metadata: , fan_mode_setting: fan_mode_setting, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit, hvac_mode_setting: hvac_mode_setting, manual_override_allowed: manual_override_allowed, name: name}.compact)

  nil
end

#daily_programsObject



13
14
15
# File 'lib/seam/routes/thermostats.rb', line 13

def daily_programs
  @daily_programs ||= Seam::Clients::ThermostatsDailyPrograms.new(client: @client, defaults: @defaults)
end

#delete_climate_preset(climate_preset_key:, device_id:) ⇒ nil

Deletes a specified climate preset for a specified thermostat.

Parameters:

  • climate_preset_key

    Climate preset key of the climate preset that you want to delete.

  • device_id

    ID of the thermostat device for which you want to delete a climate preset.

Returns:

  • (nil)

    OK



75
76
77
78
79
# File 'lib/seam/routes/thermostats.rb', line 75

def delete_climate_preset(climate_preset_key:, device_id:)
  @client.post("/thermostats/delete_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id}.compact)

  nil
end

#heat(device_id:, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Sets a specified thermostat to heat mode.

Parameters:

Returns:



86
87
88
89
90
91
92
# File 'lib/seam/routes/thermostats.rb', line 86

def heat(device_id:, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/heat", {device_id: device_id, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#heat_cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Sets a specified thermostat to heat-cool ("auto") mode.

Parameters:

Returns:



101
102
103
104
105
106
107
# File 'lib/seam/routes/thermostats.rb', line 101

def heat_cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/heat_cool", {device_id: device_id, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil) ⇒ Seam::Resources::Device

Deprecated.

unstable_location_id: Use space_id.

Returns a list of all thermostats.

Parameters:

  • connect_webview_id (defaults to: nil)

    ID of the Connect Webview for which you want to list devices.

  • connected_account_id (defaults to: nil)

    ID of the connected account for which you want to list devices.

  • connected_account_ids (defaults to: nil)

    Array of IDs of the connected accounts for which you want to list devices.

  • created_before (defaults to: nil)

    Timestamp by which to limit returned devices. Returns devices created before this timestamp.

  • custom_metadata_has (defaults to: nil)

    Set of key:value custom metadata pairs for which you want to list devices.

  • customer_key (defaults to: nil)

    Customer key for which you want to list devices.

  • device_ids (defaults to: nil)

    Array of device IDs for which you want to list devices.

  • device_type (defaults to: nil)

    Device type by which you want to filter thermostat devices.

  • device_types (defaults to: nil)

    Array of device types by which you want to filter thermostat devices.

  • limit (defaults to: nil)

    Numerical limit on the number of devices to return.

  • manufacturer (defaults to: nil)

    Manufacturer by which you want to filter thermostat devices.

  • page_cursor (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

  • search (defaults to: nil)

    String for which to search. Filters returned devices to include all records that satisfy a partial match using device_id (full or partial UUID prefix, minimum 4 characters), connected_account_id, display_name, custom_metadata or location.location_name.

  • space_id (defaults to: nil)

    ID of the space for which you want to list devices.

  • unstable_location_id (defaults to: nil)
  • user_identifier_key (defaults to: nil)

    Your own internal user ID for the user for which you want to list devices.

Returns:



128
129
130
131
132
# File 'lib/seam/routes/thermostats.rb', line 128

def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, customer_key: nil, device_ids: nil, device_type: nil, device_types: nil, limit: nil, manufacturer: nil, page_cursor: nil, search: nil, space_id: nil, unstable_location_id: nil, user_identifier_key: nil)
  res = @client.post("/thermostats/list", {connect_webview_id: connect_webview_id, connected_account_id: , connected_account_ids: , created_before: created_before, custom_metadata_has: , customer_key: customer_key, device_ids: device_ids, device_type: device_type, device_types: device_types, limit: limit, manufacturer: manufacturer, page_cursor: page_cursor, search: search, space_id: space_id, unstable_location_id: unstable_location_id, user_identifier_key: user_identifier_key}.compact)

  Seam::Resources::Device.load_from_response(res.body["devices"])
end

#off(device_id:, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Sets a specified thermostat to "off" mode.

Parameters:

  • device_id

    ID of the thermostat device that you want to set to off mode.

Returns:



137
138
139
140
141
142
143
# File 'lib/seam/routes/thermostats.rb', line 137

def off(device_id:, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/off", {device_id: device_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#schedulesObject



17
18
19
# File 'lib/seam/routes/thermostats.rb', line 17

def schedules
  @schedules ||= Seam::Clients::ThermostatsSchedules.new(client: @client, defaults: @defaults)
end

#set_fallback_climate_preset(climate_preset_key:, device_id:) ⇒ nil

Sets a specified climate preset as the "fallback" preset for a specified thermostat.

Parameters:

  • climate_preset_key

    Climate preset key of the climate preset that you want to set as the fallback climate preset.

  • device_id

    ID of the thermostat device for which you want to set the fallback climate preset.

Returns:

  • (nil)

    OK



149
150
151
152
153
# File 'lib/seam/routes/thermostats.rb', line 149

def set_fallback_climate_preset(climate_preset_key:, device_id:)
  @client.post("/thermostats/set_fallback_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id}.compact)

  nil
end

#set_fan_mode(device_id:, fan_mode: nil, fan_mode_setting: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Deprecated.

fan_mode: Use fan_mode_setting instead.

Sets the fan mode setting for a specified thermostat.

Parameters:

Returns:



161
162
163
164
165
166
167
# File 'lib/seam/routes/thermostats.rb', line 161

def set_fan_mode(device_id:, fan_mode: nil, fan_mode_setting: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/set_fan_mode", {device_id: device_id, fan_mode: fan_mode, fan_mode_setting: fan_mode_setting}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#set_hvac_mode(device_id:, hvac_mode_setting:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Sets the HVAC mode for a specified thermostat.

Parameters:

Returns:



177
178
179
180
181
182
183
# File 'lib/seam/routes/thermostats.rb', line 177

def set_hvac_mode(device_id:, hvac_mode_setting:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/set_hvac_mode", {device_id: device_id, hvac_mode_setting: hvac_mode_setting, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#set_temperature_threshold(device_id:, lower_limit_celsius: nil, lower_limit_fahrenheit: nil, upper_limit_celsius: nil, upper_limit_fahrenheit: nil) ⇒ nil

Sets a temperature threshold for a specified thermostat. Seam emits a thermostat.temperature_threshold_exceeded event and adds a warning on a thermostat if it reports a temperature outside the threshold range.

Parameters:

  • device_id

    ID of the thermostat device for which you want to set a temperature threshold.

  • lower_limit_celsius (defaults to: nil)

    Lower temperature limit in in °C. Seam alerts you if the reported temperature is lower than this value. You can specify either lower_limit but not both.

  • lower_limit_fahrenheit (defaults to: nil)

    Lower temperature limit in in °F. Seam alerts you if the reported temperature is lower than this value. You can specify either lower_limit but not both.

  • upper_limit_celsius (defaults to: nil)

    Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either upper_limit but not both.

  • upper_limit_fahrenheit (defaults to: nil)

    Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either upper_limit but not both.

Returns:

  • (nil)

    OK



192
193
194
195
196
# File 'lib/seam/routes/thermostats.rb', line 192

def set_temperature_threshold(device_id:, lower_limit_celsius: nil, lower_limit_fahrenheit: nil, upper_limit_celsius: nil, upper_limit_fahrenheit: nil)
  @client.post("/thermostats/set_temperature_threshold", {device_id: device_id, lower_limit_celsius: lower_limit_celsius, lower_limit_fahrenheit: lower_limit_fahrenheit, upper_limit_celsius: upper_limit_celsius, upper_limit_fahrenheit: upper_limit_fahrenheit}.compact)

  nil
end

#simulateObject



21
22
23
# File 'lib/seam/routes/thermostats.rb', line 21

def simulate
  @simulate ||= Seam::Clients::ThermostatsSimulate.new(client: @client, defaults: @defaults)
end

#update_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: nil, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, ecobee_metadata: nil, fan_mode_setting: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, hvac_mode_setting: nil, manual_override_allowed: nil, name: nil) ⇒ nil

Deprecated.

manual_override_allowed: Use 'thermostat_schedule.is_override_allowed'

Updates a specified climate preset for a specified thermostat.

Parameters:

  • climate_preset_key

    Unique key to identify the climate preset.

  • device_id

    ID of the thermostat device for which you want to update a climate preset.

  • climate_preset_mode (defaults to: nil)

    The climate preset mode for the thermostat, based on the available climate preset modes reported by the device.

  • cooling_set_point_celsius (defaults to: nil)

    Temperature to which the thermostat should cool (in °C). See also Set Points.

  • cooling_set_point_fahrenheit (defaults to: nil)

    Temperature to which the thermostat should cool (in °F). See also Set Points.

  • ecobee_metadata (defaults to: nil)

    Metadata specific to the Ecobee climate, if applicable.

  • fan_mode_setting (defaults to: nil)

    Desired fan mode setting, such as on, auto, or circulate.

  • heating_set_point_celsius (defaults to: nil)

    Temperature to which the thermostat should heat (in °C). See also Set Points.

  • heating_set_point_fahrenheit (defaults to: nil)

    Temperature to which the thermostat should heat (in °F). See also Set Points.

  • hvac_mode_setting (defaults to: nil)

    Desired HVAC mode setting, such as heat, cool, heat_cool, or off.

  • manual_override_allowed (defaults to: nil)

    Indicates whether a person at the thermostat can change the thermostat's settings. See Specifying Manual Override Permissions.

  • name (defaults to: nil)

    User-friendly name to identify the climate preset.

Returns:

  • (nil)

    OK



213
214
215
216
217
# File 'lib/seam/routes/thermostats.rb', line 213

def update_climate_preset(climate_preset_key:, device_id:, climate_preset_mode: nil, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, ecobee_metadata: nil, fan_mode_setting: nil, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, hvac_mode_setting: nil, manual_override_allowed: nil, name: nil)
  @client.post("/thermostats/update_climate_preset", {climate_preset_key: climate_preset_key, device_id: device_id, climate_preset_mode: climate_preset_mode, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, ecobee_metadata: , fan_mode_setting: fan_mode_setting, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit, hvac_mode_setting: hvac_mode_setting, manual_override_allowed: manual_override_allowed, name: name}.compact)

  nil
end

#update_weekly_program(device_id:, friday_program_id: nil, monday_program_id: nil, saturday_program_id: nil, sunday_program_id: nil, thursday_program_id: nil, tuesday_program_id: nil, wednesday_program_id: nil, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Updates the thermostat weekly program for a thermostat device. To configure a weekly program, specify the ID of the daily program that you want to use for each day of the week. When you update a weekly program, the set of programs that you specify overwrites any previous weekly program for the thermostat.

Parameters:

  • device_id

    ID of the thermostat device for which you want to update the weekly program.

  • friday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Fridays.

  • monday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Mondays.

  • saturday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Saturdays.

  • sunday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Sundays.

  • thursday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Thursdays.

  • tuesday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Tuesdays.

  • wednesday_program_id (defaults to: nil)

    ID of the thermostat daily program to run on Wednesdays.

Returns:



229
230
231
232
233
234
235
# File 'lib/seam/routes/thermostats.rb', line 229

def update_weekly_program(device_id:, friday_program_id: nil, monday_program_id: nil, saturday_program_id: nil, sunday_program_id: nil, thursday_program_id: nil, tuesday_program_id: nil, wednesday_program_id: nil, wait_for_action_attempt: nil)
  res = @client.post("/thermostats/update_weekly_program", {device_id: device_id, friday_program_id: friday_program_id, monday_program_id: monday_program_id, saturday_program_id: saturday_program_id, sunday_program_id: sunday_program_id, thursday_program_id: thursday_program_id, tuesday_program_id: tuesday_program_id, wednesday_program_id: wednesday_program_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end