Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/homematic/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def preset_mode(self):
if self._data.get("BOOST_MODE", False):
return "boost"

# Get the name of the mode
if not self._hm_control_mode:
return None
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead, to fire an exception, we should add a guard before.

if not self._hm_control_mode:
    return None


mode = HM_ATTRIBUTE_SUPPORT[HM_CONTROL_MODE][1][self._hm_control_mode]
mode = mode.lower()

Expand Down Expand Up @@ -177,8 +179,9 @@ def _hm_control_mode(self):
"""Return Control mode."""
if HMIP_CONTROL_MODE in self._data:
return self._data[HMIP_CONTROL_MODE]

# Homematic
return self._data["CONTROL_MODE"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

return self._data.get("")

return self._data.get("CONTROL_MODE")

def _init_data_struct(self):
"""Generate a data dict (self._data) from the Homematic metadata."""
Expand Down