예제 #1
0
#def on_message(client, userdata, message):
#    print("Received message '" + str(message.payload) + "' on topic '"
#        + message.topic + "' with QoS " + str(message.qos))

def on_connect(client, userdata, flags, rc):
    print("Connection Status: " + str(rc))
    mclnt.subscribe("hah/#")
    mclnt.message_callback_add("hah/set_temperature", set_temp)
    mclnt.message_callback_add("hah/temperature", update_temp)
    mclnt.publish('hah/heater_state', payload="OFF")
    

mclnt = mqtt.Client(client_id="")
orgbclnt = OpenRGBClient('localhost', 6742, 'Heating at Home Client')
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))
Created on Fri Apr  8 01:25:06 2022

@author: Bharath
"""

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]