-
Notifications
You must be signed in to change notification settings - Fork 42
Additional support for components #77
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,8 +122,7 @@ def apply_data(self, data: dict): | |
component_id = component["id"] | ||
if component_id == "main": | ||
self._capabilities.extend(capabilities) | ||
else: | ||
self._components[component_id] = capabilities | ||
self._components[component_id] = capabilities | ||
|
||
if self._type == DEVICE_TYPE_DTH: | ||
dth = data.get("dth") | ||
|
@@ -228,6 +227,13 @@ def values(self) -> Dict[str, Any]: | |
lambda: None, {k: v.value for k, v in self._attributes.items()} | ||
) | ||
|
||
@property | ||
def disabled_components(self) -> []: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just noticed your comment on the pr for home assistant, if I understood well the idea is that such functionality is implemented on the ha side and not the library correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's my question too; would you accept this moved to ha/core, assuming we check the data type first? Or alternatively check the data type here which would be simpler, IMO. |
||
"""Get the list of disabled components for this device.""" | ||
if self._attributes.get("disabledComponents"): | ||
return self._attributes["disabledComponents"].value | ||
return [] | ||
|
||
@property | ||
def color(self) -> Optional[str]: | ||
"""Get the color attribute.""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All methods updating status (like switch_off) needs to take to account component_id in the parameter, because it updates always state of the "main" component, not a correct one. For example if you swith off some component (not the main), it switchs off also main component in device state (it is not really switched off in the smart things device).