renstar 0.2.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 395939a21c7674830297c4b637980c6b0ef8dd5a368ac9c7f22046e8acd30f8d
4
- data.tar.gz: 76fcd3f4913478ca1993f8b0b9acfd27ab420f23005f55803a98955d5b196a5a
3
+ metadata.gz: 5ec00844bc41728ecfd92760ee41fc4d46a5f3f774f8dc0cbc775d24ead73c5a
4
+ data.tar.gz: 927825f1c773ed6f39f04a01a186b560e62d8251b980509b1d0115b3aebbbd80
5
5
  SHA512:
6
- metadata.gz: 85342777ce38973500afc97c66c059c3b8b0e6b023367902d2271b3ece751a2f40c9840fc44e27c792fdf08a86f41467494e07aecc86dfbaa481b6cf471fd2c5
7
- data.tar.gz: a30e766bb836c2e682f3f4b4499d8e77aea7cb7cb90e1ac44c8a61398df9e0657223b7e136ccf27cc8512bace3cec41e80e7f238247f6576774b414503194bbb
6
+ metadata.gz: 0ec1ba6a7196d85a096ebefb15939a7067ced4ae09247b7c897b68021acb72bc40e113584445da2482f1b65607bdc49fd2cd7c09e4e0cc5c28f0eabb70403c76
7
+ data.tar.gz: d466accc4a177cd0b7e0c739aa76e4d5d93f1f6c81707183e6bfed5e13caef56c0c3fe1f02b097df34177105306afe5e8041bf8284994ca66b93b1470bbbb133
data/Gemfile CHANGED
@@ -6,4 +6,3 @@ source 'https://rubygems.org'
6
6
  gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
- gem 'ssdp', git: 'https://github.com/mikerodrigues/ssdp'
data/README.md CHANGED
@@ -20,13 +20,66 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install renstar
22
22
 
23
- ## Usage
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 heeating and/or cooling
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
- * Control the schedule:
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.scheduel_off
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
- puts thermos.first.send(*ARGV)
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('runtimes', key)
29
- formatted_value = APIClient.value_to_formatted('runtimes', key, value)
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
@@ -8,6 +8,9 @@ module Renstar
8
8
  # These alerts are for Air filter, Service, and UV Lamp
9
9
  #
10
10
  class Alert < APIObject
11
+ def pp
12
+ puts human_readable('alerts')
13
+ end
11
14
  end
12
15
  end
13
16
  end
@@ -9,6 +9,9 @@ module Renstar
9
9
  # info response from the API for clean access.
10
10
  #
11
11
  class Info < APIObject
12
+ def pp
13
+ puts human_readable('info')
14
+ end
12
15
  end
13
16
  end
14
17
  end
@@ -8,6 +8,9 @@ module Renstar
8
8
  # Breaks down how much time the system spent in various states
9
9
  # like heating or cooling.
10
10
  class Runtime < APIObject
11
+ def pp
12
+ puts human_readable('runtimes')
13
+ end
11
14
  end
12
15
  end
13
16
  end
@@ -7,6 +7,9 @@ module Renstar
7
7
  # Represents an installed sensor in the system
8
8
  # Returns the value of the sensor
9
9
  class Sensor < APIObject
10
+ def pp
11
+ puts human_readable('sensors')
12
+ end
10
13
  end
11
14
  end
12
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renstar
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.1'
5
5
  end
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
- # spec.add_runtime_dependency 'ssdp'
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.2.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-06 00:00:00.000000000 Z
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.22
94
+ rubygems_version: 3.2.33
81
95
  signing_key:
82
96
  specification_version: 4
83
97
  summary: Control Venstar thermostats.