1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RPi + Other Software Kodi to Xiaomi RGBW Bulb

Discussion in 'Hardware Support' started by navigonic, 9 December 2016.

  1. navigonic

    navigonic New Member

    Messages:
    9
    Hardware:
    RPi3
    Hi!

    I'm attempting to create a lowcost rgbw ambilight setup, using a wifi-connected rgbw lightbulb from xiaomi / yeelight that allows python/json commands to set rgb-colors. I'm attempting to see if Hyperion can be setup to work with Kodi on a Raspberry Pi 3 to average screen color and then run submit rgbw colors as arguments to a python script.

    Has anyone tried something similar and could perhaps direct me towards a resource to read up on how to get hyperion to forward rgb colors to a python script?

    This is what I'm trying to use (using python-yeelight library):

    from yeelight import *
    import sys

    bulb = Bulb(IPADDRESS)
    bulb.turn_on()


    while True:
    input = sys.stdin.readline()
    print(input)
    inputData=input.split(' ')
    if(len(inputData)>3):
    r = float(inputData[0])
    g = float(inputData[1])
    b = float(inputData[2])
    bulb.set_rgb(r, g, b)​


    I can see it can output a file, but is it possible to get it outputting as a continuous stream to a python script as above?

    Sorry if the question is vague..
     
    Last edited: 9 December 2016
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    1,978
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    @penfold42 may can help you... but without having those lights its not easy to help...
     
  3. penfold42

    penfold42 Active Member

    Messages:
    746
    Hardware:
    RPi1/Zero, RPi2, RPi3, 32/64bit, +Arduino, +nodeMCU/ESP8266
    Use the udp led device to send the led data to a udp port.

    Your python script can then listen on this port to catch the data.

    It's just raw led data in the packets red,green,blue for each Hyperion led
     
  4. navigonic

    navigonic New Member

    Messages:
    9
    Hardware:
    RPi3
    Last edited: 10 December 2016
    • Like Like x 1