style/lint updates

This commit is contained in:
Brian Cribbs 2017-04-28 10:45:32 -04:00
parent 79e134b076
commit bbe8b2019b

View file

@ -114,7 +114,8 @@ class MqttCover(CoverDevice):
tilt_closed_position, device_class, tilt_min, tilt_max):
"""Initialize the cover."""
if tilt_command_topic is not None:
_LOGGER.info("MQTT cover configured with tilt topic: " + tilt_command_topic)
_LOGGER.info("MQTT cover configured with tilt topic: "
+ tilt_command_topic)
self._position = None
self._state = None
self._name = name
@ -147,13 +148,12 @@ class MqttCover(CoverDevice):
"""
@callback
def tilt_updated(topic, payload, qos):
"""The tilt was updated"""
"""The tilt was updated."""
if (payload.isnumeric() and
self._tilt_min <= int(payload)
and int(payload) <= self._tilt_max):
"""The payload was a valid tilt value"""
tiltRange = self._tilt_max - self._tilt_min
level = round(float(payload) / tiltRange * 100.0)
tilt_range = self._tilt_max - self._tilt_min
level = round(float(payload) / tilt_range * 100.0)
self._tilt_value = level
_LOGGER.info("Tilt value set to " + str(self._tilt_value))
self.schedule_update_ha_state()
@ -274,7 +274,7 @@ class MqttCover(CoverDevice):
@property
def current_cover_tilt_position(self):
"""Return current position of cover tilt"""
"""Return current position of cover tilt."""
return self._tilt_value
def async_set_cover_tilt_position(self, **kwargs):
@ -282,10 +282,10 @@ class MqttCover(CoverDevice):
if ATTR_TILT_POSITION in kwargs:
position = float(kwargs[ATTR_TILT_POSITION])
"""The position needs to be between min and max"""
tiltRange = self._tilt_max - self._tilt_min
#The position needs to be between min and max
tilt_range = self._tilt_max - self._tilt_min
percentage = position / 100.0
level = round(tiltRange * percentage)
level = round(tilt_range * percentage)
_LOGGER.info("setting tilt value to " + str(level))
mqtt.async_publish(self.hass, self._tilt_command_topic,