Skip to content

Commit

Permalink
KeyError fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Oct 7, 2023
1 parent 392fc65 commit 0277eae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion custom_components/yandex_smart_home/capability_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ def scenes_map(self) -> dict[ColorScene, list[str]]:

if CONF_ENTITY_MODE_MAP in self._entity_config:
scenes_map.update(
{ColorScene(k): v for k, v in self._entity_config[CONF_ENTITY_MODE_MAP].get(self.instance).items()}
{
ColorScene(k): v
for k, v in self._entity_config.get(CONF_ENTITY_MODE_MAP, {}).get(self.instance).items()
}
)

for scene, effects in scenes_map.items():
Expand Down
2 changes: 1 addition & 1 deletion custom_components/yandex_smart_home/capability_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def modes_map_config(self) -> dict[ModeCapabilityMode, list[str]] | None:
if CONF_ENTITY_MODE_MAP in self._entity_config:
return {
ModeCapabilityMode(k): v
for k, v in self._entity_config[CONF_ENTITY_MODE_MAP].get(self.instance).items()
for k, v in self._entity_config.get(CONF_ENTITY_MODE_MAP, {}).get(self.instance).items()
}

return None
Expand Down

0 comments on commit 0277eae

Please sign in to comment.