Class: Seam::Clients::Thermostats

Inherits:
BaseClient show all
Defined in:
lib/seam/clients/thermostats.rb

Instance Attribute Summary

Attributes inherited from BaseClient

#client

Instance Method Summary collapse

Methods inherited from BaseClient

#initialize, #request_seam, #request_seam_object

Constructor Details

This class inherits a constructor from Seam::Clients::BaseClient

Instance Method Details

#climate_setting_schedulesObject



6
7
8
# File 'lib/seam/clients/thermostats.rb', line 6

def climate_setting_schedules
  @climate_setting_schedules ||= Seam::Clients::ThermostatsClimateSettingSchedules.new(self)
end

#cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, sync: nil, wait_for_action_attempt: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/seam/clients/thermostats.rb', line 10

def cool(device_id:, cooling_set_point_celsius: nil, cooling_set_point_fahrenheit: nil, sync: nil, wait_for_action_attempt: nil)
  action_attempt = request_seam_object(
    :post,
    "/thermostats/cool",
    Seam::ActionAttempt,
    "action_attempt",
    body: {device_id: device_id, cooling_set_point_celsius: cooling_set_point_celsius, cooling_set_point_fahrenheit: cooling_set_point_fahrenheit, sync: sync}.compact
  )

  action_attempt.decide_and_wait(wait_for_action_attempt)
  action_attempt
end

#get(device_id: nil, name: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/seam/clients/thermostats.rb', line 23

def get(device_id: nil, name: nil)
  request_seam_object(
    :post,
    "/thermostats/get",
    Seam::Device,
    "thermostat",
    body: {device_id: device_id, name: name}.compact
  )
end

#heat(device_id:, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, sync: nil, wait_for_action_attempt: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/seam/clients/thermostats.rb', line 33

def heat(device_id:, heating_set_point_celsius: nil, heating_set_point_fahrenheit: nil, sync: nil, wait_for_action_attempt: nil)
  action_attempt = request_seam_object(
    :post,
    "/thermostats/heat",
    Seam::ActionAttempt,
    "action_attempt",
    body: {device_id: device_id, heating_set_point_celsius: heating_set_point_celsius, heating_set_point_fahrenheit: heating_set_point_fahrenheit, sync: sync}.compact
  )

  action_attempt.decide_and_wait(wait_for_action_attempt)
  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, sync: nil, wait_for_action_attempt: nil) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/seam/clients/thermostats.rb', line 46

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, sync: nil, wait_for_action_attempt: nil)
  action_attempt = request_seam_object(
    :post,
    "/thermostats/heat_cool",
    Seam::ActionAttempt,
    "action_attempt",
    body: {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, sync: sync}.compact
  )

  action_attempt.decide_and_wait(wait_for_action_attempt)
  action_attempt
end

#list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, device_ids: nil, device_types: nil, exclude_if: nil, include_if: nil, limit: nil, manufacturer: nil, user_identifier_key: nil) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/seam/clients/thermostats.rb', line 59

def list(connect_webview_id: nil, connected_account_id: nil, connected_account_ids: nil, created_before: nil, custom_metadata_has: nil, device_ids: nil, device_types: nil, exclude_if: nil, include_if: nil, limit: nil, manufacturer: nil, user_identifier_key: nil)
  request_seam_object(
    :post,
    "/thermostats/list",
    Seam::Device,
    "thermostats",
    body: {connect_webview_id: connect_webview_id, connected_account_id: , connected_account_ids: , created_before: created_before, custom_metadata_has: , device_ids: device_ids, device_types: device_types, exclude_if: exclude_if, include_if: include_if, limit: limit, manufacturer: manufacturer, user_identifier_key: user_identifier_key}.compact
  )
end

#off(device_id:, sync: nil, wait_for_action_attempt: nil) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/seam/clients/thermostats.rb', line 69

def off(device_id:, sync: nil, wait_for_action_attempt: nil)
  action_attempt = request_seam_object(
    :post,
    "/thermostats/off",
    Seam::ActionAttempt,
    "action_attempt",
    body: {device_id: device_id, sync: sync}.compact
  )

  action_attempt.decide_and_wait(wait_for_action_attempt)
  action_attempt
end

#set_fan_mode(device_id:, fan_mode: nil, fan_mode_setting: nil, sync: nil, wait_for_action_attempt: nil) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/seam/clients/thermostats.rb', line 82

def set_fan_mode(device_id:, fan_mode: nil, fan_mode_setting: nil, sync: nil, wait_for_action_attempt: nil)
  action_attempt = request_seam_object(
    :post,
    "/thermostats/set_fan_mode",
    Seam::ActionAttempt,
    "action_attempt",
    body: {device_id: device_id, fan_mode: fan_mode, fan_mode_setting: fan_mode_setting, sync: sync}.compact
  )

  action_attempt.decide_and_wait(wait_for_action_attempt)
  action_attempt
end

#update(default_climate_setting:, device_id:) ⇒ Object



95
96
97
98
99
100
101
102
103
# File 'lib/seam/clients/thermostats.rb', line 95

def update(default_climate_setting:, device_id:)
  request_seam(
    :post,
    "/thermostats/update",
    body: {default_climate_setting: default_climate_setting, device_id: device_id}.compact
  )

  nil
end