diff --git a/homeassistant/components/climate/honeywell.py b/homeassistant/components/climate/honeywell.py index 540a9a941d1..0d31cdd1387 100644 --- a/homeassistant/components/climate/honeywell.py +++ b/homeassistant/components/climate/honeywell.py @@ -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() diff --git a/homeassistant/components/climate/radiotherm.py b/homeassistant/components/climate/radiotherm.py index 5fa3f891aac..d06e148cfdd 100644 --- a/homeassistant/components/climate/radiotherm.py +++ b/homeassistant/components/climate/radiotherm.py @@ -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 diff --git a/homeassistant/components/switch/pilight.py b/homeassistant/components/switch/pilight.py index 1818372f1dc..f07d91ca9fb 100644 --- a/homeassistant/components/switch/pilight.py +++ b/homeassistant/components/switch/pilight.py @@ -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({ diff --git a/homeassistant/const.py b/homeassistant/const.py index 299e437be3c..0eb2384517d 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -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) diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index a648de1d650..1144ee112e7 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -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