renstar 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -5
- data/bin/renstar.rb +10 -1
- data/lib/renstar/api_client/api_object.rb +3 -6
- data/lib/renstar/api_client/api_objects/alert.rb +3 -0
- data/lib/renstar/api_client/api_objects/info.rb +3 -0
- data/lib/renstar/api_client/api_objects/runtime.rb +3 -0
- data/lib/renstar/api_client/api_objects/sensor.rb +3 -0
- data/lib/renstar/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e0023780425b4b2d649ffaaf881630adb1485a8c54e58934f69c31ba4953bd5
|
4
|
+
data.tar.gz: ebbef10e2b31c0c51aa5de4c8b02b82ec6f5d29be6d4526f4ec15c5cbdffde62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d36ebe45f2767dc4ed9f45f1299828004985fffe6c790913e5a1fad386ba23a59fd25347bb746ce0a2f9d8a88a448c952bfa707d77cfed9522e131477fc6f968
|
7
|
+
data.tar.gz: 4ae3c1982c6df2f82e05f45410002259df1a8c21113039dc4d9d4b2484819d432e2584109eb72683a3684e46d55519fe79b3342047904a32c68c7dae5c97db9f
|
data/README.md
CHANGED
@@ -20,13 +20,69 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install renstar
|
22
22
|
|
23
|
-
##
|
23
|
+
## Using the included binary
|
24
|
+
|
25
|
+
When installing the gem, we install `renstar.rb` for you automatically. You can
|
26
|
+
pass the `-h` flag for more info.
|
27
|
+
|
28
|
+
The help page does not list all the accepted commands or their values but all of
|
29
|
+
the methods below are supported. The binary just passes your arguments to the
|
30
|
+
methods below.
|
31
|
+
|
32
|
+
So, if you want to cool your house to 72 using the binary, you can do this:
|
33
|
+
```ruby
|
34
|
+
renstar.rb cool 72
|
35
|
+
```
|
36
|
+
|
37
|
+
You can apply the logic above to any of the methods below for the same effect.
|
38
|
+
|
39
|
+
The binary chooses the first thermostat it finds on the network, so you may get
|
40
|
+
unexpected results if you have more than one on your network. I do plan on
|
41
|
+
improving this.
|
42
|
+
|
43
|
+
You may have trouble with discovery on multi-homed hosts, but I'm working with
|
44
|
+
the author of the `ssdp` library to fix this, so I expect it to improve. You can
|
45
|
+
install my fork of `ssdp` from github if you need multi-homed support now.
|
46
|
+
|
47
|
+
## Using the library
|
48
|
+
|
49
|
+
First we need to create a `Thermostat` object.
|
24
50
|
|
25
51
|
* Search for thermostats on the LAN, return the first one found:
|
26
52
|
```ruby
|
27
53
|
thermo = Renstar::Thermostat.search.first
|
28
54
|
```
|
29
55
|
|
56
|
+
### Query
|
57
|
+
|
58
|
+
These methods let you see the thermostat info (controls and settings status), sensor info, runtimes, and
|
59
|
+
alerts.
|
60
|
+
|
61
|
+
* Get information about the thermostat:
|
62
|
+
```ruby
|
63
|
+
thermo.info
|
64
|
+
```
|
65
|
+
|
66
|
+
* Get the current sensors and their readings:
|
67
|
+
```ruby
|
68
|
+
thermo.sensors
|
69
|
+
```
|
70
|
+
|
71
|
+
* Get runtimes:
|
72
|
+
```ruby
|
73
|
+
thermo.runtimes
|
74
|
+
```
|
75
|
+
|
76
|
+
* See alerts and their status:
|
77
|
+
```ruby
|
78
|
+
thermo.alerts
|
79
|
+
|
80
|
+
|
81
|
+
### Control
|
82
|
+
|
83
|
+
These methods let you control the thermostat temperature controls, and fan. You
|
84
|
+
can use the `info` method to check the current state of these controls.
|
85
|
+
|
30
86
|
* Heat to 80 degrees:
|
31
87
|
```ruby
|
32
88
|
thermo.heat(80)
|
@@ -42,7 +98,7 @@ thermo.cool(60)
|
|
42
98
|
thermo.auto(70, 74)
|
43
99
|
```
|
44
100
|
|
45
|
-
* Turn off
|
101
|
+
* Turn off heating and/or cooling
|
46
102
|
```ruby
|
47
103
|
thermo.off
|
48
104
|
```
|
@@ -56,7 +112,13 @@ thermo.fan_off
|
|
56
112
|
thermo.fan_toggle
|
57
113
|
```
|
58
114
|
|
59
|
-
|
115
|
+
### Settings
|
116
|
+
|
117
|
+
These methods let you change the schedule and vacation settings on your
|
118
|
+
thermostat. You can use the `info` method to check the current state of the
|
119
|
+
settings.
|
120
|
+
|
121
|
+
* Set the schedule:
|
60
122
|
```ruby
|
61
123
|
thermo.schedule_on
|
62
124
|
|
@@ -72,8 +134,6 @@ thermo.home
|
|
72
134
|
thermo.away
|
73
135
|
```
|
74
136
|
|
75
|
-
|
76
|
-
|
77
137
|
## Development
|
78
138
|
|
79
139
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/bin/renstar.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'renstar'
|
2
2
|
require 'optparse'
|
3
3
|
require 'ostruct'
|
4
|
+
require 'pry'
|
4
5
|
|
5
6
|
options = {}
|
6
7
|
|
@@ -38,5 +39,13 @@ thermos.each do |thermo|
|
|
38
39
|
end
|
39
40
|
puts "Using: " + thermos.first.location + " - " + thermos.first.usn
|
40
41
|
unless (ARGV.nil? || ARGV.empty?)
|
41
|
-
|
42
|
+
response = thermos.first.send(*ARGV)
|
43
|
+
case response
|
44
|
+
when String
|
45
|
+
puts response
|
46
|
+
when Renstar::APIClient::APIObject
|
47
|
+
response.pp
|
48
|
+
when Array
|
49
|
+
response.each {|x| x.pp }
|
50
|
+
end
|
42
51
|
end
|
@@ -23,18 +23,15 @@ module Renstar
|
|
23
23
|
@raw_hash
|
24
24
|
end
|
25
25
|
|
26
|
-
def human_readable
|
26
|
+
def human_readable(type)
|
27
27
|
@raw_hash.map do |key, value|
|
28
|
-
description = APIClient.key_to_description(
|
29
|
-
formatted_value = APIClient.value_to_formatted(
|
28
|
+
description = APIClient.key_to_description(type, key)
|
29
|
+
formatted_value = APIClient.value_to_formatted(type, key, value)
|
30
30
|
format("%-35<description>s %<formatted_value>s\n",
|
31
31
|
{ description: description, formatted_value: formatted_value })
|
32
32
|
end.join
|
33
33
|
end
|
34
34
|
|
35
|
-
def pp
|
36
|
-
puts human_readable
|
37
|
-
end
|
38
35
|
end
|
39
36
|
end
|
40
37
|
end
|
data/lib/renstar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renstar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Rodrigues
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.2.
|
94
|
+
rubygems_version: 3.2.33
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: Control Venstar thermostats.
|