alexa_hue 1.1.9 → 1.1.10
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/lib/alexa_hue.rb +23 -29
- data/lib/alexa_hue/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1e651f32e10079e88cb2c5cdaf964db2794716e
|
4
|
+
data.tar.gz: 02362df73c6f82fa546239426a1445790918fb66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61011accd70997d59ae4d3ca114107525b15a918194dc0f5bcf42cfca92793c7d06d1953dacd6ef7c7bcd7acd263a4b82d8c7170d11e195718690da82f14e8f9
|
7
|
+
data.tar.gz: 53ace5796d690a500fcebcd477743bf207e9bfe5414417dea0d5a6e6293a8d82eabcc2c678c49c0417116379ff5ab75423719137014f2c2b97630cd7ab50a681
|
data/lib/alexa_hue.rb
CHANGED
@@ -11,10 +11,8 @@ require 'alexa_hue/hue/voice_parser'
|
|
11
11
|
require 'alexa_hue/hue/helpers'
|
12
12
|
require 'chronic_duration'
|
13
13
|
|
14
|
-
|
15
14
|
LEVELS = {} ; [*1..10].each { |t| LEVELS[t.to_s ] = t.in_words }
|
16
15
|
|
17
|
-
|
18
16
|
module Hue
|
19
17
|
include Hue::Helpers
|
20
18
|
extend Sinatra::Extension
|
@@ -25,35 +23,32 @@ module Hue
|
|
25
23
|
end
|
26
24
|
|
27
25
|
def control_lights
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
if @echo_request.slots.saturation
|
33
|
-
LEVELS.keys.reverse_each { |level| @echo_request.slots.saturation.sub!(level, LEVELS[level]) } if @echo_request.slots.schedule.nil?
|
34
|
-
end
|
26
|
+
Thread.start do
|
27
|
+
[:brightness, :saturation].each do |attribute|
|
28
|
+
LEVELS.keys.reverse_each { |level| @echo_request.slots.send(attribute).sub!(level, LEVELS[level]) } if @echo_request.slots.send(attribute) && @echo_request.slots.schedule.nil?
|
29
|
+
end
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
31
|
+
@echo_request.slots.to_h.each do |k,v|
|
32
|
+
@string ||= ""
|
33
|
+
next unless v
|
34
|
+
if k == :scene || k == :alert
|
35
|
+
@string << "#{v.to_s} #{k.to_s} "
|
36
|
+
elsif k == :lights || k == :modifier || k == :state
|
37
|
+
@string << "#{v.to_s} "
|
38
|
+
elsif k == :savescene
|
39
|
+
@string << "save scene as #{v.to_s} "
|
40
|
+
elsif k == :flash
|
41
|
+
@string << "start long alert "
|
42
|
+
else
|
43
|
+
@string << "#{k.to_s} #{v.to_s} "
|
44
|
+
end
|
49
45
|
end
|
50
|
-
end
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
fix_schedule_syntax(@string)
|
48
|
+
@string.sub!("color loop", "colorloop")
|
49
|
+
@string.strip!
|
50
|
+
switch.voice @string
|
51
|
+
end
|
57
52
|
|
58
53
|
# if @echo_request.slots.lights.nil? && @echo_request.slots.scene.nil? && @echo_request.slots.savescene.nil?
|
59
54
|
# halt AlexaObjects::Response.new(end_session: false, spoken_response: "Please specify which light or lights you'd like to adjust. I'm ready to control the lights.").to_json
|
@@ -86,7 +81,6 @@ module Hue
|
|
86
81
|
# halt r.without_card.to_json
|
87
82
|
# end
|
88
83
|
#end
|
89
|
-
Thread.start { switch.voice @string }
|
90
84
|
|
91
85
|
return AlexaObjects::Response.new(spoken_response: "okay").to_json
|
92
86
|
end
|
data/lib/alexa_hue/version.rb
CHANGED