Skip to content

Commit

Permalink
Climate and cover bugfix (#3097)
Browse files Browse the repository at this point in the history
* Avoid None comparison for zwave cover.

* Just rely on unit from config for unit_of_measurement

* Explicit return None

* Mqtt (#11)

* Explicit return None

* Missing service and wrong service name defined

* Mqtt state was inverted, and never triggering
  • Loading branch information
turbokongen authored and Teagan42 committed Sep 2, 2016
1 parent 9226cef commit a50205a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
10 changes: 1 addition & 9 deletions homeassistant/components/climate/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from homeassistant.components.zwave import (
ATTR_NODE_ID, ATTR_VALUE_ID, ZWaveDeviceEntity)
from homeassistant.components import zwave
from homeassistant.const import (TEMP_CELSIUS, TEMP_FAHRENHEIT)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -155,7 +154,6 @@ def update_properties(self):
if SET_TEMP_TO_INDEX.get(self._current_operation) \
!= value.index:
continue
self._unit = value.units
if self._zxt_120:
continue
self._target_temperature = int(value.data)
Expand Down Expand Up @@ -188,13 +186,7 @@ def swing_list(self):
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
unit = self._unit
if unit == 'C':
return TEMP_CELSIUS
elif unit == 'F':
return TEMP_FAHRENHEIT
else:
return self._unit
return self._unit

@property
def current_temperature(self):
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/cover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
SERVICE_STOP_COVER: {'method': 'stop_cover'},
SERVICE_OPEN_COVER_TILT: {'method': 'open_cover_tilt'},
SERVICE_CLOSE_COVER_TILT: {'method': 'close_cover_tilt'},
SERVICE_STOP_COVER_TILT: {'method': 'stop_cover_tilt'},
SERVICE_SET_COVER_TILT_POSITION: {
'method': 'set_cover_tilt_position',
'schema': COVER_SET_COVER_TILT_POSITION_SCHEMA},
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/cover/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def message_received(topic, payload, qos):
payload = template.render_with_possible_json_value(
hass, value_template, payload)
if payload == self._state_open:
self._state = False
self._state = True
self.update_ha_state()
elif payload == self._state_closed:
self._state = True
self._state = False
self.update_ha_state()
elif payload.isnumeric() and 0 <= int(payload) <= 100:
self._state = int(payload)
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/cover/zwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def update_properties(self):
@property
def is_closed(self):
"""Return if the cover is closed."""
if self.current_cover_position is None:
return None
if self.current_cover_position > 0:
return False
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
SERVICE_OPEN_COVER_TILT = 'open_cover_tilt'
SERVICE_SET_COVER_POSITION = 'set_cover_position'
SERVICE_SET_COVER_TILT_POSITION = 'set_cover_tilt_position'
SERVICE_STOP_COVER = 'stop'
SERVICE_STOP_COVER = 'stop_cover'
SERVICE_STOP_COVER_TILT = 'stop_cover_tilt'

SERVICE_MOVE_UP = 'move_up'
Expand Down

0 comments on commit a50205a

Please sign in to comment.