Skip to content

Commit

Permalink
Changed checking of cover state closed from 0 to closed_position vari…
Browse files Browse the repository at this point in the history
…able. (#18407)

Change error message to avoid expression "get_position_topic".
  • Loading branch information
pszafer authored and dgomes committed Nov 12, 2018
1 parent 275b485 commit d046394
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/cover/mqtt.py
Expand Up @@ -87,7 +87,7 @@ def validate_options(value):
if (CONF_SET_POSITION_TOPIC in value and
CONF_GET_POSITION_TOPIC not in value):
raise vol.Invalid(
"Set position topic must be set together with get position topic.")
"set_position_topic must be set together with position_topic.")
return value


Expand Down Expand Up @@ -287,7 +287,7 @@ def position_message_received(topic, payload, qos):
float(payload), COVER_PAYLOAD)
if 0 <= percentage_payload <= 100:
self._position = percentage_payload
self._state = self._position == 0
self._state = self._position == self._position_closed
else:
_LOGGER.warning(
"Payload is not integer within range: %s",
Expand Down Expand Up @@ -451,7 +451,7 @@ async def async_set_cover_position(self, **kwargs):
mqtt.async_publish(self.hass, self._set_position_topic,
position, self._qos, self._retain)
if self._optimistic:
self._state = percentage_position == 0
self._state = percentage_position == self._position_closed
self._position = percentage_position
self.async_schedule_update_ha_state()

Expand Down

0 comments on commit d046394

Please sign in to comment.