aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-08-13 15:12:32 +0200
committerlonkaars <loek@pipeframe.xyz>2021-08-13 15:12:32 +0200
commit2c510147c412cbd5596045ee666cd8f416954d64 (patch)
tree2ffa4c49781245487c8dd5149128d5546cbe086d
parentf1872e3b036e679d8e6b5f8e08c31da18caaa37a (diff)
global brightness
-rw-r--r--light.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/light.py b/light.py
index f7cb243..e719d85 100644
--- a/light.py
+++ b/light.py
@@ -90,9 +90,9 @@ class BekenLight(LightEntity):
self.update_beken_lamp()
def update_beken_lamp(self):
- r = int(self._on) * self._rgb[0]
- g = int(self._on) * self._rgb[1]
- b = int(self._on) * self._rgb[2]
- l = int(self._on) * self._w
+ r = int( int(self._on) * self._rgb[0] * ( self._brightness / 255 ) )
+ g = int( int(self._on) * self._rgb[1] * ( self._brightness / 255 ) )
+ b = int( int(self._on) * self._rgb[2] * ( self._brightness / 255 ) )
+ l = int( int(self._on) * self._w * ( self._brightness / 255 ) )
self._connection.send(BEKEN_CHARACTERISTIC_LAMP, makemsg(r, g, b, l))