Fix mqtt json light allows to set brightness value >255 (#104220)
This commit is contained in:
parent
ec069fbebf
commit
68f8b2cab5
2 changed files with 25 additions and 4 deletions
|
@ -367,10 +367,13 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
|
|||
if brightness_supported(self.supported_color_modes):
|
||||
try:
|
||||
if brightness := values["brightness"]:
|
||||
self._attr_brightness = int(
|
||||
brightness # type: ignore[operator]
|
||||
/ float(self._config[CONF_BRIGHTNESS_SCALE])
|
||||
* 255
|
||||
self._attr_brightness = min(
|
||||
int(
|
||||
brightness # type: ignore[operator]
|
||||
/ float(self._config[CONF_BRIGHTNESS_SCALE])
|
||||
* 255
|
||||
),
|
||||
255,
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue