Skip to content

Commit 4bbc1ec

Browse files
author
Thomas Heinz
committed
Auto-set tilt to -75 (raw 52) when opening cover
1 parent 0e98669 commit 4bbc1ec

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • custom_components/warema_wms_webcontrol

custom_components/warema_wms_webcontrol/cover.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ def current_cover_position(self):
9898
@property
9999
def current_cover_tilt_position(self):
100100
if self.shade.tilt is not None:
101-
# Map Warema angle (-90 to +90) to HA tilt (0 to 100)
102-
return round((self.shade.tilt + 90) * 100 / 180)
101+
return round(self.shade.tilt * 100 / 255)
103102
return None
104103

105104
@property
@@ -118,7 +117,8 @@ def is_closed(self):
118117

119118
def open_cover(self, **kwargs):
120119
self.force_update_until = datetime.now() + timedelta(seconds=15)
121-
tilt = -75 if self.shade.tilt is not None else None
120+
# 52 corresponds to -75° (127 is 0°)
121+
tilt = 52 if self.shade.tilt is not None else None
122122
self.shade.set_shade_position(0, tilt)
123123

124124
def close_cover(self, **kwargs):
@@ -134,6 +134,5 @@ def set_cover_tilt_position(self, **kwargs):
134134
tilt = kwargs.get(ATTR_TILT_POSITION)
135135
if tilt is not None:
136136
self.force_update_until = datetime.now() + timedelta(seconds=15)
137-
# Map HA tilt (0 to 100) back to Warema angle (-90 to +90)
138-
tilt_val = round((tilt * 180 / 100) - 90)
137+
tilt_val = round(tilt * 255 / 100)
139138
self.shade.set_shade_position(self.shade.position, tilt_val)

0 commit comments

Comments
 (0)