Changed checking of cover state closed from 0 to closed_position variable. (#18407)
Change error message to avoid expression "get_position_topic".
This commit is contained in:
parent
275b485b36
commit
d0463942be
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
||||
|
@ -287,7 +287,7 @@ class MqttCover(MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo,
|
|||
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",
|
||||
|
@ -451,7 +451,7 @@ class MqttCover(MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo,
|
|||
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()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue