Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ADS light when parameter adsvar_brightness is not set #19636

Merged
merged 2 commits into from
Dec 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions homeassistant/components/light/ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ def update_brightness(name, value):
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(
self._ads_hub.add_device_notification,
self.ads_var_brightness, self._ads_hub.PLCTYPE_INT,
update_brightness
)
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
)

@property
def name(self):
Expand All @@ -96,8 +97,10 @@ def should_poll(self):
@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."""
Expand Down