Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add part of fix_44 changes already #82

Merged
merged 9 commits into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions custom_components/tahoma/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"SwingingShutter": DEVICE_CLASS_SHUTTER,
}


# 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 Expand Up @@ -97,6 +98,7 @@
CORE_RSSI_LEVEL_STATE = "core:RSSILevelState"
CORE_STATUS_STATE = "core:StatusState"
CORE_CLOSURE_STATE = "core:ClosureState"
CORE_TARGET_CLOSURE_STATE = "core:TargetClosureState"
CORE_DEPLOYMENT_STATE = "core:DeploymentState"
CORE_SLATS_ORIENTATION_STATE = "core:SlatsOrientationState"
CORE_PRIORITY_LOCK_TIMER_STATE = "core:PriorityLockTimerState"
Expand Down
14 changes: 10 additions & 4 deletions custom_components/tahoma/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
CORE_PEDESTRIAN_POSITION_STATE,
CORE_PRIORITY_LOCK_TIMER_STATE,
CORE_SLATS_ORIENTATION_STATE,
CORE_TARGET_CLOSURE_STATE,
DOMAIN,
IO_PRIORITY_LOCK_LEVEL_STATE,
IO_PRIORITY_LOCK_ORIGINATOR_STATE,
Expand Down Expand Up @@ -112,15 +113,20 @@ def update(self):
CORE_PEDESTRIAN_POSITION_STATE
)

if CORE_TARGET_CLOSURE_STATE in self.tahoma_device.active_states:
self._position = 100 - self.tahoma_device.active_states.get(
CORE_TARGET_CLOSURE_STATE
)

# Set tilt position for slats
if CORE_SLATS_ORIENTATION_STATE in self.tahoma_device.active_states:
self._tilt_position = 100 - self.tahoma_device.active_states.get(
CORE_SLATS_ORIENTATION_STATE
)

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

# TODO Check if this offset is really necessary
Expand Down Expand Up @@ -178,8 +184,8 @@ def set_cover_position(self, **kwargs):
"""Move the cover to a specific position."""
position = 100 - kwargs.get(ATTR_POSITION, 0)

# PositionableHorizontalAwning (e.g. io:HorizontalAwningIOComponent uses a reversed position)
if self.tahoma_device.widget == "PositionableHorizontalAwning":
# HorizontalAwning devices need a reversed position that can not be obtained via the API
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