Control Your Bulbs from Lita
You’re finally ready to control your bulbs using Lita. Open the auto-generated hue_lightswitch.rb file. You’ll fill this in with chat routes and handler methods that call out to the HueColoredBulb class. But first, you need to set up a :hue_bulb_name configuration variable so Lita end users can tell this skill the name of the local bulb they want to control through chat. You also need a :light method that serves as a reusable handle to a HueColoredBulb object with a connection to the specified named bulb:
| module Lita |
| module Handlers |
| class HueLightswitch < Handler |
| |
| # Set these in your bot's lita_config.rb |
| config :hue_bulb_name, default: ... |
Get Build Chatbot Interactions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.