renstar 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +63 -6
- data/bin/renstar.rb +9 -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
- data/renstar.gemspec +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ec00844bc41728ecfd92760ee41fc4d46a5f3f774f8dc0cbc775d24ead73c5a
|
4
|
+
data.tar.gz: 927825f1c773ed6f39f04a01a186b560e62d8251b980509b1d0115b3aebbbd80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec1ba6a7196d85a096ebefb15939a7067ced4ae09247b7c897b68021acb72bc40e113584445da2482f1b65607bdc49fd2cd7c09e4e0cc5c28f0eabb70403c76
|
7
|
+
data.tar.gz: d466accc4a177cd0b7e0c739aa76e4d5d93f1f6c81707183e6bfed5e13caef56c0c3fe1f02b097df34177105306afe5e8041bf8284994ca66b93b1470bbbb133
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,13 +20,66 @@ 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
|
+
### Note about thermostat selection
|
40
|
+
The binary chooses the first thermostat it finds on the network, so you may get
|
41
|
+
unexpected results if you have more than one on your network. I do plan on
|
42
|
+
improving this.
|
43
|
+
|
44
|
+
## Using the library
|
45
|
+
|
46
|
+
First we need to create a `Thermostat` object.
|
24
47
|
|
25
48
|
* Search for thermostats on the LAN, return the first one found:
|
26
49
|
```ruby
|
27
50
|
thermo = Renstar::Thermostat.search.first
|
28
51
|
```
|
29
52
|
|
53
|
+
### Query
|
54
|
+
|
55
|
+
These methods let you see the thermostat info (controls and settings status), sensor info, runtimes, and
|
56
|
+
alerts.
|
57
|
+
|
58
|
+
* Get information about the thermostat:
|
59
|
+
```ruby
|
60
|
+
thermo.info
|
61
|
+
```
|
62
|
+
|
63
|
+
* Get the current sensors and their readings:
|
64
|
+
```ruby
|
65
|
+
thermo.sensors
|
66
|
+
```
|
67
|
+
|
68
|
+
* Get runtimes:
|
69
|
+
```ruby
|
70
|
+
thermo.runtimes
|
71
|
+
```
|
72
|
+
|
73
|
+
* See alerts and their status:
|
74
|
+
```ruby
|
75
|
+
thermo.alerts
|
76
|
+
```
|
77
|
+
|
78
|
+
### Control
|
79
|
+
|
80
|
+
These methods let you control the thermostat temperature controls, and fan. You
|
81
|
+
can use the `info` method to check the current state of these controls.
|
82
|
+
|
30
83
|
* Heat to 80 degrees:
|
31
84
|
```ruby
|
32
85
|
thermo.heat(80)
|
@@ -42,7 +95,7 @@ thermo.cool(60)
|
|
42
95
|
thermo.auto(70, 74)
|
43
96
|
```
|
44
97
|
|
45
|
-
* Turn off
|
98
|
+
* Turn off heating and/or cooling
|
46
99
|
```ruby
|
47
100
|
thermo.off
|
48
101
|
```
|
@@ -56,11 +109,17 @@ thermo.fan_off
|
|
56
109
|
thermo.fan_toggle
|
57
110
|
```
|
58
111
|
|
59
|
-
|
112
|
+
### Settings
|
113
|
+
|
114
|
+
These methods let you change the schedule and vacation settings on your
|
115
|
+
thermostat. You can use the `info` method to check the current state of the
|
116
|
+
settings.
|
117
|
+
|
118
|
+
* Set the schedule:
|
60
119
|
```ruby
|
61
120
|
thermo.schedule_on
|
62
121
|
|
63
|
-
thermo.
|
122
|
+
thermo.schedule_off
|
64
123
|
|
65
124
|
thermo.schedule_toggle
|
66
125
|
```
|
@@ -72,8 +131,6 @@ thermo.home
|
|
72
131
|
thermo.away
|
73
132
|
```
|
74
133
|
|
75
|
-
|
76
|
-
|
77
134
|
## Development
|
78
135
|
|
79
136
|
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
@@ -39,5 +39,13 @@ thermos.each do |thermo|
|
|
39
39
|
end
|
40
40
|
puts "Using: " + thermos.first.location + " - " + thermos.first.usn
|
41
41
|
unless (ARGV.nil? || ARGV.empty?)
|
42
|
-
|
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
|
43
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
data/renstar.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
31
|
spec.add_runtime_dependency 'json'
|
32
|
-
|
32
|
+
spec.add_runtime_dependency 'ssdp', '~> 1.2.0'
|
33
33
|
|
34
34
|
# Uncomment to register a new dependency of your gem
|
35
35
|
# spec.add_dependency "example-gem", "~> 1.0"
|
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.1
|
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
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ssdp
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.0
|
27
41
|
description: Control Venstar thermostats with Ruby via their local API.
|
28
42
|
email:
|
29
43
|
- mikebrodrigues@gmail.com
|
@@ -77,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
91
|
- !ruby/object:Gem::Version
|
78
92
|
version: '0'
|
79
93
|
requirements: []
|
80
|
-
rubygems_version: 3.2.
|
94
|
+
rubygems_version: 3.2.33
|
81
95
|
signing_key:
|
82
96
|
specification_version: 4
|
83
97
|
summary: Control Venstar thermostats.
|