htcc 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/htcc.gemspec +1 -1
- data/lib/htcc/client.rb +6 -13
- data/lib/htcc/thermostat.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09bd97c9dcfe27e5fedc55824e6e5833125ec009f69d7d213af310c2dec2ef47'
|
4
|
+
data.tar.gz: b0336e997b4c1b3fa97393d88a822bf82914429f1edbd1eac46e90810ae48aa4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca97050fd13acbf78c973ed321be13ce41ebd52b63da130a2334acc96ff5020f554e0ccb53c8487497c91a66b8d667674170fd592daf57ae76bd61bee16f2d4
|
7
|
+
data.tar.gz: 9b4b8f60b9171469f71409768ec4cce3599e83c82edb9fc0d1b77d98f2e6a3c981a6d7fc2cb66c6302104f18760048cf146508ed2a498bffea4e4cc1b0a4a80a
|
data/htcc.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'htcc'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.summary = "A Ruby client for the Honeywell Total Connect Comfort API"
|
5
5
|
s.description = "This gem can be used to control Honeywell thermostats that use the Total Connect Comfort platform."
|
6
6
|
s.author = 'Lee Folkman'
|
data/lib/htcc/client.rb
CHANGED
@@ -8,14 +8,11 @@ module HTCC
|
|
8
8
|
BASE_URL = 'https://mytotalconnectcomfort.com/portal'.freeze
|
9
9
|
HEADERS = { 'X-Requested-With': 'XMLHttpRequest' }.freeze
|
10
10
|
|
11
|
-
attr_reader :devices
|
12
|
-
|
13
11
|
def initialize(username, password, debug: false, debug_output: nil)
|
14
12
|
@debug = debug
|
15
13
|
@debug_output = nil
|
16
14
|
@devices = []
|
17
15
|
login(username, password)
|
18
|
-
get_devices if logged_in?
|
19
16
|
end
|
20
17
|
|
21
18
|
def debug=(val)
|
@@ -26,22 +23,18 @@ module HTCC
|
|
26
23
|
@logged_in
|
27
24
|
end
|
28
25
|
|
29
|
-
def
|
30
|
-
@devices
|
31
|
-
|
26
|
+
def devices(refresh = false)
|
27
|
+
return @devices unless @devices.empty? || refresh
|
28
|
+
|
29
|
+
@devices = get_devices if logged_in?
|
32
30
|
end
|
33
31
|
|
34
32
|
private
|
35
33
|
|
36
34
|
def get_devices
|
37
|
-
resp = request(
|
38
|
-
'/Location/GetLocationListData',
|
39
|
-
method: 'post',
|
40
|
-
data: { 'page' => '1', 'filter' => '' }
|
41
|
-
)
|
35
|
+
resp = request('/Location/GetLocationListData', method: 'post', data: { 'page': '1', 'filter': '' })
|
42
36
|
locations = ::JSON.parse(resp.body)
|
43
|
-
|
44
|
-
@devices.map! do |device|
|
37
|
+
locations.flat_map { |loc| loc['Devices'] }.map do |device|
|
45
38
|
case device['DeviceType']
|
46
39
|
when 24
|
47
40
|
Thermostat.new(device, self)
|
data/lib/htcc/thermostat.rb
CHANGED
@@ -105,6 +105,10 @@ module HTCC
|
|
105
105
|
change_setting(cool_setpoint: temp, hold: :temporary)
|
106
106
|
end
|
107
107
|
|
108
|
+
def cool_setpoint_range
|
109
|
+
[min_cool_setpoint, max_cool_setpoint]
|
110
|
+
end
|
111
|
+
|
108
112
|
# Heating temperature setting
|
109
113
|
def heat_setpoint
|
110
114
|
get_status
|
@@ -117,6 +121,10 @@ module HTCC
|
|
117
121
|
change_setting(heat_setpoint: temp, hold: :temporary)
|
118
122
|
end
|
119
123
|
|
124
|
+
def heat_setpoint_range
|
125
|
+
[min_heat_setpoint, max_heat_setpoint]
|
126
|
+
end
|
127
|
+
|
120
128
|
def resume_schedule
|
121
129
|
change_setting(hold: :none)
|
122
130
|
end
|