Don't crash on devices not reporting features (#317)

Returns an empty set if no feature information is available
This commit is contained in:
Teemu R
2022-03-02 16:29:20 +01:00
committed by GitHub
parent e3d76bea75
commit b22f6b4eef
2 changed files with 14 additions and 1 deletions

View File

@@ -262,7 +262,11 @@ class SmartDevice:
@requires_update
def features(self) -> Set[str]:
"""Return a set of features that the device supports."""
return set(self.sys_info["feature"].split(":"))
try:
return set(self.sys_info["feature"].split(":"))
except KeyError:
_LOGGER.debug("Device does not have feature information")
return set()
@property # type: ignore
@requires_update