Skip to content

Commit

Permalink
Fixing how the brightness attribute gets set.
Browse files Browse the repository at this point in the history
Before this fix, the light groups were being displayed as toggles. This
change tells HA that these light objects are dimmable.
  • Loading branch information
cpcowart committed Nov 1, 2023
1 parent 8708b22 commit c63d0d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/luxor/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

from homeassistant.core import callback
from homeassistant.components.light import (
ColorMode,
LightEntity,
COLOR_MODE_BRIGHTNESS,
)
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.debounce import Debouncer
Expand Down Expand Up @@ -102,13 +102,16 @@ def brightness_to_intensity(brightness: int):


class LuxorLight(CoordinatorEntity, LightEntity):
supported_color_modes = {COLOR_MODE_BRIGHTNESS}

def __init__(self, coordinator, controller, group_id):
super().__init__(coordinator)
self.controller = controller
self.group_id = group_id
self._attr_unique_id = "LUXOR_LIGHT_{}".format(group_id)
color_mode = ColorMode.BRIGHTNESS
self._attr_color_mode = color_mode
self._attr_supported_color_modes = {color_mode}
self._attr_effect = None

async def async_turn_on(
self, brightness=255, **kwargs
Expand Down

0 comments on commit c63d0d9

Please sign in to comment.