mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix style
This commit is contained in:
parent
880b5f0ad1
commit
5edc4f148f
@ -75,6 +75,8 @@ DISCOVERY_PLATFORMS = {
|
|||||||
}
|
}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# pylint: disable=too-many-arguments
|
||||||
|
|
||||||
|
|
||||||
def is_on(hass, entity_id=None):
|
def is_on(hass, entity_id=None):
|
||||||
""" Returns if any or specified device is home. """
|
""" Returns if any or specified device is home. """
|
||||||
@ -86,9 +88,11 @@ def is_on(hass, entity_id=None):
|
|||||||
def see(hass, mac=None, dev_id=None, host_name=None, location_name=None,
|
def see(hass, mac=None, dev_id=None, host_name=None, location_name=None,
|
||||||
gps=None):
|
gps=None):
|
||||||
""" Call service to notify you see device. """
|
""" Call service to notify you see device. """
|
||||||
data = {key: value for key, value in (
|
data = {key: value for key, value in
|
||||||
(ATTR_MAC, mac), (ATTR_DEV_ID, dev_id),
|
((ATTR_MAC, mac),
|
||||||
(ATTR_HOST_NAME, host_name), (ATTR_LOCATION_NAME, location_name),
|
(ATTR_DEV_ID, dev_id),
|
||||||
|
(ATTR_HOST_NAME, host_name),
|
||||||
|
(ATTR_LOCATION_NAME, location_name),
|
||||||
(ATTR_GPS, gps)) if value is not None}
|
(ATTR_GPS, gps)) if value is not None}
|
||||||
hass.services.call(DOMAIN, SERVICE_SEE, data)
|
hass.services.call(DOMAIN, SERVICE_SEE, data)
|
||||||
|
|
||||||
@ -152,8 +156,8 @@ def setup(hass, config):
|
|||||||
|
|
||||||
def see_service(call):
|
def see_service(call):
|
||||||
""" Service to see a device. """
|
""" Service to see a device. """
|
||||||
args = {key: value for key, value in call.data.items() if key in (
|
args = {key: value for key, value in call.data.items() if key in
|
||||||
ATTR_MAC, ATTR_DEV_ID, ATTR_HOST_NAME, ATTR_LOCATION_NAME,
|
(ATTR_MAC, ATTR_DEV_ID, ATTR_HOST_NAME, ATTR_LOCATION_NAME,
|
||||||
ATTR_GPS)}
|
ATTR_GPS)}
|
||||||
tracker.see(**args)
|
tracker.see(**args)
|
||||||
|
|
||||||
@ -180,7 +184,6 @@ class DeviceTracker(object):
|
|||||||
|
|
||||||
self.group = None
|
self.group = None
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
|
||||||
def see(self, mac=None, dev_id=None, host_name=None, location_name=None,
|
def see(self, mac=None, dev_id=None, host_name=None, location_name=None,
|
||||||
gps=None):
|
gps=None):
|
||||||
""" Notify device tracker that you see a device. """
|
""" Notify device tracker that you see a device. """
|
||||||
@ -352,7 +355,7 @@ def load_config(path, hass, consider_home):
|
|||||||
for dev_id, device in load_yaml_config_file(path).items()]
|
for dev_id, device in load_yaml_config_file(path).items()]
|
||||||
|
|
||||||
|
|
||||||
def setup_scanner_platform(hass, config, scanner, see):
|
def setup_scanner_platform(hass, config, scanner, see_device):
|
||||||
""" Helper method to connect scanner-based platform to device tracker. """
|
""" Helper method to connect scanner-based platform to device tracker. """
|
||||||
interval = util.convert(config.get(CONF_SCAN_INTERVAL), int,
|
interval = util.convert(config.get(CONF_SCAN_INTERVAL), int,
|
||||||
DEFAULT_SCAN_INTERVAL)
|
DEFAULT_SCAN_INTERVAL)
|
||||||
@ -368,7 +371,7 @@ def setup_scanner_platform(hass, config, scanner, see):
|
|||||||
else:
|
else:
|
||||||
host_name = scanner.get_device_name(mac)
|
host_name = scanner.get_device_name(mac)
|
||||||
seen.add(mac)
|
seen.add(mac)
|
||||||
see(mac=mac, host_name=host_name)
|
see_device(mac=mac, host_name=host_name)
|
||||||
|
|
||||||
track_utc_time_change(hass, device_tracker_scan, second=range(0, 60,
|
track_utc_time_change(hass, device_tracker_scan, second=range(0, 60,
|
||||||
interval))
|
interval))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user