Beispiel #1
0
from moodlight import moodlight_list, moodlight_get

from gtk import Window, ColorSelection, main


def makeChanger(moodlight):
	def cChanged(c):
		colour = c.get_current_color()
		r, g, b = (colour.red >> 8, colour.green >> 8, colour.blue >> 8)
		#print("(%s, %s, %s)" % (r, g, b))
		moodlight.setRGB(r, g, b)
	return cChanged


for umi in moodlight_list():
	moodlight = moodlight_get(umi)
	w = Window()
	w.set_title(umi)
	c = ColorSelection()
	c.connect('color-changed', makeChanger(moodlight))
	w.add(c)
	w.show_all()

# Enter mainloop
main()
Beispiel #2
0
#!/usr/bin/env python2
import os
import time

parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.insert(0,parentdir) 

from moodlight import moodlight_get

if __name__ == '__main__':
	mood = moodlight_get()
	ip = "z0ttel.gempai.de"

	while True:
		time.sleep(1)
		if os.system("ping -c 1 -W 1 dave.gempai.de &> /dev/null") == 0:
			mood.fadeHSV(0x55, 0xff, 0xff, 1000)
		else:
			mood.fadeHSV(0x00, 0xff, 0xff, 1000)