Fix MQTT Light with RGB and Brightness (#15053)

* Fix MQTT Light with RGB and Brightness

When an MQTT light is given an RGB and Brightness topic, the RGB
is scaled by the brightness *as well* as the brightness being set

This causes 255,0,0 at 50% brightness to be sent as 127,0,0 at 50%
brightness, which ends up as 63,0,0 after the RGB bulb has applied
its brightness scaling.

Fixes the same issue in mqtt, mqtt-json and mqtt-template.

Related Issue: #13725

* Add comment to mqtt_json as well
This commit is contained in:
Bob Clough 2018-06-21 19:59:03 +01:00 committed by Paulus Schoutsen
parent b687de879c
commit bfc55137ea
5 changed files with 35 additions and 16 deletions

View file

@ -381,8 +381,8 @@ class TestLightMQTTJSON(unittest.TestCase):
self.assertEqual(50, message_json["brightness"])
self.assertEqual({
'r': 0,
'g': 50,
'b': 4,
'g': 255,
'b': 21,
}, message_json["color"])
self.assertEqual("ON", message_json["state"])