diff --git a/commands/implemented/command_lights_rgb_color.py b/commands/implemented/command_lights_rgb_color.py index bc5b6d4..4d743ee 100644 --- a/commands/implemented/command_lights_rgb_color.py +++ b/commands/implemented/command_lights_rgb_color.py @@ -34,11 +34,24 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta): LightModule.bridge_.set_group(16, "xy", xy_result) print("sent color") else: - print("\nColor Command!") - xy_result = LightModule.color_string_parser(tempParsedMessage) - print("got XY") - LightModule.bridge_.set_group(16, "xy", xy_result) - print("sent color") + if "stream" in tempParsedMessage: + LightModule.bridge_.run_scene("Downstairs", "Stream") + elif ("normal" or "regular" or "bright" or "daylight") in tempParsedMessage: + LightModule.bridge_.run_scene("Downstairs", "Bright") + elif ("haxor") in tempParsedMessage: + LightModule.bridge_.run_scene("Downstairs", "hacker vibes") + elif "off" in tempParsedMessage: + LightModule.bridge_.set_group("Downstairs", "on", False) + elif "on" in tempParsedMessage: + LightModule.bridge_.set_group("Downstairs", "on", True) + elif "ravemode" in tempParsedMessage: + LightModule.raveMode() + else: + print("\nColor Command!") + xy_result = LightModule.color_string_parser(tempParsedMessage) + print("got XY") + LightModule.bridge_.set_group(16, "xy", xy_result) + print("sent color") returnMessage = "@" + twitch_message.sender + " changed the light's color!" bot.send_message(returnMessage) \ No newline at end of file diff --git a/lights_module.py b/lights_module.py index e5fe489..63a366b 100644 --- a/lights_module.py +++ b/lights_module.py @@ -79,6 +79,16 @@ class Lights_Module(): def setGroups(): pass + def raveMode(self): + for rave in range(30): + rgb_r = random.random() + rgb_g = random.random() + rgb_b = random.random() + xy_result = self.rgb_to_xy(rgb_r, rgb_g, rgb_b) #This will take an rgb value and make it xy + self.bridge_.set_group(16, "xy", xy_result) + sleep(0.3) + self.bridge_.run_scene("Downstairs", "Stream") + def rgb_to_xy(self, red, green, blue): """ conversion of RGB colors to CIE1931 XY colors Formulas implemented from: https://gist.github.com/popcorn245/30afa0f98eea1c2fd34d @@ -122,6 +132,13 @@ class Lights_Module(): print("found: green") xy_color = self.rgb_to_xy(0,1,0) + if "yellow" in text.lower(): + print("found: yellow") + xy_color = self.rgb_to_xy( + 0.7, + 0.64, + 0) + if "cyan" in text.lower(): print("found: cyan") @@ -132,7 +149,6 @@ class Lights_Module(): round(utilities.rescale_value(111,0,254),maxDigits), round(utilities.rescale_value(218,0,254),maxDigits), round(utilities.rescale_value(146,0,254),maxDigits)) - if "turquoise" in text.lower(): print("found: turquoise") xy_color = self.rgb_to_xy( @@ -147,6 +163,28 @@ class Lights_Module(): round(utilities.rescale_value(126,0,254),maxDigits), 0) + + if "magenta" in text.lower(): + print("found: magenta") + xy_color = self.rgb_to_xy( + 1, + 0, + 1) + + if "purple" in text.lower(): + print("found: purple") + xy_color = self.rgb_to_xy( + round(utilities.rescale_value(159,0,254),maxDigits), + round(utilities.rescale_value(32,0,254),maxDigits), + round(utilities.rescale_value(239,0,254),maxDigits)) + + if "violet" in text.lower(): + print("found: violet") + xy_color = self.rgb_to_xy( + round(utilities.rescale_value(237,0,254),maxDigits), + round(utilities.rescale_value(129,0,254),maxDigits), + round(utilities.rescale_value(237,0,254),maxDigits)) + return xy_color @@ -158,4 +196,5 @@ if __name__ == "__main__": #testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname) #testModule.discordCredential = credentials_manager.find_Discord_Credential(config.credentialsNickname) - testModule.main() \ No newline at end of file + testModule.main() + testModule.raveMode() \ No newline at end of file