Skip to content

Commit

Permalink
[Breaking Change] Cleanup Lutron light component (#18650)
Browse files Browse the repository at this point in the history
Remove the return value from setup_platform
Convert LutronLight.__init__ to use super() when referencing the parent class.
Change device_state_attributes() to use lowercase snakecase (Rename 'Lutron Integration ID' to 'lutron_integration_id')
  • Loading branch information
cdheiser authored and balloob committed Nov 23, 2018
1 parent bb37151 commit 98f159a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions homeassistant/components/light/lutron.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
devs.append(dev)

add_entities(devs, True)
return True


def to_lutron_level(level):
Expand All @@ -43,7 +42,7 @@ class LutronLight(LutronDevice, Light):
def __init__(self, area_name, lutron_device, controller):
"""Initialize the light."""
self._prev_brightness = None
LutronDevice.__init__(self, area_name, lutron_device, controller)
super().__init__(self, area_name, lutron_device, controller)

@property
def supported_features(self):
Expand Down Expand Up @@ -77,7 +76,7 @@ def turn_off(self, **kwargs):
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr['Lutron Integration ID'] = self._lutron_device.id
attr['lutron_integration_id'] = self._lutron_device.id
return attr

@property
Expand Down

2 comments on commit 98f159a

@awrede
Copy link
Contributor

@awrede awrede commented on 98f159a Nov 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File "/home/andreas/.hass/lib/python3.7/site-packages/homeassistant-0.84.0.dev0-py3.7.egg/homeassistant/components/light/lutron.py", line 45, in __init__
super().__init__(self, area_name, lutron_device, controller)

TypeError: __init__() takes 4 positional arguments but 5 were given

You need to remove self from super().__init__(...)

@frenck
Copy link
Member

@frenck frenck commented on 98f159a Nov 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awrede Please do not use commits to comment on with issues. Use GitHub issue instead. Thanks! 👍

Please sign in to comment.