Skip to content

Commit

Permalink
Refactor fix_44
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Jun 22, 2020
1 parent 962cff2 commit 3b3c534
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 0 additions & 6 deletions custom_components/tahoma/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@
}


TAHOMA_HORIZONTAL_DEVICES = {
"PositionableHorizontalAwning": DEVICE_CLASS_AWNING,
"PositionableHorizontalAwningUno": DEVICE_CLASS_AWNING,
"UpDownHorizontalAwning": DEVICE_CLASS_AWNING,
}

# Used to map the Somfy widget or uiClass to the Home Assistant device classes
TAHOMA_BINARY_SENSOR_DEVICE_CLASSES = {
"SmokeSensor": DEVICE_CLASS_SMOKE,
Expand Down
5 changes: 2 additions & 3 deletions custom_components/tahoma/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
IO_PRIORITY_LOCK_LEVEL_STATE,
IO_PRIORITY_LOCK_ORIGINATOR_STATE,
TAHOMA_COVER_DEVICE_CLASSES,
TAHOMA_HORIZONTAL_DEVICES,
TAHOMA_TYPES,
)
from .tahoma_device import TahomaDevice
Expand Down Expand Up @@ -127,7 +126,7 @@ def update(self):

if getattr(self, "_position", False):
# HorizontalAwning devices need a reversed position that can not be obtained via the API
if self.tahoma_device.widget in TAHOMA_HORIZONTAL_DEVICES:
if "Horizontal" in self.tahoma_device.widget:
self._position = 100 - self._position

# TODO Check if this offset is really necessary
Expand Down Expand Up @@ -186,7 +185,7 @@ def set_cover_position(self, **kwargs):
position = 100 - kwargs.get(ATTR_POSITION, 0)

# HorizontalAwning devices need a reversed position that can not be obtained via the API
if self.tahoma_device.widget in TAHOMA_HORIZONTAL_DEVICES:
if "Horizontal" in self.tahoma_device.widget:
position = kwargs.get(ATTR_POSITION, 0)

if COMMAND_SET_POSITION in self.tahoma_device.command_definitions:
Expand Down

0 comments on commit 3b3c534

Please sign in to comment.