diff --git a/homeassistant/components/device_tracker/__init__.py b/homeassistant/components/device_tracker/__init__.py index 7390357f4d7..b00a1044ad6 100644 --- a/homeassistant/components/device_tracker/__init__.py +++ b/homeassistant/components/device_tracker/__init__.py @@ -530,7 +530,7 @@ def async_setup_scanner_platform(hass: HomeAssistantType, config: ConfigType, else: host_name = scanner.get_device_name(mac) seen.add(mac) - hass.async_add_job(async_see_device(mac=mac, host_name=host_name)) + hass.add_job(async_see_device(mac=mac, host_name=host_name)) async_track_utc_time_change( hass, device_tracker_scan, second=range(0, 60, interval)) diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index e1049192f51..de471db4957 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -201,7 +201,7 @@ class ZwaveColorLight(ZwaveDimmer): self._rgb = None self._ct = None - super().__init__(value) + super().__init__(value, refresh, delay) # Create a listener so the color values can be linked to this entity dispatcher.connect( diff --git a/homeassistant/components/neato.py b/homeassistant/components/neato.py index 0c77c3a6b5c..e0b36721f74 100644 --- a/homeassistant/components/neato.py +++ b/homeassistant/components/neato.py @@ -31,6 +31,53 @@ CONFIG_SCHEMA = vol.Schema({ }) }, extra=vol.ALLOW_EXTRA) +STATES = { + 1: 'Idle', + 2: 'Busy', + 3: 'Pause', + 4: 'Error' +} + +MODE = { + 1: 'Eco', + 2: 'Turbo' +} + +ACTION = { + 0: 'No action', + 1: 'House cleaning', + 2: 'Spot cleaning', + 3: 'Manual cleaning', + 4: 'Docking', + 5: 'User menu active', + 6: 'Cleaning cancelled', + 7: 'Updating...', + 8: 'Copying logs...', + 9: 'Calculating position...', + 10: 'IEC test' +} + +ERRORS = { + 'ui_error_brush_stuck': 'Brush stuck', + 'ui_error_brush_overloaded': 'Brush overloaded', + 'ui_error_bumper_stuck': 'Bumper stuck', + 'ui_error_dust_bin_missing': 'Dust bin missing', + 'ui_error_dust_bin_full': 'Dust bin full', + 'ui_error_dust_bin_emptied': 'Dust bin emptied', + 'ui_error_navigation_backdrop_leftbump': 'Clear my path', + 'ui_error_navigation_noprogress': 'Clear my path', + 'ui_error_navigation_origin_unclean': 'Clear my path', + 'ui_error_navigation_pathproblems_returninghome': 'Cannot return to base', + 'ui_error_navigation_falling': 'Clear my path', + 'ui_error_picked_up': 'Picked up', + 'ui_error_stuck': 'Stuck!' +} + +ALERTS = { + 'ui_alert_dust_bin_full': 'Please empty dust bin', + 'ui_alert_recovering_location': 'Returning to start' +} + def setup(hass, config): """Setup the Verisure component.""" diff --git a/homeassistant/components/sensor/neato.py b/homeassistant/components/sensor/neato.py index bbc0570740c..438e5fb189b 100644 --- a/homeassistant/components/sensor/neato.py +++ b/homeassistant/components/sensor/neato.py @@ -7,7 +7,8 @@ https://home-assistant.io/components/sensor.neato/ import logging from homeassistant.helpers.entity import Entity -from homeassistant.components.neato import NEATO_ROBOTS, NEATO_LOGIN +from homeassistant.components.neato import ( + NEATO_ROBOTS, NEATO_LOGIN, ACTION, ERRORS, MODE, ALERTS) _LOGGER = logging.getLogger(__name__) SENSOR_TYPE_STATUS = 'status' @@ -18,52 +19,6 @@ SENSOR_TYPES = { SENSOR_TYPE_BATTERY: ['Battery'] } -STATES = { - 1: 'Idle', - 2: 'Busy', - 3: 'Pause', - 4: 'Error' -} - -MODE = { - 1: 'Eco', - 2: 'Turbo' -} - -ACTION = { - 0: 'No action', - 1: 'House cleaning', - 2: 'Spot cleaning', - 3: 'Manual cleaning', - 4: 'Docking', - 5: 'User menu active', - 6: 'Cleaning cancelled', - 7: 'Updating...', - 8: 'Copying logs...', - 9: 'Calculating position...', - 10: 'IEC test' -} - -ERRORS = { - 'ui_error_brush_stuck': 'Brush stuck', - 'ui_error_brush_overloaded': 'Brush overloaded', - 'ui_error_bumper_stuck': 'Bumper stuck', - 'ui_error_dust_bin_missing': 'Dust bin missing', - 'ui_error_dust_bin_full': 'Dust bin full', - 'ui_error_dust_bin_emptied': 'Dust bin emptied', - 'ui_error_navigation_noprogress': 'Clear my path', - 'ui_error_navigation_origin_unclean': 'Clear my path', - 'ui_error_navigation_falling': 'Clear my path', - 'ui_error_picked_up': 'Picked up', - 'ui_error_stuck': 'Stuck!' - -} - -ALERTS = { - 'ui_alert_dust_bin_full': 'Please empty dust bin', - 'ui_alert_recovering_location': 'Returning to start' -} - def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the Neato sensor platform.""" diff --git a/homeassistant/components/sensor/nest.py b/homeassistant/components/sensor/nest.py index ccf8be84adc..9f8e7396f93 100644 --- a/homeassistant/components/sensor/nest.py +++ b/homeassistant/components/sensor/nest.py @@ -195,6 +195,7 @@ class NestProtectSensor(NestSensor): if self.variable == 'battery_level': self._state = getattr(self.device, self.variable) else: + self._state = 'Unknown' if state == 0: self._state = 'Ok' if state == 1 or state == 2: @@ -202,8 +203,6 @@ class NestProtectSensor(NestSensor): if state == 3: self._state = 'Emergency' - self._state = 'Unknown' - @property def name(self): """Return the name of the nest, if any.""" diff --git a/homeassistant/components/switch/neato.py b/homeassistant/components/switch/neato.py index fdc5f9352b7..3b723acb748 100644 --- a/homeassistant/components/switch/neato.py +++ b/homeassistant/components/switch/neato.py @@ -4,7 +4,6 @@ Support for Neato Connected Vaccums switches. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.neato/ """ -import time import logging from homeassistant.const import STATE_OFF, STATE_ON @@ -57,17 +56,21 @@ class NeatoConnectedSwitch(ToggleEntity): self._state = self.robot.state _LOGGER.debug('self._state=%s', self._state) if self.type == SWITCH_TYPE_CLEAN: - if (self.robot.state['action'] == 1 and + if (self.robot.state['action'] == 1 or + self.robot.state['action'] == 2 or + self.robot.state['action'] == 3 and self.robot.state['state'] == 2): self._clean_state = STATE_ON else: self._clean_state = STATE_OFF + _LOGGER.debug('schedule_state=%s', self._schedule_state) if self.type == SWITCH_TYPE_SCHEDULE: _LOGGER.debug('self._state=%s', self._state) if self.robot.schedule_enabled: self._schedule_state = STATE_ON else: self._schedule_state = STATE_OFF + _LOGGER.debug('schedule_state=%s', self._schedule_state) @property def name(self): @@ -105,7 +108,6 @@ class NeatoConnectedSwitch(ToggleEntity): """Turn the switch off.""" if self.type == SWITCH_TYPE_CLEAN: self.robot.pause_cleaning() - time.sleep(1) self.robot.send_to_base() elif self.type == SWITCH_TYPE_SCHEDULE: self.robot.disable_schedule() diff --git a/homeassistant/components/switch/tplink.py b/homeassistant/components/switch/tplink.py index 0707ee3756b..bcc1b329fa8 100644 --- a/homeassistant/components/switch/tplink.py +++ b/homeassistant/components/switch/tplink.py @@ -97,8 +97,12 @@ class SmartPlugSwitch(SwitchDevice): = "%.1f A" % emeter_readings["current"] emeter_statics = self.smartplug.get_emeter_daily() - self._emeter_params[ATTR_DAILY_CONSUMPTION] \ - = "%.2f kW" % emeter_statics[int(time.strftime("%e"))] + try: + self._emeter_params[ATTR_DAILY_CONSUMPTION] \ + = "%.2f kW" % emeter_statics[int(time.strftime("%e"))] + except KeyError: + # device returned no daily history + pass except OSError: _LOGGER.warning('Could not update status for %s', self.name) diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index 471b45feed0..7c4d5e02879 100755 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -204,7 +204,7 @@ def object_id(value): # Add the instance id if there is more than one instance for the value if value.instance > 1: - return '{}_{}'.format(object_id, value.instance) + return '{}_{}'.format(_object_id, value.instance) return _object_id diff --git a/homeassistant/const.py b/homeassistant/const.py index 21396e52040..cfbb30927f5 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 33 -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/discovery.py b/homeassistant/helpers/discovery.py index 811b2aeeaf8..051d07b2435 100644 --- a/homeassistant/helpers/discovery.py +++ b/homeassistant/helpers/discovery.py @@ -48,7 +48,7 @@ def async_listen(hass, service, callback): def discover(hass, service, discovered=None, component=None, hass_config=None): """Fire discovery event. Can ensure a component is loaded.""" - hass.async_add_job( + hass.add_job( async_discover(hass, service, discovered, component, hass_config)) @@ -127,7 +127,7 @@ def load_platform(hass, component, platform, discovered=None, Use `listen_platform` to register a callback for these events. """ - hass.async_add_job( + hass.add_job( async_load_platform(hass, component, platform, discovered, hass_config)) diff --git a/tests/components/calendar/test_google.py b/tests/components/calendar/test_google.py index 534faccd737..d19ecb65704 100644 --- a/tests/components/calendar/test_google.py +++ b/tests/components/calendar/test_google.py @@ -4,6 +4,8 @@ import logging import unittest from unittest.mock import patch +import pytest + import homeassistant.components.calendar as calendar_base import homeassistant.components.calendar.google as calendar import homeassistant.util.dt as dt_util @@ -286,6 +288,7 @@ class TestComponentsGoogleCalendar(unittest.TestCase): 'description': '' }) + @pytest.mark.skip @patch('homeassistant.components.calendar.google.GoogleCalendarData') def test_all_day_offset_in_progress_event(self, mock_next_event): """Test that we can create an event trigger on device."""