From f12b6dbd6fbd817b4ef7d74614f56f1993381fc3 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 4 Aug 2020 14:03:28 +0200 Subject: [PATCH] RGB Bug fix --- hue_controller.py | 5 +++-- lib/func.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hue_controller.py b/hue_controller.py index a9361ac..6edec8c 100644 --- a/hue_controller.py +++ b/hue_controller.py @@ -82,6 +82,7 @@ class controller: for key in LIGHTS: controller.switchLight(key) + # Light color def setLightColor(index:int, r:int, g:int, b:int): if( LIGHTS.get(str(index)) ): loop.run_until_complete( controller.setLightRGB(index, r, g, b) ) @@ -104,6 +105,7 @@ class controller: global LIGHTS LIGHTS = json.loads(jsonLights.text) + print(LIGHTS) def end(): loop.close() @@ -112,6 +114,5 @@ class controller: def testReq(): controller.init() controller.Power(True) - controller.setAllLightsColor( 255, 255, 255 ) - + controller.setAllLightsColor( 178, 199, 255 ) controller.end() diff --git a/lib/func.py b/lib/func.py index 8f3ae51..5495c69 100644 --- a/lib/func.py +++ b/lib/func.py @@ -9,13 +9,13 @@ def boolToString(v: bool): # To fix the dumb python syntax return boolStr[v] def rgbToDecimal( r:int, g:int, b:int ): - return round(r/255), round(g/255), round(b/255) + return round(r/255, 1), round(g/255, 1), round(b/255, 1) def svNumFix(n: float): return int(round(n*254, 0)) def hueNumFix(n: float): - return int(round(n*65535)) + return int(round(n*65535, 0)) def rgbToHsv( r:int, g:int, b:int ): R, G, B = rgbToDecimal(r, g, b)