Ejemplo n.º 1
0
def FBounce(ColorWall,Speed): # makes the lights get brighter
    for color in ColorWall:
        if (ColorWall.index(color)%Speed == 0) or (ColorWall.index(color) == 254):
            if (ColorWall.index(color) == 254):
                for Device in DList:
                    Device.set_color(RGBColor(color[0], color[1], color[2]))
                    time.sleep(0.1)
            else:
                for Device in DList:
                    Device.set_color(RGBColor(color[0], color[1], color[2]))
                    time.sleep(0.01)
    time.sleep(2)
Ejemplo n.º 2
0
def light_background(backColorHEX: str, inopColorHEX: str, INOP: int):
    global backColor, inopColor, keyboard_zone, keyboard_leds
    #backColor = RGBColor.fromHEX(backColorHEX)
    #inopColor = RGBColor.fromHEX(inopColorHEX)
    backColor = RGBColor(0, 0, 32)
    inopColor = RGBColor(127, 0, 0)
    print(
        f'Setting global zone {keyboard_zone} background color {backColor} and INOP variables to color {inopColor}.'
    )
    #keyboard_zone.colors = backColor
    #keyboard_zone.update()
    keyboard_zone.set_color(backColor)
    for i in INOP:
        keyboard_leds[i].set_color(inopColor)
Ejemplo n.º 3
0
def TempAware(DL):
    import clr  # the pythonnet module. You might need to install it 'pip install pythonnet'
    clr.AddReference(
        'TempAware\\OpenHardwareMonitorLib.dll')  #enter your dll path
    from OpenHardwareMonitor.Hardware import Computer
    tempature = 0
    colorplusdown = 0
    c = Computer()
    c.CPUEnabled = True  # get the Info about CPU
    c.GPUEnabled = True  # get the Info about GPU
    c.Open()
    for DName in range(0, len(c.Hardware)):
        if ("GPU" in str(c.Hardware[DName])) or ("gpu" in str(
                c.Hardware[DName])):
            while True:
                for Sen in range(0, (len(c.Hardware[DName].Sensors))):
                    if "temperature" in str(
                            c.Hardware[1].Sensors[Sen].Identifier):
                        tempature = (c.Hardware[1].Sensors[Sen].get_Value())
                        print(tempature)
                        c.Hardware[1].Update()
                        if 19 > tempature:
                            for Device in DL:
                                colorplusdown = (tempature) * 255 / 19
                                Device.set_color(
                                    RGBColor(int(0), int(0 + colorplusdown),
                                             int(255)))
                            time.sleep(1)
                        elif 38 > tempature >= 19:
                            for Device in DL:
                                colorplusdown = (tempature - 19) * 255 / 19
                                Device.set_color(
                                    RGBColor(int(0), int(255),
                                             int(255 - colorplusdown)))
                            time.sleep(1)
                        elif 57 > tempature >= 38:
                            for Device in DL:
                                colorplusdown = (tempature - 38) * 255 / 19
                                Device.set_color(
                                    RGBColor(int(0 + colorplusdown), int(255),
                                             int(0)))
                            time.sleep(1)
                        elif 76 >= tempature >= 57:
                            for Device in DL:
                                colorplusdown = (tempature - 57) * 255 / 10
                                Device.set_color(
                                    RGBColor(int(255),
                                             int(255 - colorplusdown), int(0)))
                            time.sleep(1)
Ejemplo n.º 4
0
def UserInput():
    """It will always return 5 things;\n
    Color1, Color2, Speed, Devices for reversal, Devices that are enables in the form of\n
    None/int, None/int, None/int, None/list, None/list. None is for a blank argument so make sure you add ``if == none`` to catch it"""
    Color1 = Color2 = Speed = ReversedDevice = OnlySet = None
    for arg in sys.argv:
        if arg == '--C1':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color1 = RGBColor(int(R), int(G), int(B))
        elif arg == '--C2':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color2 = RGBColor(int(R), int(G), int(B))
        elif arg == '--reversed':
            ReversedDevices = (
                sys.argv.index(arg) + 1
            )  # Will point to where the device(s) that need to be reversed are
            ReversedDevice = []
            if ' , ' in sys.argv[ReversedDevices]:
                for i in sys.argv[ReversedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            ReversedDevice += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[ReversedDevices].strip().casefold():
                        ReversedDevice += [D]
        elif arg == '--only-set':
            AllowedDevices = (
                sys.argv.index(arg) + 1
            )  # Will point to where the device(s) that are allowed are
            OnlySet = []
            if ' , ' in sys.argv[AllowedDevices]:
                for i in sys.argv[AllowedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            OnlySet += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[AllowedDevices].strip().casefold():
                        OnlySet += [D]
        elif arg == '--speed':
            Speed = int(sys.argv[(sys.argv.index(arg) + 1)])
        else:
            pass
    return (Color1, Color2, Speed, ReversedDevice, OnlySet)
Ejemplo n.º 5
0
 def FinishCbase(R, G, B):
     Cbase = []
     ListPos = 0
     while ListPos < len(R):
         C = RGBColor(R[ListPos], G[ListPos], B[ListPos])
         Cbase += [C]
         ListPos += 1
     return Cbase
Ejemplo n.º 6
0
 def __init__(self, client, DeviceIndex, LEDIndex, CBase, Index):
     self.Device = client.devices[DeviceIndex]
     self.led = self.Device.leds[LEDIndex]
     self.Index = Index
     self.CBase = CBase
     LEDList[Index][2] = True
     LEDColor = 0
     while LEDColor <= 254:
         self.led.set_color(
             RGBColor(CBase[LEDColor][0], CBase[LEDColor][1],
                      CBase[LEDColor][2]))
         time.sleep(0.1)
         LEDColor += 15
     if LEDColor > 254:
         self.led.set_color(
             RGBColor(CBase[254][0], CBase[254][1], CBase[254][2]))
     LEDList[self.Index][2] = False
Ejemplo n.º 7
0
 def put(self, device_id: int = -1):
     args = parser.parse_args()
     if device_id == -1:
         if any(c is None
                for c in (args['red'], args['blue'], args['green'])):
             return args, 400
         cli.set_color(RGBColor(args['red'], args['green'], args['blue']))
         return args, 201
     else:
         if args['mode'] is not None:
             cli.devices[device_id].set_mode(args['mode'])
             return args, 201
         elif all(c is not None
                  for c in (args['red'], args['blue'], args['green'])):
             cli.devices[device_id].set_color(
                 RGBColor(args['red'], args['green'], args['blue']))
             return args, 201
         else:
             return args, 400
Ejemplo n.º 8
0
def UserInput():
    Color1 = Color2 = ReversedDevice = OnlySet = None
    for arg in sys.argv:
        if arg == '--C1':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color1 = RGBColor(int(R), int(G), int(B))
        elif arg == '--C2':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color2 = RGBColor(int(R), int(G), int(B))
        elif arg == '--reversed':
            ReversedDevices = (sys.argv.index(arg) + 1)
            ReversedDevice = []
            if ' , ' in sys.argv[ReversedDevices]:
                for i in sys.argv[ReversedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            ReversedDevice += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[ReversedDevices].strip().casefold():
                        ReversedDevice += [D]
        elif arg == '--only-set':
            OnlySet = []
            AllowedDevices = (sys.argv.index(arg) + 1)
            if ' , ' in sys.argv[AllowedDevices]:
                for i in sys.argv[AllowedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            OnlySet += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[AllowedDevices].strip().casefold():
                        OnlySet += [D]
        else:
            pass
    return (Color1, Color2, ReversedDevice, OnlySet)
Ejemplo n.º 9
0
def CreateCBase():
    Cbase = []
    CycleSpeed = 300
    hue_range = CycleSpeed
    for i in range(hue_range):
        color = colorsys.hsv_to_rgb(i / hue_range, 1.0, 1.0)

        # Split RGB values
        R = int(color[0] * 255)
        G = int(color[1] * 255)
        B = int(color[2] * 255)
        Cbase += [RGBColor(R, G, B)]
    return (Cbase)
Ejemplo n.º 10
0
 def __init__(
     self,
     wrapped_action: Action,
     zones: List[int],
     leds: List[int] = None,
     color: List[int] = None,
     colors: List[List[int]] = None,
     device=None,
     device_type=None,
 ):
     super().__init__(wrapped_action)
     self.zones = zones
     self.leds = leds
     self.color = None
     self.colors = None
     if color:
         self.color = RGBColor(*color)
     elif colors:
         self.colors = [RGBColor(*color) for color in colors]
     else:
         raise Exception("Either 'color' or 'colors' should be set")
     # TODO: Add option to set modes
     # self.mode = mode
     self.device = device
Ejemplo n.º 11
0
def CustomSpectrumCycle(CycleSpeed=1000):
    while True:
        #credit to @James Potkukelkka on discord for MOST of the code
        hue_range = CycleSpeed  # Smaller = faster
        iteration_delay = 0.01  # 10ms
        for i in range(hue_range):
            color = colorsys.hsv_to_rgb(i / hue_range, 1.0, 1.0)

            # Split RGB values
            red = color[0] * 255
            green = color[1] * 255
            blue = color[2] * 255

            for Device in DList:
                Device.set_color(RGBColor(int(red), int(green), int(blue)))
                time.sleep(iteration_delay)
Ejemplo n.º 12
0
 def get_complementary_rgb_colors(self, vim_color, nb_colors):
     crgbs = []
     (r, g, b) = self.vim_color_to_rgb(vim_color)
     (h, s, v) = colorsys.rgb_to_hsv(r, g, b)
     cs = max(s, 0.7)
     cv = max(v, 128)
     for i in range(nb_colors):
         j = i - 1
         if j < 0:
             delta = 0
         else:
             h_step = 0.25 / (nb_colors // 2)
             sign = (-1, 1)[j % 2]
             delta = sign * ((j // 2) + 1) * h_step
         ch = (h + 0.5 + delta) % 1.0
         (cr, cg, cb) = (int(x) for x in colorsys.hsv_to_rgb(ch, cs, cv))
         crgbs.append(RGBColor(cr, cg, cb))
     return crgbs
Ejemplo n.º 13
0
def set_aura_color(aura: Device):
    """
    Sets Aura color once.
    :return:
    """
    # use main color for aura
    hex_color = AURA_COLOR
    r, g, b = hex_to_rgb(hex_color)

    # calculate brightness
    brightness = get_aura_brightness()

    # apply brightness
    r *= brightness
    g *= brightness
    b *= brightness

    # round to int
    r, g, b = validate_color(r, g, b)
    # set aura sync color
    aura.set_color(RGBColor(r, g, b))
Ejemplo n.º 14
0
# As of now all the code in this file is by bahorn with some minor modifications (moving stuff) by me
import colorsys, random, string, sys, threading, time, os, openrgb
from openrgb.utils import DeviceType, ModeData, RGBColor, ZoneType

Black = RGBColor(0, 0, 0)


def UserInput():
    """It will always return 5 things;\n
    Color1, Color2, Speed, Devices for reversal, Devices that are enables"""
    Color1 = Color2 = Speed = ReversedDevice = OnlySet = None
    for arg in sys.argv:
        if arg == '--C1':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color1 = RGBColor(int(R), int(G), int(B))
        elif arg == '--C2':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color2 = RGBColor(int(R), int(G), int(B))
        elif arg == '--reversed':
            ReversedDevices = (
                sys.argv.index(arg) + 1
            )  # Will point to where the device(s) that need to be reversed are
            ReversedDevice = []
            if ' , ' in sys.argv[ReversedDevices]:
                for i in sys.argv[ReversedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            ReversedDevice += [D]
            else:
from Asus_argb_ambient_lighting import get_split_screen_colors

# https://openrgb-python.readthedocs.io/en/latest/pages/advanced.html
from openrgb import OpenRGBClient
from openrgb.utils import RGBColor, DeviceType
import numpy as np
import time

client = OpenRGBClient()

client.clear()  # Turns everything off

motherboard = client.get_devices_by_type(DeviceType.MOTHERBOARD)[0]
add = client.get_devices_by_type(DeviceType.MOTHERBOARD)[1]
add.leds[20].set_color(RGBColor(0, 255, 0))

cols = []
nleds = 41

split_cols = get_split_screen_colors()

EN = [0, 5]
ES = [5, 10]
SE = [10, 16]
SW = [16, 21]
WS = [21, 26]
WN = [26, 32]
NW = [32, 37]
NE = [37, 41]
splits = [EN, ES, SE, SW, WS, WN, NW, NE]
Ejemplo n.º 16
0
def UserInput():
    Color1 = Color2 = Colors = ReversedDevice = OnlySet = Zones = None
    Speed = 50
    for arg in sys.argv:
        if arg == '--C1':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color1 = RGBColor(int(R), int(G), int(B))
        elif arg == '--C2':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color2 = RGBColor(int(R), int(G), int(B))
        elif arg == '--colors':
            Colors = []
            ColorsSelected = (sys.argv.index(arg) + 1)
            if ',' in sys.argv[ColorsSelected]:
                for i in sys.argv[ColorsSelected].split(','):
                    RGB = i.split()
                    Colors += [RGBColor(int(RGB[0]), int(RGB[1]), int(RGB[2]))]
            else:
                print("You must specify more than one color.")
                quit()
        elif arg == '--reversed':
            ReversedDevices = (sys.argv.index(arg) + 1)
            ReversedDevice = []
            if ' , ' in sys.argv[ReversedDevices]:
                for i in sys.argv[ReversedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            ReversedDevice += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[ReversedDevices].strip().casefold():
                        ReversedDevice += [D]
        elif arg == '--only-set':
            OnlySet = []
            AllowedDevices = (sys.argv.index(arg) + 1)
            if ' , ' in sys.argv[AllowedDevices]:
                for i in sys.argv[AllowedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            OnlySet += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold(
                    ) == sys.argv[AllowedDevices].strip().casefold():
                        OnlySet += [D]
        elif arg == '--only-zones':
            Zones = []
            AllowedZones = (sys.argv.index(arg) + 1)
            if ' , ' in sys.argv[AllowedZones]:
                for i in sys.argv[AllowedZones].split(' , '):
                    for D in client.devices:
                        for Z in D.zones:
                            if Z.name.strip().casefold() == i.strip().casefold(
                            ):
                                Zones += [Z]
            else:
                for D in client.devices:
                    for Z in D.zones:
                        if Z.name.strip().casefold(
                        ) == sys.argv[AllowedZones].strip().casefold():
                            Zones += [Z]
        elif arg == '--speed':
            Speed = int(sys.argv[(sys.argv.index(arg) + 1)])
        else:
            pass
    return (Color1, Color2, Colors, Speed, ReversedDevice, OnlySet, Zones)
Ejemplo n.º 17
0
 def vim_color_to_rgb_color(self, vim_color):
     return RGBColor(*self.vim_color_to_rgb(vim_color))
Ejemplo n.º 18
0
# Sample uses Aorus Elite Wifi with Lian Li Lancool II Casae on the "Digital Bottom" 3-pin ARGB output

from openrgb import OpenRGBClient
from openrgb.utils import DeviceType
from openrgb.utils import RGBColor
#import wmi
import winstats

maxtemp = 100
mintemp = 30
maxperf = 125
minperf = 95

ledstripsize = 19

red = RGBColor(255, 0, 0)
blue = RGBColor(0, 0, 255)
zonenumber = 0
#myColorList = red, blue, red, blue, red, blue, red, red, blue, blue, red, blue, red, blue

cli = OpenRGBClient()
print(cli)
mobo = cli.get_devices_by_type(DeviceType.MOTHERBOARD)[0]
print(mobo)
mobo.set_mode('direct')
mobo.zones[zonenumber].resize(ledstripsize)
print(mobo.zones[zonenumber])

myLeds = mobo.zones[zonenumber].leds
for i in myLeds:
    i.set_color(red)
Ejemplo n.º 19
0
def InfiniteCycle(Colors, Zone, Passes, Speed):
    RunThrough = 0
    FadeCount = 5 * Passes
    ColorFades = []
    for i in range(1, len(Colors), 1):
        RedShift = (Colors[i].red - Colors[0].red) / (FadeCount + 1)
        GreenShift = (Colors[i].green - Colors[0].green) / (FadeCount + 1)
        BlueShift = (Colors[i].blue - Colors[0].blue) / (FadeCount + 1)
        Fades = []
        for f in range(FadeCount, 0, -1):
            Fades.append(
                RGBColor(int(Colors[0].red + (RedShift * f)),
                         int(Colors[0].green + (GreenShift * f)),
                         int(Colors[0].blue + (BlueShift * f))))
        ColorFades.append(Fades)
    ColorFadeIndex = 0
    while True:
        ZOType = Zone.type
        if ZOType == ZoneType.SINGLE:
            RunThrough += 1
            if (RunThrough % 3) == 0:
                if Zone.colors[0] == Colors[0]:
                    Zone.colors[0] = (Colors[1])
                elif Zone.colors[0] == Colors[1]:
                    Zone.colors[0] = (Colors[0])
                elif (Zone.colors[0] != Colors[0]) & (Zone.colors[0] !=
                                                      Colors[1]):
                    Zone.colors[0] = (Colors[1])
                Zone.show()
        elif ZOType == ZoneType.LINEAR:
            if Zone.reverse:
                Index = Zone.length - Zone.index - 1
            else:
                Index = Zone.index
            Debug(f"{Index} =======")
            for i in range(Zone.length):
                Zone.colors[i] = Colors[0]
            for p in range(1, Passes + 1, 1):
                Debug("B:-----------")
                for f in range(int(FadeCount / Passes)):
                    if Index < Zone.length - (f + 1) and Index + (f + 1) >= 0:
                        if Zone.reverse:
                            Zone.colors[Index +
                                        (f + 1)] = ColorFades[ColorFadeIndex][
                                            f * Passes + p - 1]
                            Debug(
                                f'i:{Index+(f+1)} p:{p} f:{f} f*Passes+p-1:{f*Passes+p-1} Fade:{ColorFades[ColorFadeIndex][f*Passes+p-1]}'
                            )
                        else:
                            Zone.colors[Index +
                                        (f + 1)] = ColorFades[ColorFadeIndex][
                                            f * Passes + Passes - p]
                            Debug(
                                f'i:{Index+(f+1)} p:{p} f:{f} f*Passes+Passes-p:{f*Passes+Passes-p} Fade:{ColorFades[ColorFadeIndex][f*Passes+Passes-p]}'
                            )
                if Index >= 0 and Index < Zone.length:
                    Zone.colors[Index] = Colors[ColorFadeIndex + 1]
                    Debug(Index)
                for f in range(int(FadeCount / Passes)):
                    if Index > f and Index - (f + 1) < Zone.length:
                        if Zone.reverse:
                            Zone.colors[Index -
                                        (f + 1)] = ColorFades[ColorFadeIndex][
                                            f * Passes + Passes - p]
                            Debug(
                                f'i:{Index-(f+1)} p:{p} f:{f} f*Passes+Passes-p:{f*Passes+Passes-p} Fade:{ColorFades[ColorFadeIndex][f*Passes+Passes-p]}'
                            )
                        else:
                            Zone.colors[Index -
                                        (f + 1)] = ColorFades[ColorFadeIndex][
                                            f * Passes + p - 1]
                            Debug(
                                f'i:{Index-(f+1)} p:{p} f:{f} f*Passes+p-1:{f*Passes+p-1} Fade:{ColorFades[ColorFadeIndex][f*Passes+p-1]}'
                            )
                Zone.show()
                Debug("E:-----------")
            Zone.index += 1
            if Zone.index == Zone.length + 6:
                Zone.index = -6
                if ColorFadeIndex < len(ColorFades) - 1:
                    ColorFadeIndex += 1
                else:
                    ColorFadeIndex = 0
                time.sleep(1)
        elif ZOType == ZoneType.MATRIX:
            pass
Ejemplo n.º 20
0
def BBounce(ColorWall,Speed): # makes the lights get darker
    for color in reversed(ColorWall):
        if (ColorWall.index(color)%Speed == 0):
            for Device in DList:
                Device.set_color(RGBColor(color[0], color[1], color[2]))
                time.sleep(0.01)
Ejemplo n.º 21
0
# Illuminated RGB Addressable Lights based on SimConnect Variables
# by: Diego Vásquez (2020)
# This Software is Open Source under GNU License
# Utility for navigating Keyboard LED Lights for Identification
# Press up/down/left/right to move LED cursos and take note of led 'id' number
# Press ESC to exit.

from openrgb.utils import RGBColor
from pynput.keyboard import Key, Listener
from RGB import *

#####################################################################
# Pending: Read these defaults from the configuration file
rows = 6
cols = 22
lit = RGBColor(0, 0, 255)
unlit = RGBColor(0, 0, 20)
keyb = None


#####################################################################
# Keyboard Handlers
def on_press(key):
    #print('{0} pressed'.format(
    #key))
    check_key(key)


def on_release(key):
    #print('{0} release'.format(
    # key))
Ejemplo n.º 22
0
import colorsys, random, string, sys, threading, time, os, openrgb
from openrgb.utils import DeviceType, ModeData, RGBColor, ZoneType

# or the name could also be 'The Acid's Kickin In Hard' if you want (as per @Saint Mischievous on discord)

Black = RGBColor(0, 0, 0)

def UserInput():
    """It will always return 5 things;\n
    Color1, Color2, Speed, Devices for reversal, Devices that are enables"""
    Color1 = Color2 = Speed = ReversedDevice = OnlySet = None
    for arg in sys.argv:
        if arg == '--C1':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color1 = RGBColor(int(R),int(G),int(B))
        elif arg == '--C2':
            Pos = sys.argv.index(arg) + 1
            R, G, B = sys.argv[Pos:(Pos + 3)]
            Color2 = RGBColor(int(R),int(G),int(B))
        elif arg == '--reversed':
            ReversedDevices = (sys.argv.index(arg) + 1) # Will point to where the device(s) that need to be reversed are
            ReversedDevice = []
            if ' , ' in sys.argv[ReversedDevices]:
                for i in sys.argv[ReversedDevices].split(' , '):
                    for D in client.devices:
                        if D.name.strip().casefold() == i.strip().casefold():
                            ReversedDevice += [D]
            else:
                for D in client.devices:
                    if D.name.strip().casefold() == sys.argv[ReversedDevices].strip().casefold():
Ejemplo n.º 23
0
    for i in Dlist:
        Bigger = len(i.leds)
        if Check < Bigger:
            Check = Bigger
    #print(Check)

    if C1 == None:
        Color = 0
    elif C1 != None:
        Color = C1

    while True:
        Num = 0
        if Color == 0:
            R, G, B = RandomColor()
            NewColor = RGBColor(R, G, B)
        else:
            NewColor = Color
        while Num <= Check:
            for Device in Dlist:
                try:
                    Device.leds[Num].set_color(NewColor)
                except:
                    pass
            Num += 1
            time.sleep(0.1)
        time.sleep(1)
        for Device in Dlist:
            Device.set_color(RGBColor(0, 0, 0))
            time.sleep(0.01)
        time.sleep(0.5)
Ejemplo n.º 24
0
                            ZO[1][ID] = ZO[2]
                        else:
                            ZO[1][ID] -= 1
                        ID += 1
                    ZO[0].show()
            elif ZOType == ZoneType.MATRIX:
                pass
                #print('matrix support not done yet')
        time.sleep(0.1)


if __name__ == '__main__':
    C1, C2, Reversed, Enabled = UserInput()
    #print(C1, C2, Reversed, Enabled)
    if C1 == None:
        C1 = RGBColor(255, 0, 0)
    if C2 == None:
        C2 = RGBColor(0, 0, 255)
    Enable = []
    if Enabled == None:
        Enable += [i for i in client.devices]
    elif Enabled != None:
        Enable = Enabled

    PassTo = []
    for Device in Enable:
        if Reversed != None:
            for R in Reversed:
                if R == Device:
                    ReverseBool = True
                    continue
Ejemplo n.º 25
0
orgbclnt.clear()

#mclnt.on_message = on_message
mclnt.on_connect = on_connect

mclnt.connect(BROKER_HOST, BROKER_PORT)
mclnt.loop_start()


while(True):
    if heating == True:
        print("Heating On. Current Temp: " + str(current_temp) + " Temperature Setting: " + str(temp_setting))
        if current_temp > (temp_setting + 1):
            heating = False
            for device in orgbclnt.devices:
                device.set_color(RGBColor(0,0,255))
                time.sleep(0.05)
            fah_command("pause")
            print("Turning Heating Off")
            mclnt.publish('hah/heater_state', payload="OFF", retain=True)
    else:
        print("Heating Off. Current Temp: " + str(current_temp) + " Temperature Setting: " + str(temp_setting))
        if current_temp < (temp_setting - 1):
            heating = True
            for device in orgbclnt.devices:
                device.set_color(RGBColor(255,0,0))
                time.sleep(0.05)
            fah_command("unpause")
            print("Turning Heating On")
            mclnt.publish('hah/heater_state', payload="ON", retain=True)
    time.sleep(10)
Ejemplo n.º 26
0
        image = grab_screen(0, 0, X_RES, Y_RES)  # take a screenshot usign X
    else:
        image = ImageGrab.grab()  # take a screenshot using PIL
    #print image.size

    data = []
    for y in range(0, image.size[1], DECIMATE):  #loop over the height
        for x in range(0, image.size[0], DECIMATE):  #loop over the width
            color = image.getpixel((x, y))  #grab a pixel
            data.append(color)

    #cluster and assign labels to the pixels
    labels = clt.fit_predict(data)
    #count labels to find most popular
    label_counts = Counter(labels)
    #subset out most popular centroid
    dominant_color = clt.cluster_centers_[label_counts.most_common()[0][0]]

    # current color is blended with colors 2 frames before to smooth effect
    dominant_color += (old + 0.5 * old2)
    dominant_color /= 2.5
    # reset vars for next iteration
    old = dominant_color
    old2 = old

    red, green, blue = dominant_color
    #print(red, green, blue)
    for Device in Dlist:
        Device.set_color(RGBColor(int(red), int(green), int(blue)))
    time.sleep(0.1)
Ejemplo n.º 27
0
#!/usr/bin/env python3
from openrgb import OpenRGBClient
from openrgb.utils import RGBColor, DeviceType, ZoneType
from time import sleep

cli = OpenRGBClient()

keyboard = cli.get_devices_by_type(DeviceType.KEYBOARD)[0]
keys_zone = [z for z in keyboard.zones if z.type == ZoneType.MATRIX][0]

while True:
    for color in (RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255), RGBColor(0, 0, 0)):
        for x in range(len(keys_zone.leds)):
            keys_zone.set_color(color, end=(x + 1))
            sleep(.3)
Ejemplo n.º 28
0
                if ColorFadeIndex < len(ColorFades) - 1:
                    ColorFadeIndex += 1
                else:
                    ColorFadeIndex = 0
                time.sleep(1)
        elif ZOType == ZoneType.MATRIX:
            pass
            #print('matrix support not done yet')


if __name__ == '__main__':
    C1, C2, Colors, Speed, Reversed, Enabled, Zones = UserInput()
    if Colors == None:
        Colors = []
        if C1 == None:
            Colors += [RGBColor(255, 0, 0)]
        else:
            Colors += [C1]
        if C2 == None:
            Colors += [RGBColor(0, 0, 255)]
        else:
            Colors += [C2]
    Enable = []
    if Enabled == None:
        Enable += [i for i in client.devices]
    elif Enabled != None:
        Enable = Enabled
    if Speed > 50:
        Speed = 50
    Passes = 51 - Speed
    if Passes < 1:
Ejemplo n.º 29
0
#!/usr/bin/env python3

# Happy belated 4th of July!

from openrgb import OpenRGBClient
from openrgb.utils import RGBColor
from time import sleep

cli = OpenRGBClient()

offsets = [(0, 1, 2), (1, 2, 0), (2, 0, 1)]

while True:
    for offset in offsets:
        for device in cli.devices:
            # Setting every third color red
            for x in range(offset[0], len(device.colors), 3):
                device.colors[x] = RGBColor(255, 0, 0)
            # Setting every third color white
            for x in range(offset[1], len(device.colors), 3):
                device.colors[x] = RGBColor(255, 255, 255)
            # Setting every third color blue
            for x in range(offset[2], len(device.colors), 3):
                device.colors[x] = RGBColor(0, 0, 255)
        cli.show()  # Updates all devices
        sleep(.5)
Ejemplo n.º 30
0
        if i["INOP"]:
            print(
                f'Marking variable {i["SimVar"]} with RGBLEDNumber {i["RGBLEDNumber"]} as INOP.'
            )
            inopLights.append(int(i["RGBLEDNumber"]))
    keyboard_leds = initRGB()
    led_count = len(keyboard_leds)
    light_background(backColorHEX='#000020',
                     inopColorHEX='#800000',
                     INOP=inopLights)

    #######################################################################
    # Main Loop
    while True:
        system('cls')
        for i in myBindings:
            #print("getting value for ",i)
            var_value = None
            var_value = aq.get(i["SimVar"])
            #RGBColorIf = RGBColor.fromHEX(i["RGBColorIf"])
            #RGBColorElse = RGBColor.fromHEX(i["RGBColorElse"])
            RGBColorIf = RGBColor(0, 0, 255)
            RGBColorElse = RGBColor(0, 32, 0)
            print(f'Var: {i["SimVar"]}, Value: {var_value}')
            if int(i["SimVarValueToMatch"]) == var_value:
                light_led(id=int(i["RGBLEDNumber"]), litColor=RGBColorIf)
            else:
                light_led(id=int(i["RGBLEDNumber"]), litColor=RGBColorElse)
        time.sleep(1)
else:
    print("SimConnect Object was not initialized.")