Adding support for Lutron covers#11602
Conversation
| """Call when forcing a refresh of the device.""" | ||
| # Reading the property (rather than last_level()) fetchs value | ||
| level = self._lutron_device.level | ||
| _LOGGER.debug("Lutron ID: %d updated to %f", self._lutron_device.id, level) |
There was a problem hiding this comment.
line too long (83 > 79 characters)
|
Note that the Lutron platform does not currently have any unit tests and was already explicitly excluded in |
pvizeli
left a comment
There was a problem hiding this comment.
Store the level as self.level and work with that on properties. You do actual IO inside properties and that is not allow.
|
@pvizeli Incorrect. No IO is done in the properties; they only ever call the |
| def update(self): | ||
| """Call when forcing a refresh of the device.""" | ||
| # Reading the property (rather than last_level()) fetchs value | ||
| level = self._lutron_device.level |
There was a problem hiding this comment.
This doesn't seem to do anything.
There was a problem hiding this comment.
It force the update on client library
| devs.append(dev) | ||
|
|
||
| add_devices(devs, True) | ||
| return True |
There was a problem hiding this comment.
Nothing is checking this return value.
| def device_state_attributes(self): | ||
| """Return the state attributes.""" | ||
| attr = {} | ||
| attr['Lutron Integration ID'] = self._lutron_device.id |
There was a problem hiding this comment.
State attributes should be lowercase snakecase.
There was a problem hiding this comment.
I named it this way for consistency with the light\lutron.py component. If snakecase is the policy then we should change it in both places but for the purpose of this new code I though it best not to make too many changes to what was already there in case it broke existing deployments.
Description:
This patch adds support for controlling roller shades through the cover component on the Lutron platform.
Pull request in home-assistant.github.io with documentation (if applicable):
https://github.com/home-assistant/home-assistant.github.io/#4400
Configuration
As with the Lutron light component, no configuration is necessary (or available) as shades are detected automatically.
Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.