mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Fix ADS light when parameter adsvar_brightness is not set (#19636)
* ADS light breaks if optional parameter adsvar_brightness is not set Just a small change to prevent exception if optional parameter adsvar_brightness is not set * corrected blank lines
This commit is contained in:
parent
cc8b811572
commit
4b90ed6b22
@ -63,11 +63,12 @@ class AdsLight(Light):
|
||||
self._brightness = value
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
self.hass.async_add_job(
|
||||
self.hass.async_add_executor_job(
|
||||
self._ads_hub.add_device_notification,
|
||||
self.ads_var_enable, self._ads_hub.PLCTYPE_BOOL, update_on_state
|
||||
)
|
||||
self.hass.async_add_job(
|
||||
if self.ads_var_brightness is not None:
|
||||
self.hass.async_add_executor_job(
|
||||
self._ads_hub.add_device_notification,
|
||||
self.ads_var_brightness, self._ads_hub.PLCTYPE_INT,
|
||||
update_brightness
|
||||
@ -96,8 +97,10 @@ class AdsLight(Light):
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag supported features."""
|
||||
support = 0
|
||||
if self.ads_var_brightness is not None:
|
||||
return SUPPORT_BRIGHTNESS
|
||||
support = SUPPORT_BRIGHTNESS
|
||||
return support
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the light on or set a specific dimmer value."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user