Fix custom position range (#36222)

This commit is contained in:
Erik Montnemery 2020-05-28 19:37:09 +02:00 committed by GitHub
parent 7e693afcf3
commit 31250eafe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -530,7 +530,7 @@ class MqttCover(
async def async_set_cover_tilt_position(self, **kwargs): async def async_set_cover_tilt_position(self, **kwargs):
"""Move the cover tilt to a specific position.""" """Move the cover tilt to a specific position."""
position = float(kwargs[ATTR_TILT_POSITION]) position = kwargs[ATTR_TILT_POSITION]
# The position needs to be between min and max # The position needs to be between min and max
level = self.find_in_range_from_percent(position) level = self.find_in_range_from_percent(position)
@ -550,10 +550,7 @@ class MqttCover(
percentage_position = position percentage_position = position
if set_position_template is not None: if set_position_template is not None:
position = set_position_template.async_render(**kwargs) position = set_position_template.async_render(**kwargs)
elif ( else:
self._config[CONF_POSITION_OPEN] != 100
and self._config[CONF_POSITION_CLOSED] != 0
):
position = self.find_in_range_from_percent(position, COVER_PAYLOAD) position = self.find_in_range_from_percent(position, COVER_PAYLOAD)
mqtt.async_publish( mqtt.async_publish(