hue_switch 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71118f28167bd6ca48882186c602645ec1135e03
4
- data.tar.gz: b8f1ce3f43b8a2f77563fd5859c03973fe4435fd
3
+ metadata.gz: dc73a1c86510dc51fd64bbaa2ed0adbd6c90b12d
4
+ data.tar.gz: d4847f737495d0bcf86ca1ddc996a59f60c13c79
5
5
  SHA512:
6
- metadata.gz: 3fd0ff508760d89656f0c24b95df11b0cb08101754fb647a9b8038d31dbac2ae017a027d23b8608275ace5309b0fa3b98674e8cec8c3a69f0a4c90476e331bd4
7
- data.tar.gz: 74de57fffc30b3f6384961c0d85bc48d2126a6fbe14bb60bb5b1233875e5dedb984450a5e86d5cb2b75a62b8b66d05385e3a0f7e08c594851b3538eabc50a13d
6
+ metadata.gz: 5acb073efe02cd60629fa8c3f09b0f27115597bf205145cf49a5a78668b65cc72287b082dab79954936d4e3959f717a83caf4a5778a0bef8b7130ece3742a963
7
+ data.tar.gz: b5630d83d8b24adc5d35a4cd957f19349654d8dcad347b527b33cd121e639fb7518bcbcb46d7912f7fb37909eb58ba8be16fb5e09c5d401705d79b20757b4fbc
data/README.md CHANGED
@@ -11,11 +11,13 @@ And then execute:
11
11
  Or install it yourself as:
12
12
 
13
13
  $ gem install hue_switch
14
+
15
+ #####Note: There are significant changes between .9 versions and 1.0.0. Some basic commands work slightly differently. Random Colors have been removed. Verion 1.0.0 includes a new method, .voice, that allows most Switch methods to be passed as a string. Please see updated README.
14
16
 
15
17
  ## Usage
16
18
  A Hue Switch is designed control Hue lights, groups, and scenes. You can schedule a Switch. You can save a Switch as a Hue Scene on the bridge.
17
19
 
18
- NOTE: The first time you run this gem, you'll need to press the link button on the bridge immediately beforehand. If you don't, you'll get an error telling you to do so and try again. You need to be logged into
20
+ NOTE: The first time you run this gem, you'll need to press the link button on the bridge immediately beforehand. If you don't, you'll get an error telling you to do so and try again.
19
21
 
20
22
  Why is this different from other wrappers?
21
23
 
@@ -109,15 +111,6 @@ switch.schedule :off, "in three minutes" # "tomorrow", "next week"
109
111
  ```ruby
110
112
  switch.delete_schedules!
111
113
  ```
112
-
113
- ###Save Switch as a Hue Scene
114
-
115
- The scene will be assigned to the group the switch is currently controlling (or all the lights if a group hasn't been assigned to the switch.)
116
-
117
- All features of the Switch (fade, group, color, etc) will be saved in the scene attributes.
118
- ```ruby
119
- switch.save_scene "my switch"
120
- ```
121
114
  ###Dynamic Effects:
122
115
  ```ruby
123
116
  switch.colorloop # to cycle through colors
@@ -174,7 +167,7 @@ switch.voice "schedule purple paradise scene thursday evening at eight forty fiv
174
167
  ###Dynamic Effects:
175
168
  ```ruby
176
169
  "living room lights short alert" [flash lights in the group once]
177
- "short alert table light" [flash light for 30 seconds]
170
+ "long alert table light" [flash light for 30 seconds]
178
171
  "brightness five fireplace lights start colorloop"
179
172
  "fireplace lights stop colorloop"
180
173
  ```
data/hue_switch.gemspec CHANGED
@@ -24,7 +24,8 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'chronic', '~> 0.10.0'
25
25
  spec.add_dependency 'chronic_duration', '~> 0'
26
26
  spec.add_dependency 'httparty', '~> 0.13.0'
27
+ spec.add_dependency 'numbers_in_words', '~> 0.2.0'
27
28
  spec.add_development_dependency "bundler", "~> 1.9"
28
29
  spec.add_development_dependency "rake", "~> 10.0"
29
- spec.add_development_dependency 'rspec', '~> 0'
30
+ spec.add_development_dependency 'rspec', '~> 2.4.0'
30
31
  end
@@ -1,3 +1,3 @@
1
1
  module HueSwitch
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/hue_switch.rb CHANGED
@@ -71,14 +71,12 @@ class Switch
71
71
  self.body.delete(:groups)
72
72
  self.body.delete(:scene)
73
73
  args.each { |l| self.lights_array.push @lights[l.to_s] if @lights.keys.include?(l.to_s) }
74
- #self.send("on") if !self.command.include?("schedule")
75
74
  end
76
75
 
77
76
  def lights(group_name)
78
77
  self.lights_array = []
79
78
  self.body.delete(:scene)
80
79
  self._group = @groups[group_name.to_s]
81
- #self.send("on") if !self.command.include?("schedule")
82
80
  end
83
81
 
84
82
  def scene(scene_name)
@@ -88,20 +86,17 @@ class Switch
88
86
  self.body.delete(:hue)
89
87
  self.body.delete(:ct)
90
88
  self.body[:scene] = scene_name.to_s
91
- #self.send("on") if !self.command.include?("schedule")
92
89
  end
93
90
 
94
- def save_scene(name)
91
+ def save_scene(scene_name)
95
92
  self.fade 2 if self.body[:transitiontime] == nil
96
93
  if self._group.nil?
97
94
  light_group = HTTParty.get("http://#{@ip}/api/#{@user}/groups/0")["lights"]
98
95
  else
99
96
  light_group = HTTParty.get("http://#{@ip}/api/#{@user}/groups/#{self._group}")["lights"]
100
97
  end
101
- scene_name = name
102
98
  scene_name.gsub!(' ','-')
103
99
  params = {name: scene_name, lights: light_group, transitiontime: self.body[:transitiontime]}
104
- p params
105
100
  response = HTTParty.put("http://#{@ip}/api/#{@user}/scenes/#{scene_name}", :body => params.to_json)
106
101
  if response.first.keys[0] == "success"
107
102
  puts "Scene created!"
@@ -307,6 +302,6 @@ class Switch
307
302
  end
308
303
  self.send("schedule", string)
309
304
  end
310
- self.send("on") unless string.include?(" off") && !string.include?("schedule")
305
+ self.send("on") if !command.include?(" off") && !command.include?("schedule")
311
306
  end
312
307
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hue_switch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sarkonovich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-07 00:00:00.000000000 Z
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.13.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: numbers_in_words
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.2.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.2.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '0'
103
+ version: 2.4.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '0'
110
+ version: 2.4.0
97
111
  description: A 'switch' controls Hue lights, groups, or scenes. Switches can be scheduled,
98
112
  and given dynamic effects.
99
113
  email: