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

Release 0 32 2
This commit is contained in:
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 @property
def current_temperature(self): def current_temperature(self):
"""Return the current temperature.""" """Return the current temperature."""
self._device.refresh()
return self._device.current_temperature return self._device.current_temperature
@property @property
@ -274,3 +273,7 @@ class HoneywellUSThermostat(ClimateDevice):
"""Set the system mode (Cool, Heat, etc).""" """Set the system mode (Cool, Heat, etc)."""
if hasattr(self._device, ATTR_SYSTEM_MODE): if hasattr(self._device, ATTR_SYSTEM_MODE):
self._device.system_mode = operation_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: if temperature is None:
return return
if self._current_operation == STATE_COOL: 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: 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: if self.hold_temp:
self.device.hold = 1 self.device.hold = 1
else: else:
@ -159,6 +159,6 @@ class RadioThermostat(ClimateDevice):
elif operation_mode == STATE_AUTO: elif operation_mode == STATE_AUTO:
self.device.tmode = 3 self.device.tmode = 3
elif operation_mode == STATE_COOL: 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: 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_ON_CODE): COMMAND_SCHEMA,
vol.Required(CONF_OFF_CODE): COMMAND_SCHEMA, vol.Required(CONF_OFF_CODE): COMMAND_SCHEMA,
vol.Optional(CONF_NAME): cv.string, vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_OFF_CODE_RECIEVE): COMMAND_SCHEMA, vol.Optional(CONF_OFF_CODE_RECIEVE, default=[]): vol.All(cv.ensure_list,
vol.Optional(CONF_ON_CODE_RECIEVE): COMMAND_SCHEMA, [COMMAND_SCHEMA]),
vol.Optional(CONF_ON_CODE_RECIEVE, default=[]): vol.All(cv.ensure_list,
[COMMAND_SCHEMA])
}) })
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({

View File

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

View File

@ -279,6 +279,7 @@ class EntityPlatform(object):
self.entity_namespace = entity_namespace self.entity_namespace = entity_namespace
self.platform_entities = [] self.platform_entities = []
self._async_unsub_polling = None self._async_unsub_polling = None
self._process_updates = False
def add_entities(self, new_entities, update_before_add=False): def add_entities(self, new_entities, update_before_add=False):
"""Add entities for a single platform.""" """Add entities for a single platform."""
@ -335,14 +336,37 @@ class EntityPlatform(object):
self._async_unsub_polling() self._async_unsub_polling()
self._async_unsub_polling = None self._async_unsub_polling = None
@callback @asyncio.coroutine
def _update_entity_states(self, now): def _update_entity_states(self, now):
"""Update the states of all the polling entities. """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. This method must be run in the event loop.
""" """
if self._process_updates:
return
self._process_updates = True
try:
tasks = []
to_update = []
for entity in self.platform_entities: for entity in self.platform_entities:
if entity.should_poll: if not entity.should_poll:
self.component.hass.loop.create_task( continue
entity.async_update_ha_state(True)
) 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