More Lights
This commit is contained in:
parent
84b36622b3
commit
505860fe59
@ -34,11 +34,24 @@ class CommandRoll(AbstractCommand, metaclass=ABCMeta):
|
|||||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
LightModule.bridge_.set_group(16, "xy", xy_result)
|
||||||
print("sent color")
|
print("sent color")
|
||||||
else:
|
else:
|
||||||
print("\nColor Command!")
|
if "stream" in tempParsedMessage:
|
||||||
xy_result = LightModule.color_string_parser(tempParsedMessage)
|
LightModule.bridge_.run_scene("Downstairs", "Stream")
|
||||||
print("got XY")
|
elif ("normal" or "regular" or "bright" or "daylight") in tempParsedMessage:
|
||||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
LightModule.bridge_.run_scene("Downstairs", "Bright")
|
||||||
print("sent color")
|
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!"
|
returnMessage = "@" + twitch_message.sender + " changed the light's color!"
|
||||||
bot.send_message(returnMessage)
|
bot.send_message(returnMessage)
|
||||||
@ -79,6 +79,16 @@ class Lights_Module():
|
|||||||
def setGroups():
|
def setGroups():
|
||||||
pass
|
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):
|
def rgb_to_xy(self, red, green, blue):
|
||||||
""" conversion of RGB colors to CIE1931 XY colors
|
""" conversion of RGB colors to CIE1931 XY colors
|
||||||
Formulas implemented from: https://gist.github.com/popcorn245/30afa0f98eea1c2fd34d
|
Formulas implemented from: https://gist.github.com/popcorn245/30afa0f98eea1c2fd34d
|
||||||
@ -122,6 +132,13 @@ class Lights_Module():
|
|||||||
print("found: green")
|
print("found: green")
|
||||||
xy_color = self.rgb_to_xy(0,1,0)
|
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():
|
if "cyan" in text.lower():
|
||||||
print("found: cyan")
|
print("found: cyan")
|
||||||
@ -132,7 +149,6 @@ class Lights_Module():
|
|||||||
round(utilities.rescale_value(111,0,254),maxDigits),
|
round(utilities.rescale_value(111,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(218,0,254),maxDigits),
|
round(utilities.rescale_value(218,0,254),maxDigits),
|
||||||
round(utilities.rescale_value(146,0,254),maxDigits))
|
round(utilities.rescale_value(146,0,254),maxDigits))
|
||||||
|
|
||||||
if "turquoise" in text.lower():
|
if "turquoise" in text.lower():
|
||||||
print("found: turquoise")
|
print("found: turquoise")
|
||||||
xy_color = self.rgb_to_xy(
|
xy_color = self.rgb_to_xy(
|
||||||
@ -147,6 +163,28 @@ class Lights_Module():
|
|||||||
round(utilities.rescale_value(126,0,254),maxDigits),
|
round(utilities.rescale_value(126,0,254),maxDigits),
|
||||||
0)
|
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
|
return xy_color
|
||||||
|
|
||||||
|
|
||||||
@ -158,4 +196,5 @@ if __name__ == "__main__":
|
|||||||
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
#testModule.discordCredential = credentials_manager.find_Discord_Credential(config.credentialsNickname)
|
#testModule.discordCredential = credentials_manager.find_Discord_Credential(config.credentialsNickname)
|
||||||
|
|
||||||
testModule.main()
|
testModule.main()
|
||||||
|
testModule.raveMode()
|
||||||
Loading…
Reference in New Issue
Block a user