Merge pull request #4271 from home-assistant/release-0-32-2

Release 0 32 2
pull/4432/head 0.32.2
Paulus Schoutsen 2016-11-06 23:40:06 -08:00 committed by GitHub
commit fc3235fb6d
5 changed files with 43 additions and 14 deletions

View File

@ -223,7 +223,6 @@ class HoneywellUSThermostat(ClimateDevice):
@property
def current_temperature(self):
"""Return the current temperature."""
self._device.refresh()
return self._device.current_temperature
@property
@ -274,3 +273,7 @@ class HoneywellUSThermostat(ClimateDevice):
"""Set the system mode (Cool, Heat, etc)."""
if hasattr(self._device, ATTR_SYSTEM_MODE):
self._device.system_mode = operation_mode
def update(self):
"""Update the state."""
self._device.refresh()

View File

@ -135,9 +135,9 @@ class RadioThermostat(ClimateDevice):
if temperature is None:
return
if self._current_operation == STATE_COOL:
self.device.t_cool = temperature
self.device.t_cool = round(temperature * 2.0) / 2.0
elif self._current_operation == STATE_HEAT:
self.device.t_heat = temperature
self.device.t_heat = round(temperature * 2.0) / 2.0
if self.hold_temp:
self.device.hold = 1
else:
@ -159,6 +159,6 @@ class RadioThermostat(ClimateDevice):
elif operation_mode == STATE_AUTO:
self.device.tmode = 3
elif operation_mode == STATE_COOL:
self.device.t_cool = self._target_temperature
self.device.t_cool = round(self._target_temperature * 2.0) / 2.0
elif operation_mode == STATE_HEAT:
self.device.t_heat = self._target_temperature
self.device.t_heat = round(self._target_temperature * 2.0) / 2.0

View File

@ -37,8 +37,10 @@ SWITCHES_SCHEMA = vol.Schema({
vol.Required(CONF_ON_CODE): COMMAND_SCHEMA,
vol.Required(CONF_OFF_CODE): COMMAND_SCHEMA,
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_OFF_CODE_RECIEVE): COMMAND_SCHEMA,
vol.Optional(CONF_ON_CODE_RECIEVE): COMMAND_SCHEMA,
vol.Optional(CONF_OFF_CODE_RECIEVE, default=[]): vol.All(cv.ensure_list,
[COMMAND_SCHEMA]),
vol.Optional(CONF_ON_CODE_RECIEVE, default=[]): vol.All(cv.ensure_list,
[COMMAND_SCHEMA])
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({

View File

@ -2,7 +2,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 32
PATCH_VERSION = '1'
PATCH_VERSION = '2'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2)

View File

@ -279,6 +279,7 @@ class EntityPlatform(object):
self.entity_namespace = entity_namespace
self.platform_entities = []
self._async_unsub_polling = None
self._process_updates = False
def add_entities(self, new_entities, update_before_add=False):
"""Add entities for a single platform."""
@ -335,14 +336,37 @@ class EntityPlatform(object):
self._async_unsub_polling()
self._async_unsub_polling = None
@callback
@asyncio.coroutine
def _update_entity_states(self, now):
"""Update the states of all the polling entities.
To protect from flooding the executor, we will update async entities
in parallel and other entities sequential.
This method must be run in the event loop.
"""
for entity in self.platform_entities:
if entity.should_poll:
self.component.hass.loop.create_task(
entity.async_update_ha_state(True)
)
if self._process_updates:
return
self._process_updates = True
try:
tasks = []
to_update = []
for entity in self.platform_entities:
if not entity.should_poll:
continue
update_coro = entity.async_update_ha_state(True)
if hasattr(entity, 'async_update'):
tasks.append(update_coro)
else:
to_update.append(update_coro)
for update_coro in to_update:
yield from update_coro
if tasks:
yield from asyncio.wait(tasks, loop=self.component.hass.loop)
finally:
self._process_updates = False