mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
commit
d841ddc50b
@ -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))
|
||||
|
@ -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(
|
||||
|
@ -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."""
|
||||
|
@ -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."""
|
||||
|
@ -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."""
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user