<commit_before># Description
#   Control your Hue lights for meeting mode.
#
# Configuration:
#   PHILIPS_HUE_HASH - Secret hash for your user
#   PHILIPS_HUE_IP - IP or hostname of your Hue bridge
#
# Commands:
#   hubot meeting - Activate meeting mode
#   hubot free - End meeting mode
#   hubot disco - Have a bit of fun with the lights
#
# Author:
#   <NAME> <<EMAIL>>

hue = require('node-hue-api')
HueApi = hue.HueApi
lightState = hue.lightState

module.exports = (robot) ->
  base_url = process.env.PHILIPS_HUE_IP
  hash  = process.env.PHILIPS_HUE_HASH
  api = new HueApi(base_url, hash)
  state = lightState.create()

  # Define the various colors and modes
  meetingColor = lightState.create().on(true).hue(6144).sat(255).bri(255)
  freeColor = lightState.create().on(true).hue(0).sat(255).bri(255)
  partyMode = lightState.create().effect('colorloop')
  backToWork = lightState.create().effect('none')

  robot.respond /meeting$/i, (res) ->
    res.reply "Setting lights to meeting mode ..."
    api.setGroupLightState 'all', meetingColor, (err, status) ->
      return handleError msg, err if err
      robot.logger.debug status

  robot.respond /free$/i, (res) ->
    res.reply "Setting lights back to white ..."
    api.setGroupLightState 'all', meetingColor, (err, status) ->
      return handleError msg, err if err
      robot.logger.debug status

  robot.respond /(?:disco|party) (on|off)$/i, (res) ->
    [loop_status] = msg.match[1]
    res.reply ":tada: Party mode activated! :tada:"
    if loop_status == 'on'
      api.setGroupLightState 'all', partyMode, (err, status) ->
        return handleError msg, err if err
        robot.logger.debug status
    else
      res.reply 'Getting back to work now.'
      api.setGroupLightState 'all', backToWork, (err, status) ->
        return handleError msg, err if err
        robot.logger.debug status

  handleError = (msg, err) ->
    msg.send err<commit_msg>Fix broken things<commit_after># Description
#   Control your Hue lights for meeting mode.
#
# Configuration:
#   PHILIPS_HUE_HASH - Secret hash for your user
#   PHILIPS_HUE_IP - IP or hostname of your Hue bridge
#
# Commands:
#   hubot meeting - Activate meeting mode
#   hubot free - End meeting mode
#   hubot disco - Have a bit of fun with the lights
#
# Author:
#   <NAME> <<EMAIL>>

hue = require('node-hue-api')
HueApi = hue.HueApi
lightState = hue.lightState

module.exports = (robot) ->
  base_url = process.env.PHILIPS_HUE_IP
  hash  = process.env.PHILIPS_HUE_HASH
  api = new HueApi(base_url, hash)
  state = lightState.create()

  # Define the various colors and modes
  meetingColor = lightState.create().on(true).hue(6144).sat(255).bri(255)
  freeColor = lightState.create().on(true).hue(0).sat(0).bri(255)
  partyMode = lightState.create().sat(255).effect('colorloop').alert('lselect')
  backToWork = lightState.create().sat(0).effect('none').alert('none')

  robot.respond /meeting$/i, (res) ->
    res.reply "Setting lights to meeting mode ..."
    api.setGroupLightState '0', meetingColor, (err, status) ->
      return handleError res, err if err
      robot.logger.debug status

  robot.respond /free$/i, (res) ->
    res.reply "Setting lights back to white ..."
    api.setGroupLightState '0', freeColor, (err, status) ->
      return handleError res, err if err
      robot.logger.debug status

  robot.respond /(?:disco|party) (on|off)$/i, (res) ->
    loop_status = res.match[1]
    if loop_status == 'on'
      res.reply ":tada: Party mode activated! :tada:"
      api.setGroupLightState '0', partyMode, (err, status) ->
        return handleError res, err if err
        robot.logger.debug status
    else
      res.reply 'Getting back to work now.'
      api.setGroupLightState '0', backToWork, (err, status) ->
        return handleError res, err if err
        robot.logger.debug status

  handleError = (res, err) ->
    robot.logger.error err
    res.send err
{'fraction_non_alphanumeric': 0.12764871074802145, 'fraction_numerical': 0.010722491702833802, 'mean_word_length': 3.254071661237785, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6502546', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1300, 'n_words': 357}