module Hue
Constants
- VERSION
Public Class Methods
custom_slots()
click to toggle source
# File lib/alexa_hue/custom_slots.rb, line 3 def self.custom_slots client = Hue::Client.new slots = "LIGHTS" client.instance_variable_get("@lights").keys.each {|x| slots << "\n#{x} light"} client.instance_variable_get("@groups").keys.each {|x| slots << "\n#{x} lights"} slots << "\n\nSCENE" client.instance_variable_get("@scenes").keys.each {|x| slots << "\n#{x}"} slots << "\n" slots << File.read(File.expand_path('../../../skills_config/custom_slots.txt', __FILE__)) slots end
intent_schema()
click to toggle source
# File lib/alexa_hue/intent_schema.rb, line 2 def self.intent_schema File.read(File.expand_path('../../../skills_config/intent_schema.txt', __FILE__)) end
sample_utterances()
click to toggle source
# File lib/alexa_hue/sample_utterances.rb, line 2 def self.sample_utterances File.read(File.expand_path('../../../skills_config/sample_utterances.txt', __FILE__)) end
Public Instance Methods
control_lights()
click to toggle source
# File lib/alexa_hue.rb, line 19 def control_lights Thread.start do [:brightness, :saturation].each { |attribute| @echo_request.slots.send("#{attribute}=", @echo_request.slots.send(attribute)&.to_i) unless @echo_request.slots.schedule } voice_parser.run @echo_request end if (@echo_request.slots.lights.nil? && @echo_request.slots.scene.nil? && @echo_request.slots.savescene.nil?) || (@echo_request.slots.lights && @echo_request.slots.lights.scan(/light|lights/).empty?) 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 end return AlexaObjects::Response.new(spoken_response: "okay").to_json end
voice_parser()
click to toggle source
# File lib/alexa_hue.rb, line 15 def voice_parser Hue::VoiceParser.instance end