move units to temperature for climate zwave. wrong state was sent to mqtt cove
This commit is contained in:
parent
b8b1fadc6d
commit
0907eea442
2 changed files with 16 additions and 9 deletions
|
@ -12,6 +12,7 @@ from homeassistant.components.climate import ClimateDevice
|
||||||
from homeassistant.components.zwave import (
|
from homeassistant.components.zwave import (
|
||||||
ATTR_NODE_ID, ATTR_VALUE_ID, ZWaveDeviceEntity)
|
ATTR_NODE_ID, ATTR_VALUE_ID, ZWaveDeviceEntity)
|
||||||
from homeassistant.components import zwave
|
from homeassistant.components import zwave
|
||||||
|
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -128,6 +129,7 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
||||||
class_id=COMMAND_CLASS_SENSOR_MULTILEVEL).values():
|
class_id=COMMAND_CLASS_SENSOR_MULTILEVEL).values():
|
||||||
if value.label == 'Temperature':
|
if value.label == 'Temperature':
|
||||||
self._current_temperature = int(value.data)
|
self._current_temperature = int(value.data)
|
||||||
|
self._unit = value.units
|
||||||
# Fan Mode
|
# Fan Mode
|
||||||
for value in self._node.get_values(
|
for value in self._node.get_values(
|
||||||
class_id=COMMAND_CLASS_THERMOSTAT_FAN_MODE).values():
|
class_id=COMMAND_CLASS_THERMOSTAT_FAN_MODE).values():
|
||||||
|
@ -186,7 +188,12 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
|
||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
return self._unit
|
if self._unit == 'C':
|
||||||
|
return TEMP_CELSIUS
|
||||||
|
elif self._unit == 'F':
|
||||||
|
return TEMP_FAHRENHEIT
|
||||||
|
else:
|
||||||
|
return self._unit
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
|
|
|
@ -96,13 +96,17 @@ class MqttCover(CoverDevice):
|
||||||
payload = template.render_with_possible_json_value(
|
payload = template.render_with_possible_json_value(
|
||||||
hass, value_template, payload)
|
hass, value_template, payload)
|
||||||
if payload == self._state_open:
|
if payload == self._state_open:
|
||||||
self._state = True
|
self._state = False
|
||||||
|
_LOGGER.warning("state=%s", int(self._state))
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
elif payload == self._state_closed:
|
elif payload == self._state_closed:
|
||||||
self._state = False
|
self._state = True
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
elif payload.isnumeric() and 0 <= int(payload) <= 100:
|
elif payload.isnumeric() and 0 <= int(payload) <= 100:
|
||||||
self._state = int(payload)
|
if int(payload) > 0:
|
||||||
|
self._state = False
|
||||||
|
else:
|
||||||
|
self._state = True
|
||||||
self._position = int(payload)
|
self._position = int(payload)
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
else:
|
else:
|
||||||
|
@ -129,11 +133,7 @@ class MqttCover(CoverDevice):
|
||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
"""Return if the cover is closed."""
|
"""Return if the cover is closed."""
|
||||||
if self.current_cover_position is not None:
|
return self._state
|
||||||
if self.current_cover_position > 0:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_cover_position(self):
|
def current_cover_position(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue