Update file header (#21061)
* Update file header * Fix lint issue * Fix lint issuepull/20945/head^2
parent
f4b2573c4b
commit
3736120c6a
homeassistant/components
device_sun_light_trigger
geofency
goalfeed
google_assistant
google_domains
google_pubsub
googlehome
gpslogger
graphite
greeneye_monitor
group
habitica
harmony
history
history_graph
hlk_sw16
homeworks
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Provides functionality to turn on lights based on the states.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/device_sun_light_trigger/
|
||||
"""
|
||||
"""Support to turn on lights based on the states."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Geolocation component.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/geo_location/
|
||||
"""
|
||||
"""Support for Geolocation."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Demo platform for the geolocation component.
|
||||
|
||||
For more details about this platform, please refer to the documentation
|
||||
https://home-assistant.io/components/demo/
|
||||
"""
|
||||
"""Demo platform for the geolocation component."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from math import cos, pi, radians, sin
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Generic GeoJSON events platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/geo_location/geo_json_events/
|
||||
"""
|
||||
"""Support for generic GeoJSON events."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
@ -13,8 +8,8 @@ import voluptuous as vol
|
|||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
CONF_RADIUS, CONF_SCAN_INTERVAL, CONF_URL, EVENT_HOMEASSISTANT_START,
|
||||
CONF_LATITUDE, CONF_LONGITUDE)
|
||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS, CONF_SCAN_INTERVAL, CONF_URL,
|
||||
EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
NSW Rural Fire Service Feed platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/geo_location/nsw_rural_fire_service_feed/
|
||||
"""
|
||||
"""Support for NSW Rural Fire Service Feeds."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
@ -13,8 +8,8 @@ import voluptuous as vol
|
|||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION, ATTR_LOCATION, CONF_RADIUS, CONF_SCAN_INTERVAL,
|
||||
EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE)
|
||||
ATTR_ATTRIBUTION, ATTR_LOCATION, CONF_LATITUDE, CONF_LONGITUDE,
|
||||
CONF_RADIUS, CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
U.S. Geological Survey Earthquake Hazards Program Feed platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/geo_location/usgs_earthquakes_feed/
|
||||
"""
|
||||
"""Support for U.S. Geological Survey Earthquake Hazards Program Feeds."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
@ -13,8 +8,8 @@ import voluptuous as vol
|
|||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION, CONF_RADIUS, CONF_SCAN_INTERVAL,
|
||||
EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE)
|
||||
ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, CONF_RADIUS,
|
||||
CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
"""
|
||||
Support for Geofency.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/geofency/
|
||||
"""
|
||||
"""Support for Geofency."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
from aiohttp import web
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER
|
||||
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME, \
|
||||
ATTR_LATITUDE, ATTR_LONGITUDE, CONF_WEBHOOK_ID, HTTP_OK, ATTR_NAME
|
||||
from homeassistant.const import (
|
||||
ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_NAME, CONF_WEBHOOK_ID, HTTP_OK,
|
||||
HTTP_UNPROCESSABLE_ENTITY, STATE_NOT_HOME)
|
||||
from homeassistant.helpers import config_entry_flow
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.util import slugify
|
||||
|
||||
|
@ -27,9 +23,7 @@ CONF_MOBILE_BEACONS = 'mobile_beacons'
|
|||
CONFIG_SCHEMA = vol.Schema({
|
||||
vol.Optional(DOMAIN): vol.Schema({
|
||||
vol.Optional(CONF_MOBILE_BEACONS, default=[]): vol.All(
|
||||
cv.ensure_list,
|
||||
[cv.string]
|
||||
),
|
||||
cv.ensure_list, [cv.string]),
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
@ -62,7 +56,7 @@ WEBHOOK_SCHEMA = vol.Schema({
|
|||
vol.Required(ATTR_NAME): vol.All(cv.string, slugify),
|
||||
vol.Optional(ATTR_CURRENT_LATITUDE): cv.latitude,
|
||||
vol.Optional(ATTR_CURRENT_LONGITUDE): cv.longitude,
|
||||
vol.Optional(ATTR_BEACON_ID): cv.string
|
||||
vol.Optional(ATTR_BEACON_ID): cv.string,
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
||||
|
@ -114,18 +108,11 @@ def _set_location(hass, data, location_name):
|
|||
device = _device_name(data)
|
||||
|
||||
async_dispatcher_send(
|
||||
hass,
|
||||
TRACKER_UPDATE,
|
||||
device,
|
||||
(data[ATTR_LATITUDE], data[ATTR_LONGITUDE]),
|
||||
location_name,
|
||||
data
|
||||
)
|
||||
hass, TRACKER_UPDATE, device,
|
||||
(data[ATTR_LATITUDE], data[ATTR_LONGITUDE]), location_name, data)
|
||||
|
||||
return web.Response(
|
||||
text="Setting location for {}".format(device),
|
||||
status=HTTP_OK
|
||||
)
|
||||
text="Setting location for {}".format(device), status=HTTP_OK)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
|
|
|
@ -6,10 +6,10 @@ https://home-assistant.io/components/device_tracker.geofency/
|
|||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN as \
|
||||
DEVICE_TRACKER_DOMAIN
|
||||
from homeassistant.components.geofency import TRACKER_UPDATE, \
|
||||
DOMAIN as GEOFENCY_DOMAIN
|
||||
from homeassistant.components.device_tracker import (
|
||||
DOMAIN as DEVICE_TRACKER_DOMAIN)
|
||||
from homeassistant.components.geofency import (
|
||||
DOMAIN as GEOFENCY_DOMAIN, TRACKER_UPDATE)
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Component for the Goalfeed service.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/goalfeed/
|
||||
"""
|
||||
"""Component for the Goalfeed service."""
|
||||
import json
|
||||
|
||||
import requests
|
||||
|
@ -48,8 +43,8 @@ def setup(hass, config):
|
|||
'username': username,
|
||||
'password': password,
|
||||
'connection_info': data}
|
||||
resp = requests.post(GOALFEED_AUTH_ENDPOINT, post_data,
|
||||
timeout=30).json()
|
||||
resp = requests.post(
|
||||
GOALFEED_AUTH_ENDPOINT, post_data, timeout=30).json()
|
||||
|
||||
channel = pusher.subscribe('private-goals', resp['auth'])
|
||||
channel.bind('goal', goal_handler)
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
"""
|
||||
Support for Google - Calendar Event Devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/google/
|
||||
|
||||
NOTE TO OTHER DEVELOPERS: IF YOU ADD MORE SCOPES TO THE OAUTH THAN JUST
|
||||
CALENDAR THEN USERS WILL NEED TO DELETE THEIR TOKEN_FILE. THEY WILL LOSE THEIR
|
||||
REFRESH_TOKEN PIECE WHEN RE-AUTHENTICATING TO ADD MORE API ACCESS
|
||||
IT'S BEST TO JUST HAVE SEPARATE OAUTH FOR DIFFERENT PIECES OF GOOGLE
|
||||
"""
|
||||
"""Support for Google - Calendar Event Devices."""
|
||||
import logging
|
||||
import os
|
||||
import yaml
|
||||
|
@ -75,10 +65,10 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
_SINGLE_CALSEARCH_CONFIG = vol.Schema({
|
||||
vol.Required(CONF_NAME): cv.string,
|
||||
vol.Required(CONF_DEVICE_ID): cv.string,
|
||||
vol.Optional(CONF_TRACK): cv.boolean,
|
||||
vol.Optional(CONF_SEARCH): cv.string,
|
||||
vol.Optional(CONF_OFFSET): cv.string,
|
||||
vol.Optional(CONF_IGNORE_AVAILABILITY, default=True): cv.boolean,
|
||||
vol.Optional(CONF_OFFSET): cv.string,
|
||||
vol.Optional(CONF_SEARCH): cv.string,
|
||||
vol.Optional(CONF_TRACK): cv.boolean,
|
||||
})
|
||||
|
||||
DEVICE_SCHEMA = vol.Schema({
|
||||
|
@ -95,10 +85,7 @@ def do_authentication(hass, hass_config, config):
|
|||
until we have an access token.
|
||||
"""
|
||||
from oauth2client.client import (
|
||||
OAuth2WebServerFlow,
|
||||
OAuth2DeviceCodeError,
|
||||
FlowExchangeError
|
||||
)
|
||||
OAuth2WebServerFlow, OAuth2DeviceCodeError, FlowExchangeError)
|
||||
from oauth2client.file import Storage
|
||||
|
||||
oauth = OAuth2WebServerFlow(
|
||||
|
@ -152,8 +139,8 @@ def do_authentication(hass, hass_config, config):
|
|||
'been found'.format(YAML_DEVICES),
|
||||
title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID)
|
||||
|
||||
listener = track_time_change(hass, step2_exchange,
|
||||
second=range(0, 60, dev_flow.interval))
|
||||
listener = track_time_change(
|
||||
hass, step2_exchange, second=range(0, 60, dev_flow.interval))
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Google Calendar Search binary sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/calendar.google/
|
||||
"""
|
||||
"""Support for Google Calendar Search binary sensors."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for the google speech service.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/tts.google/
|
||||
"""
|
||||
"""Support for the Google speech service."""
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
|
@ -101,16 +96,16 @@ class GoogleProvider(Provider):
|
|||
)
|
||||
|
||||
if request.status != 200:
|
||||
_LOGGER.error("Error %d on load url %s",
|
||||
_LOGGER.error("Error %d on load URL %s",
|
||||
request.status, request.url)
|
||||
return (None, None)
|
||||
return None, None
|
||||
data += await request.read()
|
||||
|
||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
||||
_LOGGER.error("Timeout for google speech.")
|
||||
return (None, None)
|
||||
_LOGGER.error("Timeout for google speech")
|
||||
return None, None
|
||||
|
||||
return ("mp3", data)
|
||||
return 'mp3', data
|
||||
|
||||
@staticmethod
|
||||
def _split_message_to_parts(message):
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Actions on Google Assistant Smart Home Control.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/google_assistant/
|
||||
"""
|
||||
"""Support for Actions on Google Assistant Smart Home Control."""
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Dict, Any
|
||||
|
@ -37,7 +32,7 @@ ENTITY_SCHEMA = vol.Schema({
|
|||
vol.Optional(CONF_NAME): cv.string,
|
||||
vol.Optional(CONF_EXPOSE): cv.boolean,
|
||||
vol.Optional(CONF_ALIASES): vol.All(cv.ensure_list, [cv.string]),
|
||||
vol.Optional(CONF_ROOM_HINT): cv.string
|
||||
vol.Optional(CONF_ROOM_HINT): cv.string,
|
||||
})
|
||||
|
||||
GOOGLE_ASSISTANT_SCHEMA = vol.Schema({
|
||||
|
@ -49,7 +44,7 @@ GOOGLE_ASSISTANT_SCHEMA = vol.Schema({
|
|||
vol.Optional(CONF_API_KEY): cv.string,
|
||||
vol.Optional(CONF_ENTITY_CONFIG): {cv.entity_id: ENTITY_SCHEMA},
|
||||
vol.Optional(CONF_ALLOW_UNLOCK,
|
||||
default=DEFAULT_ALLOW_UNLOCK): cv.boolean
|
||||
default=DEFAULT_ALLOW_UNLOCK): cv.boolean,
|
||||
}, extra=vol.PREVENT_EXTRA)
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Implement the Smart Home traits."""
|
||||
"""Implement the Google Smart Home traits."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components import (
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Integrate with Google Domains.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/google_domains/
|
||||
"""
|
||||
"""Support for Google Domains."""
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
@ -62,8 +57,8 @@ async def async_setup(hass, config):
|
|||
return True
|
||||
|
||||
|
||||
async def _update_google_domains(hass, session, domain, user, password,
|
||||
timeout):
|
||||
async def _update_google_domains(
|
||||
hass, session, domain, user, password, timeout):
|
||||
"""Update Google Domains."""
|
||||
url = UPDATE_URL.format(user, password)
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Google Cloud Pub/Sub.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/google_pubsub/
|
||||
"""
|
||||
"""Support for Google Cloud Pub/Sub."""
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
|
@ -34,7 +29,7 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
vol.Required(CONF_PROJECT_ID): cv.string,
|
||||
vol.Required(CONF_TOPIC_NAME): cv.string,
|
||||
vol.Required(CONF_SERVICE_PRINCIPAL): cv.string,
|
||||
vol.Required(CONF_FILTER): FILTER_SCHEMA
|
||||
vol.Required(CONF_FILTER): FILTER_SCHEMA,
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
@ -46,8 +41,8 @@ def setup(hass: HomeAssistant, yaml_config: Dict[str, Any]):
|
|||
config = yaml_config[DOMAIN]
|
||||
project_id = config[CONF_PROJECT_ID]
|
||||
topic_name = config[CONF_TOPIC_NAME]
|
||||
service_principal_path = os.path.join(hass.config.config_dir,
|
||||
config[CONF_SERVICE_PRINCIPAL])
|
||||
service_principal_path = os.path.join(
|
||||
hass.config.config_dir, config[CONF_SERVICE_PRINCIPAL])
|
||||
|
||||
if not os.path.isfile(service_principal_path):
|
||||
_LOGGER.error("Path to credentials file cannot be found")
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support Google Home units.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/googlehome/
|
||||
"""
|
||||
"""Support Google Home units."""
|
||||
import logging
|
||||
|
||||
import asyncio
|
||||
|
@ -31,11 +26,10 @@ DEFAULT_RSSI_THRESHOLD = -70
|
|||
|
||||
DEVICE_CONFIG = vol.Schema({
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_DEVICE_TYPES,
|
||||
default=DEVICE_TYPES): vol.All(cv.ensure_list,
|
||||
[vol.In(DEVICE_TYPES)]),
|
||||
vol.Optional(CONF_RSSI_THRESHOLD,
|
||||
default=DEFAULT_RSSI_THRESHOLD): vol.Coerce(int),
|
||||
vol.Optional(CONF_DEVICE_TYPES, default=DEVICE_TYPES):
|
||||
vol.All(cv.ensure_list, [vol.In(DEVICE_TYPES)]),
|
||||
vol.Optional(CONF_RSSI_THRESHOLD, default=DEFAULT_RSSI_THRESHOLD):
|
||||
vol.Coerce(int),
|
||||
vol.Optional(CONF_TRACK_ALARMS, default=False): cv.boolean,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Google Home bluetooth tacker.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/device_tracker.googlehome/
|
||||
"""
|
||||
"""Support for Google Home Bluetooth tacker."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
|
@ -13,12 +8,12 @@ from homeassistant.components.googlehome import (
|
|||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.util import slugify
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEPENDENCIES = ['googlehome']
|
||||
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=10)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
|
||||
"""Validate the configuration and return a Google Home scanner."""
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Google Home alarm sensor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.googlehome/
|
||||
"""
|
||||
"""Support for Google Home alarm sensor."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
|
@ -13,7 +8,6 @@ from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
|||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
||||
DEPENDENCIES = ['googlehome']
|
||||
|
||||
SCAN_INTERVAL = timedelta(seconds=10)
|
||||
|
@ -23,13 +17,13 @@ _LOGGER = logging.getLogger(__name__)
|
|||
ICON = 'mdi:alarm'
|
||||
|
||||
SENSOR_TYPES = {
|
||||
'timer': "Timer",
|
||||
'alarm': "Alarm",
|
||||
'timer': 'Timer',
|
||||
'alarm': 'Alarm',
|
||||
}
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config,
|
||||
async_add_entities, discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the googlehome sensor platform."""
|
||||
if discovery_info is None:
|
||||
_LOGGER.warning(
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for GPSLogger.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/gpslogger/
|
||||
"""
|
||||
"""Support for GPSLogger."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -42,16 +37,16 @@ def _id(value: str) -> str:
|
|||
|
||||
|
||||
WEBHOOK_SCHEMA = vol.Schema({
|
||||
vol.Required(ATTR_DEVICE): _id,
|
||||
vol.Required(ATTR_LATITUDE): cv.latitude,
|
||||
vol.Required(ATTR_LONGITUDE): cv.longitude,
|
||||
vol.Required(ATTR_DEVICE): _id,
|
||||
vol.Optional(ATTR_ACCURACY, default=DEFAULT_ACCURACY): vol.Coerce(float),
|
||||
vol.Optional(ATTR_BATTERY, default=DEFAULT_BATTERY): vol.Coerce(float),
|
||||
vol.Optional(ATTR_SPEED): vol.Coerce(float),
|
||||
vol.Optional(ATTR_DIRECTION): vol.Coerce(float),
|
||||
vol.Optional(ATTR_ACTIVITY): cv.string,
|
||||
vol.Optional(ATTR_ALTITUDE): vol.Coerce(float),
|
||||
vol.Optional(ATTR_BATTERY, default=DEFAULT_BATTERY): vol.Coerce(float),
|
||||
vol.Optional(ATTR_DIRECTION): vol.Coerce(float),
|
||||
vol.Optional(ATTR_PROVIDER): cv.string,
|
||||
vol.Optional(ATTR_ACTIVITY): cv.string
|
||||
vol.Optional(ATTR_SPEED): vol.Coerce(float),
|
||||
})
|
||||
|
||||
|
||||
|
@ -81,14 +76,9 @@ async def handle_webhook(hass, webhook_id, request):
|
|||
device = data[ATTR_DEVICE]
|
||||
|
||||
async_dispatcher_send(
|
||||
hass,
|
||||
TRACKER_UPDATE,
|
||||
device,
|
||||
hass, TRACKER_UPDATE, device,
|
||||
(data[ATTR_LATITUDE], data[ATTR_LONGITUDE]),
|
||||
data[ATTR_BATTERY],
|
||||
data[ATTR_ACCURACY],
|
||||
attrs
|
||||
)
|
||||
data[ATTR_BATTERY], data[ATTR_ACCURACY], attrs)
|
||||
|
||||
return web.Response(
|
||||
text='Setting location for {}'.format(device),
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for the GPSLogger platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/device_tracker.gpslogger/
|
||||
"""
|
||||
"""Support for the GPSLogger device tracking."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.device_tracker import DOMAIN as \
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Component that sends data to a Graphite installation.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/graphite/
|
||||
"""
|
||||
"""Support for sending data to a Graphite installation."""
|
||||
import logging
|
||||
import queue
|
||||
import socket
|
||||
|
@ -69,10 +64,8 @@ class GraphiteFeeder(threading.Thread):
|
|||
self._quit_object = object()
|
||||
self._we_started = False
|
||||
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START,
|
||||
self.start_listen)
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP,
|
||||
self.shutdown)
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, self.start_listen)
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, self.shutdown)
|
||||
hass.bus.listen(EVENT_STATE_CHANGED, self.event_listener)
|
||||
_LOGGER.debug("Graphite feeding to %s:%i initialized",
|
||||
self._host, self._port)
|
||||
|
@ -95,7 +88,7 @@ class GraphiteFeeder(threading.Thread):
|
|||
self._queue.put(event)
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Graphite feeder thread has died, not queuing event!")
|
||||
"Graphite feeder thread has died, not queuing event")
|
||||
|
||||
def _send_to_graphite(self, data):
|
||||
"""Send data to Graphite."""
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for monitoring a GreenEye Monitor energy monitor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/greeneye_monitor/
|
||||
"""
|
||||
"""Support for monitoring a GreenEye Monitor energy monitor."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Provide the functionality to group entities.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/group/
|
||||
"""
|
||||
"""Provide the functionality to group entities."""
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
The Habitica API component.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/habitica/
|
||||
"""
|
||||
"""Support for Habitica devices."""
|
||||
from collections import namedtuple
|
||||
import logging
|
||||
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
"""
|
||||
The Habitica sensor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.habitica/
|
||||
"""
|
||||
|
||||
import logging
|
||||
"""Support for Habitica sensors."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components import habitica
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.components import habitica
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=15)
|
||||
|
||||
|
||||
|
@ -36,11 +31,7 @@ class HabitipyData:
|
|||
"""Habitica API user data cache."""
|
||||
|
||||
def __init__(self, api):
|
||||
"""
|
||||
Habitica API user data cache.
|
||||
|
||||
api - HAHabitipyAsync object
|
||||
"""
|
||||
"""Habitica API user data cache."""
|
||||
self.api = api
|
||||
self.data = None
|
||||
|
||||
|
@ -54,12 +45,7 @@ class HabitipySensor(Entity):
|
|||
"""A generic Habitica sensor."""
|
||||
|
||||
def __init__(self, name, sensor_name, updater):
|
||||
"""
|
||||
Init a generic Habitica sensor.
|
||||
|
||||
name - Habitica platform name
|
||||
sensor_name - one of the names from ALL_SENSOR_TYPES
|
||||
"""
|
||||
"""Initialize a generic Habitica sensor."""
|
||||
self._name = name
|
||||
self._sensor_name = sensor_name
|
||||
self._sensor_type = habitica.SENSORS_TYPES[sensor_name]
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
The hangouts bot component.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/hangouts/
|
||||
"""
|
||||
"""Support for Hangouts."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -11,21 +6,18 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.components.hangouts.intents import HelpIntent
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.helpers import intent
|
||||
from homeassistant.helpers import dispatcher
|
||||
from homeassistant.helpers import dispatcher, intent
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import (
|
||||
CONF_BOT, CONF_INTENTS, CONF_REFRESH_TOKEN, DOMAIN,
|
||||
EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED,
|
||||
MESSAGE_SCHEMA, SERVICE_SEND_MESSAGE,
|
||||
SERVICE_UPDATE, CONF_SENTENCES, CONF_MATCHERS,
|
||||
CONF_ERROR_SUPPRESSED_CONVERSATIONS, INTENT_SCHEMA, TARGETS_SCHEMA,
|
||||
CONF_DEFAULT_CONVERSATIONS, EVENT_HANGOUTS_CONVERSATIONS_RESOLVED,
|
||||
INTENT_HELP, SERVICE_RECONNECT)
|
||||
|
||||
# We need an import from .config_flow, without it .config_flow is never loaded.
|
||||
from .config_flow import HangoutsFlowHandler # noqa: F401
|
||||
from .const import (
|
||||
CONF_BOT, CONF_DEFAULT_CONVERSATIONS, CONF_ERROR_SUPPRESSED_CONVERSATIONS,
|
||||
CONF_INTENTS, CONF_MATCHERS, CONF_REFRESH_TOKEN, CONF_SENTENCES, DOMAIN,
|
||||
EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED,
|
||||
EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, INTENT_HELP, INTENT_SCHEMA,
|
||||
MESSAGE_SCHEMA, SERVICE_RECONNECT, SERVICE_SEND_MESSAGE, SERVICE_UPDATE,
|
||||
TARGETS_SCHEMA)
|
||||
|
||||
REQUIREMENTS = ['hangups==0.4.6']
|
||||
|
||||
|
@ -39,7 +31,7 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
vol.Optional(CONF_DEFAULT_CONVERSATIONS, default=[]):
|
||||
[TARGETS_SCHEMA],
|
||||
vol.Optional(CONF_ERROR_SUPPRESSED_CONVERSATIONS, default=[]):
|
||||
[TARGETS_SCHEMA]
|
||||
[TARGETS_SCHEMA],
|
||||
})
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ from homeassistant import config_entries
|
|||
from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.core import callback
|
||||
|
||||
from .const import CONF_2FA, CONF_REFRESH_TOKEN
|
||||
from .const import DOMAIN as HANGOUTS_DOMAIN
|
||||
from .const import CONF_2FA, CONF_REFRESH_TOKEN, DOMAIN as HANGOUTS_DOMAIN
|
||||
|
||||
|
||||
@callback
|
||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify \
|
||||
import ATTR_MESSAGE, ATTR_TARGET, ATTR_DATA
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger('homeassistant.components.hangouts')
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
"""The Hangouts Bot."""
|
||||
import asyncio
|
||||
import io
|
||||
import logging
|
||||
import asyncio
|
||||
|
||||
import aiohttp
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from homeassistant.helpers import dispatcher, intent
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import (
|
||||
ATTR_MESSAGE, ATTR_TARGET, ATTR_DATA, CONF_CONVERSATIONS, DOMAIN,
|
||||
ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET, CONF_CONVERSATION_ID,
|
||||
CONF_CONVERSATION_NAME, CONF_CONVERSATIONS, CONF_MATCHERS, DOMAIN,
|
||||
EVENT_HANGOUTS_CONNECTED, EVENT_HANGOUTS_CONVERSATIONS_CHANGED,
|
||||
EVENT_HANGOUTS_DISCONNECTED, EVENT_HANGOUTS_MESSAGE_RECEIVED,
|
||||
CONF_MATCHERS, CONF_CONVERSATION_ID,
|
||||
CONF_CONVERSATION_NAME, EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, INTENT_HELP)
|
||||
EVENT_HANGOUTS_CONVERSATIONS_RESOLVED, EVENT_HANGOUTS_DISCONNECTED,
|
||||
EVENT_HANGOUTS_MESSAGE_RECEIVED, INTENT_HELP)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Intents for the hangouts component."""
|
||||
"""Intents for the Hangouts component."""
|
||||
from homeassistant.helpers import intent
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import INTENT_HELP, DOMAIN, CONF_BOT
|
||||
from .const import CONF_BOT, DOMAIN, INTENT_HELP
|
||||
|
||||
|
||||
class HelpIntent(intent.IntentHandler):
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
"""
|
||||
Hangouts notification service.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/notify.hangouts/
|
||||
"""
|
||||
"""Support for Hangouts notifications."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
ATTR_MESSAGE, ATTR_DATA)
|
||||
|
||||
from homeassistant.components.hangouts.const \
|
||||
import (DOMAIN, SERVICE_SEND_MESSAGE, TARGETS_SCHEMA,
|
||||
CONF_DEFAULT_CONVERSATIONS)
|
||||
from homeassistant.components.hangouts.const import (
|
||||
CONF_DEFAULT_CONVERSATIONS, DOMAIN, SERVICE_SEND_MESSAGE, TARGETS_SCHEMA)
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA, ATTR_MESSAGE, ATTR_TARGET, PLATFORM_SCHEMA,
|
||||
BaseNotificationService)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
"""The harmony component.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/harmony/
|
||||
"""
|
||||
"""Support for Harmony devices."""
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Harmony Hub devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/remote.harmony/
|
||||
"""
|
||||
"""Support for Harmony Hub devices."""
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
|
@ -51,12 +46,12 @@ HARMONY_SYNC_SCHEMA = vol.Schema({
|
|||
|
||||
HARMONY_CHANGE_CHANNEL_SCHEMA = vol.Schema({
|
||||
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
|
||||
vol.Required(ATTR_CHANNEL): cv.positive_int
|
||||
vol.Required(ATTR_CHANNEL): cv.positive_int,
|
||||
})
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities,
|
||||
discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the Harmony platform."""
|
||||
activity = None
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Exposes regular REST commands as services.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/hassio/
|
||||
"""
|
||||
"""Support for Hass.io."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
|
@ -14,16 +9,15 @@ from homeassistant.auth.const import GROUP_ID_ADMIN
|
|||
from homeassistant.components import SERVICE_CHECK_CONFIG
|
||||
from homeassistant.const import (
|
||||
ATTR_NAME, SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_STOP)
|
||||
from homeassistant.core import DOMAIN as HASS_DOMAIN
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import DOMAIN as HASS_DOMAIN, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.util.dt import utcnow
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from .auth import async_setup_auth
|
||||
from .handler import HassIO, HassioAPIError
|
||||
from .discovery import async_setup_discovery
|
||||
from .handler import HassIO, HassioAPIError
|
||||
from .http import HassIOView
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
"""Implement the auth feature from Hass.io for Add-ons."""
|
||||
import logging
|
||||
from ipaddress import ip_address
|
||||
import logging
|
||||
import os
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPForbidden, HTTPNotFound
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.http.const import KEY_REAL_IP
|
||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import ATTR_USERNAME, ATTR_PASSWORD, ATTR_ADDON
|
||||
from .const import ATTR_ADDON, ATTR_PASSWORD, ATTR_USERNAME
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
"""Implement the serivces discovery feature from Hass.io for Add-ons."""
|
||||
"""Implement the services discovery feature from Hass.io for Add-ons."""
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import HTTPServiceUnavailable
|
||||
|
||||
from homeassistant.core import callback, CoreState
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START
|
||||
from homeassistant.core import CoreState, callback
|
||||
|
||||
from .handler import HassioAPIError
|
||||
from .const import (
|
||||
ATTR_DISCOVERY, ATTR_ADDON, ATTR_NAME, ATTR_SERVICE, ATTR_CONFIG,
|
||||
ATTR_ADDON, ATTR_CONFIG, ATTR_DISCOVERY, ATTR_NAME, ATTR_SERVICE,
|
||||
ATTR_UUID)
|
||||
from .handler import HassioAPIError
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Exposes regular REST commands as services.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/hassio/
|
||||
"""
|
||||
"""Handler for Hass.io."""
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
"""
|
||||
Exposes regular REST commands as services.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/hassio/
|
||||
"""
|
||||
"""HTTP Support for Hass.io."""
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
||||
import async_timeout
|
||||
import aiohttp
|
||||
from aiohttp import web
|
||||
from aiohttp.hdrs import CONTENT_TYPE
|
||||
from aiohttp.web_exceptions import HTTPBadGateway
|
||||
import async_timeout
|
||||
|
||||
from homeassistant.components.http import KEY_AUTHENTICATED, HomeAssistantView
|
||||
|
||||
from .const import X_HASSIO, X_HASS_USER_ID, X_HASS_IS_ADMIN
|
||||
from .const import X_HASS_IS_ADMIN, X_HASS_USER_ID, X_HASSIO
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,26 +1,20 @@
|
|||
"""
|
||||
HDMI CEC component.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/hdmi_cec/
|
||||
"""
|
||||
import logging
|
||||
import multiprocessing
|
||||
"""Support for HDMI CEC."""
|
||||
from collections import defaultdict
|
||||
from functools import reduce
|
||||
import logging
|
||||
import multiprocessing
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH
|
||||
from homeassistant.const import (EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP, STATE_ON,
|
||||
STATE_OFF, CONF_DEVICES, CONF_PLATFORM,
|
||||
STATE_PLAYING, STATE_IDLE,
|
||||
STATE_PAUSED, CONF_HOST)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICES, CONF_HOST, CONF_PLATFORM, EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP, STATE_IDLE, STATE_OFF, STATE_ON, STATE_PAUSED,
|
||||
STATE_PLAYING)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
REQUIREMENTS = ['pyCEC==0.4.13']
|
||||
|
@ -43,7 +37,7 @@ ICONS_BY_TYPE = {
|
|||
1: ICON_RECORDER,
|
||||
3: ICON_TUNER,
|
||||
4: ICON_PLAYER,
|
||||
5: ICON_AUDIO
|
||||
5: ICON_AUDIO,
|
||||
}
|
||||
|
||||
CEC_DEVICES = defaultdict(list)
|
||||
|
@ -87,7 +81,7 @@ SERVICE_SEND_COMMAND_SCHEMA = vol.Schema({
|
|||
vol.Optional(ATTR_SRC): _VOL_HEX,
|
||||
vol.Optional(ATTR_DST): _VOL_HEX,
|
||||
vol.Optional(ATTR_ATT): _VOL_HEX,
|
||||
vol.Optional(ATTR_RAW): vol.Coerce(str)
|
||||
vol.Optional(ATTR_RAW): vol.Coerce(str),
|
||||
}, extra=vol.PREVENT_EXTRA)
|
||||
|
||||
SERVICE_VOLUME = 'volume'
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HDMI CEC devices as media players.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/hdmi_cec/
|
||||
"""
|
||||
"""Support for HDMI CEC devices as media players."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.hdmi_cec import ATTR_NEW, CecDevice
|
||||
|
@ -25,7 +20,7 @@ ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
|||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Find and return HDMI devices as +switches."""
|
||||
if ATTR_NEW in discovery_info:
|
||||
_LOGGER.info("Setting up HDMI devices %s", discovery_info[ATTR_NEW])
|
||||
_LOGGER.debug("Setting up HDMI devices %s", discovery_info[ATTR_NEW])
|
||||
entities = []
|
||||
for device in discovery_info[ATTR_NEW]:
|
||||
hdmi_device = hass.data.get(device)
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
"""
|
||||
Support for HDMI CEC devices as switches.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/hdmi_cec/
|
||||
"""
|
||||
"""Support for HDMI CEC devices as switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.hdmi_cec import CecDevice, ATTR_NEW
|
||||
from homeassistant.components.switch import SwitchDevice, DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_STANDBY, STATE_ON
|
||||
from homeassistant.components.hdmi_cec import ATTR_NEW, CecDevice
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, STATE_STANDBY
|
||||
|
||||
DEPENDENCIES = ['hdmi_cec']
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Provide pre-made queries on top of the recorder component.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/history/
|
||||
"""
|
||||
"""Provide pre-made queries on top of the recorder component."""
|
||||
from collections import defaultdict
|
||||
from datetime import timedelta
|
||||
from itertools import groupby
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support to graphs card in the UI.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/history_graph/
|
||||
"""
|
||||
"""Support to graphs card in the UI."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -34,7 +29,7 @@ GRAPH_SCHEMA = vol.Schema({
|
|||
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: cv.schema_with_slug_keys(GRAPH_SCHEMA)
|
||||
DOMAIN: cv.schema_with_slug_keys(GRAPH_SCHEMA),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/hive/
|
||||
"""
|
||||
"""Support for the Hive devices."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (CONF_PASSWORD, CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME)
|
||||
from homeassistant.const import (
|
||||
CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
|
||||
REQUIREMENTS = ['pyhiveapi==0.2.17']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DOMAIN = 'hive'
|
||||
DATA_HIVE = 'data_hive'
|
||||
DEVICETYPES = {
|
||||
|
@ -23,7 +20,7 @@ DEVICETYPES = {
|
|||
'light': 'device_list_light',
|
||||
'switch': 'device_list_plug',
|
||||
'sensor': 'device_list_sensor',
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema({
|
||||
|
@ -59,9 +56,8 @@ def setup(hass, config):
|
|||
password = config[DOMAIN][CONF_PASSWORD]
|
||||
update_interval = config[DOMAIN][CONF_SCAN_INTERVAL]
|
||||
|
||||
devicelist = session.core.initialise_api(username,
|
||||
password,
|
||||
update_interval)
|
||||
devicelist = session.core.initialise_api(
|
||||
username, password, update_interval)
|
||||
|
||||
if devicelist is None:
|
||||
_LOGGER.error("Hive API initialization failed")
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.hive/
|
||||
"""
|
||||
"""Support for the Hive binary sensors."""
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.hive import DATA_HIVE, DOMAIN
|
||||
|
||||
DEPENDENCIES = ['hive']
|
||||
|
||||
DEVICETYPE_DEVICE_CLASS = {'motionsensor': 'motion',
|
||||
'contactsensor': 'opening'}
|
||||
DEVICETYPE_DEVICE_CLASS = {
|
||||
'motionsensor': 'motion',
|
||||
'contactsensor': 'opening',
|
||||
}
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
@ -76,8 +73,8 @@ class HiveBinarySensorEntity(BinarySensorDevice):
|
|||
@property
|
||||
def is_on(self):
|
||||
"""Return true if the binary sensor is on."""
|
||||
return self.session.sensor.get_state(self.node_id,
|
||||
self.node_device_type)
|
||||
return self.session.sensor.get_state(
|
||||
self.node_id, self.node_device_type)
|
||||
|
||||
def update(self):
|
||||
"""Update all Node data from Hive."""
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/climate.hive/
|
||||
"""
|
||||
"""Support for the Hive climate devices."""
|
||||
from homeassistant.components.climate import (
|
||||
ClimateDevice, STATE_AUTO, STATE_HEAT, STATE_OFF, STATE_ON,
|
||||
SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
|
||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
STATE_AUTO, STATE_HEAT, STATE_OFF, STATE_ON, SUPPORT_AUX_HEAT,
|
||||
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice)
|
||||
from homeassistant.components.hive import DATA_HIVE, DOMAIN
|
||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
|
||||
DEPENDENCIES = ['hive']
|
||||
HIVE_TO_HASS_STATE = {'SCHEDULE': STATE_AUTO, 'MANUAL': STATE_HEAT,
|
||||
'ON': STATE_ON, 'OFF': STATE_OFF}
|
||||
HASS_TO_HIVE_STATE = {STATE_AUTO: 'SCHEDULE', STATE_HEAT: 'MANUAL',
|
||||
STATE_ON: 'ON', STATE_OFF: 'OFF'}
|
||||
|
||||
HIVE_TO_HASS_STATE = {
|
||||
'SCHEDULE': STATE_AUTO,
|
||||
'MANUAL': STATE_HEAT,
|
||||
'ON': STATE_ON,
|
||||
'OFF': STATE_OFF,
|
||||
}
|
||||
|
||||
HASS_TO_HIVE_STATE = {
|
||||
STATE_AUTO: 'SCHEDULE',
|
||||
STATE_HEAT: 'MANUAL',
|
||||
STATE_ON: 'ON',
|
||||
STATE_OFF: 'OFF',
|
||||
}
|
||||
|
||||
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE |
|
||||
SUPPORT_OPERATION_MODE |
|
||||
|
@ -42,8 +47,8 @@ class HiveClimateEntity(ClimateDevice):
|
|||
self.thermostat_node_id = hivedevice["Thermostat_NodeID"]
|
||||
self.session = hivesession
|
||||
self.attributes = {}
|
||||
self.data_updatesource = '{}.{}'.format(self.device_type,
|
||||
self.node_id)
|
||||
self.data_updatesource = '{}.{}'.format(
|
||||
self.device_type, self.node_id)
|
||||
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
|
||||
|
||||
if self.device_type == "Heating":
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.hive/
|
||||
"""
|
||||
"""Support for the Hive lights."""
|
||||
from homeassistant.components.hive import DATA_HIVE, DOMAIN
|
||||
from homeassistant.components.light import (ATTR_BRIGHTNESS, ATTR_COLOR_TEMP,
|
||||
ATTR_HS_COLOR,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR_TEMP,
|
||||
SUPPORT_COLOR, Light)
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light)
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
DEPENDENCIES = ['hive']
|
||||
|
@ -35,8 +28,8 @@ class HiveDeviceLight(Light):
|
|||
self.light_device_type = hivedevice["Hive_Light_DeviceType"]
|
||||
self.session = hivesession
|
||||
self.attributes = {}
|
||||
self.data_updatesource = '{}.{}'.format(self.device_type,
|
||||
self.node_id)
|
||||
self.data_updatesource = '{}.{}'.format(
|
||||
self.device_type, self.node_id)
|
||||
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
|
||||
self.session.entities.append(self)
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.hive/
|
||||
"""
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
"""Support for the Hive sensors."""
|
||||
from homeassistant.components.hive import DATA_HIVE, DOMAIN
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
DEPENDENCIES = ['hive']
|
||||
|
||||
FRIENDLY_NAMES = {'Hub_OnlineStatus': 'Hive Hub Status',
|
||||
'Hive_OutsideTemperature': 'Outside Temperature'}
|
||||
DEVICETYPE_ICONS = {'Hub_OnlineStatus': 'mdi:switch',
|
||||
'Hive_OutsideTemperature': 'mdi:thermometer'}
|
||||
FRIENDLY_NAMES = {
|
||||
'Hub_OnlineStatus': 'Hive Hub Status',
|
||||
'Hive_OutsideTemperature': 'Outside Temperature',
|
||||
}
|
||||
|
||||
DEVICETYPE_ICONS = {
|
||||
'Hub_OnlineStatus': 'mdi:switch',
|
||||
'Hive_OutsideTemperature': 'mdi:thermometer',
|
||||
}
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
@ -36,8 +36,8 @@ class HiveSensorEntity(Entity):
|
|||
self.device_type = hivedevice["HA_DeviceType"]
|
||||
self.node_device_type = hivedevice["Hive_DeviceType"]
|
||||
self.session = hivesession
|
||||
self.data_updatesource = '{}.{}'.format(self.device_type,
|
||||
self.node_id)
|
||||
self.data_updatesource = '{}.{}'.format(
|
||||
self.device_type, self.node_id)
|
||||
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
|
||||
self.session.entities.append(self)
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
"""
|
||||
Support for the Hive devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.hive/
|
||||
"""
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
"""Support for the Hive switches."""
|
||||
from homeassistant.components.hive import DATA_HIVE, DOMAIN
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
|
||||
DEPENDENCIES = ['hive']
|
||||
|
||||
|
@ -29,8 +24,8 @@ class HiveDevicePlug(SwitchDevice):
|
|||
self.device_type = hivedevice["HA_DeviceType"]
|
||||
self.session = hivesession
|
||||
self.attributes = {}
|
||||
self.data_updatesource = '{}.{}'.format(self.device_type,
|
||||
self.node_id)
|
||||
self.data_updatesource = '{}.{}'.format(
|
||||
self.device_type, self.node_id)
|
||||
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
|
||||
self.session.entities.append(self)
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HLK-SW16 relay switch.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/hlk_sw16/
|
||||
"""
|
||||
"""Support for HLK-SW16 relay switches."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HLK-SW16 switches.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.hlk_sw16/
|
||||
"""
|
||||
"""Support for HLK-SW16 switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.hlk_sw16 import (
|
||||
|
@ -31,8 +26,8 @@ def devices_from_config(hass, domain_config):
|
|||
return devices
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities,
|
||||
discovery_info=None):
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the HLK-SW16 platform."""
|
||||
async_add_entities(devices_from_config(hass, discovery_info))
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
"""Support for Apple HomeKit.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/homekit/
|
||||
"""
|
||||
"""Support for Apple HomeKit."""
|
||||
import ipaddress
|
||||
import logging
|
||||
from zlib import adler32
|
||||
|
@ -14,19 +10,19 @@ from homeassistant.const import (
|
|||
ATTR_DEVICE_CLASS, ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_IP_ADDRESS, CONF_NAME, CONF_PORT, CONF_TYPE, DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE,
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP,
|
||||
TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entityfilter import FILTER_SCHEMA
|
||||
from homeassistant.util import get_local_ip
|
||||
from homeassistant.util.decorator import Registry
|
||||
|
||||
from .const import (
|
||||
BRIDGE_NAME, CONF_AUTO_START, CONF_ENTITY_CONFIG, CONF_FEATURE_LIST,
|
||||
CONF_FILTER, CONF_SAFE_MODE, DEFAULT_AUTO_START, DEFAULT_PORT,
|
||||
DEFAULT_SAFE_MODE, DEVICE_CLASS_CO,
|
||||
DEVICE_CLASS_CO2, DEVICE_CLASS_PM25, DOMAIN, HOMEKIT_FILE,
|
||||
SERVICE_HOMEKIT_START, TYPE_FAUCET, TYPE_OUTLET, TYPE_SHOWER,
|
||||
TYPE_SPRINKLER, TYPE_SWITCH, TYPE_VALVE)
|
||||
DEFAULT_SAFE_MODE, DEVICE_CLASS_CO, DEVICE_CLASS_CO2, DEVICE_CLASS_PM25,
|
||||
DOMAIN, HOMEKIT_FILE, SERVICE_HOMEKIT_START, TYPE_FAUCET, TYPE_OUTLET,
|
||||
TYPE_SHOWER, TYPE_SPRINKLER, TYPE_SWITCH, TYPE_VALVE)
|
||||
from .util import (
|
||||
show_setup_message, validate_entity_config, validate_media_player_features)
|
||||
|
||||
|
|
|
@ -9,10 +9,9 @@ from pyhap.accessory_driver import AccessoryDriver
|
|||
from pyhap.const import CATEGORY_OTHER
|
||||
|
||||
from homeassistant.const import (
|
||||
__version__, ATTR_BATTERY_CHARGING, ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID,
|
||||
ATTR_SERVICE)
|
||||
from homeassistant.core import callback as ha_callback
|
||||
from homeassistant.core import split_entity_id
|
||||
ATTR_BATTERY_CHARGING, ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_SERVICE,
|
||||
__version__)
|
||||
from homeassistant.core import callback as ha_callback, split_entity_id
|
||||
from homeassistant.helpers.event import (
|
||||
async_track_state_change, track_point_in_utc_time)
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
@ -22,8 +21,7 @@ from .const import (
|
|||
CHAR_BATTERY_LEVEL, CHAR_CHARGING_STATE, CHAR_STATUS_LOW_BATTERY,
|
||||
DEBOUNCE_TIMEOUT, EVENT_HOMEKIT_CHANGED, MANUFACTURER,
|
||||
SERV_BATTERY_SERVICE)
|
||||
from .util import (
|
||||
convert_to_float, show_setup_message, dismiss_setup_message)
|
||||
from .util import convert_to_float, dismiss_setup_message, show_setup_message
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ from homeassistant.const import (
|
|||
STATE_CLOSED, STATE_OPEN)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import debounce, HomeAccessory
|
||||
from .accessories import HomeAccessory, debounce
|
||||
from .const import (
|
||||
CHAR_CURRENT_DOOR_STATE, CHAR_CURRENT_POSITION, CHAR_POSITION_STATE,
|
||||
CHAR_TARGET_DOOR_STATE, CHAR_TARGET_POSITION,
|
||||
SERV_GARAGE_DOOR_OPENER, SERV_WINDOW_COVERING)
|
||||
CHAR_TARGET_DOOR_STATE, CHAR_TARGET_POSITION, SERV_GARAGE_DOOR_OPENER,
|
||||
SERV_WINDOW_COVERING)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.const import (
|
|||
STATE_OFF, STATE_ON)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import debounce, HomeAccessory
|
||||
from .accessories import HomeAccessory, debounce
|
||||
from .const import (
|
||||
CHAR_ACTIVE, CHAR_ROTATION_DIRECTION, CHAR_ROTATION_SPEED, CHAR_SWING_MODE,
|
||||
SERV_FANV2)
|
||||
|
|
|
@ -5,17 +5,17 @@ from pyhap.const import CATEGORY_LIGHTBULB
|
|||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS_PCT, ATTR_COLOR_TEMP, ATTR_HS_COLOR,
|
||||
ATTR_MAX_MIREDS, ATTR_MIN_MIREDS, DOMAIN,
|
||||
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP)
|
||||
ATTR_MAX_MIREDS, ATTR_MIN_MIREDS, DOMAIN, SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR, SUPPORT_COLOR_TEMP)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, SERVICE_TURN_ON,
|
||||
SERVICE_TURN_OFF, STATE_OFF, STATE_ON)
|
||||
ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, SERVICE_TURN_OFF, SERVICE_TURN_ON,
|
||||
STATE_OFF, STATE_ON)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import debounce, HomeAccessory
|
||||
from .accessories import HomeAccessory, debounce
|
||||
from .const import (
|
||||
CHAR_BRIGHTNESS, CHAR_COLOR_TEMPERATURE, CHAR_HUE, CHAR_ON,
|
||||
CHAR_SATURATION, SERV_LIGHTBULB, PROP_MAX_VALUE, PROP_MIN_VALUE)
|
||||
CHAR_SATURATION, PROP_MAX_VALUE, PROP_MIN_VALUE, SERV_LIGHTBULB)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -13,13 +13,19 @@ from .const import CHAR_LOCK_CURRENT_STATE, CHAR_LOCK_TARGET_STATE, SERV_LOCK
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
HASS_TO_HOMEKIT = {STATE_UNLOCKED: 0,
|
||||
STATE_LOCKED: 1,
|
||||
# value 2 is Jammed which hass doesn't have a state for
|
||||
STATE_UNKNOWN: 3}
|
||||
HASS_TO_HOMEKIT = {
|
||||
STATE_UNLOCKED: 0,
|
||||
STATE_LOCKED: 1,
|
||||
# Value 2 is Jammed which hass doesn't have a state for
|
||||
STATE_UNKNOWN: 3,
|
||||
}
|
||||
|
||||
HOMEKIT_TO_HASS = {c: s for s, c in HASS_TO_HOMEKIT.items()}
|
||||
STATE_TO_SERVICE = {STATE_LOCKED: 'lock',
|
||||
STATE_UNLOCKED: 'unlock'}
|
||||
|
||||
STATE_TO_SERVICE = {
|
||||
STATE_LOCKED: 'lock',
|
||||
STATE_UNLOCKED: 'unlock',
|
||||
}
|
||||
|
||||
|
||||
@TYPES.register('Lock')
|
||||
|
@ -45,7 +51,7 @@ class Lock(HomeAccessory):
|
|||
|
||||
def set_state(self, value):
|
||||
"""Set lock state to value if call came from HomeKit."""
|
||||
_LOGGER.debug('%s: Set state to %d', self.entity_id, value)
|
||||
_LOGGER.debug("%s: Set state to %d", self.entity_id, value)
|
||||
self._flag_state = True
|
||||
|
||||
hass_value = HOMEKIT_TO_HASS.get(value)
|
||||
|
@ -62,7 +68,7 @@ class Lock(HomeAccessory):
|
|||
if hass_state in HASS_TO_HOMEKIT:
|
||||
current_lock_state = HASS_TO_HOMEKIT[hass_state]
|
||||
self.char_current_state.set_value(current_lock_state)
|
||||
_LOGGER.debug('%s: Updated current state to %s (%d)',
|
||||
_LOGGER.debug("%s: Updated current state to %s (%d)",
|
||||
self.entity_id, hass_state, current_lock_state)
|
||||
|
||||
# LockTargetState only supports locked and unlocked
|
||||
|
|
|
@ -3,12 +3,12 @@ import logging
|
|||
|
||||
from pyhap.const import CATEGORY_SWITCH
|
||||
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_MEDIA_VOLUME_MUTED, DOMAIN)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, SERVICE_MEDIA_PAUSE, SERVICE_MEDIA_PLAY,
|
||||
SERVICE_MEDIA_STOP, SERVICE_TURN_OFF, SERVICE_TURN_ON, SERVICE_VOLUME_MUTE,
|
||||
STATE_OFF, STATE_PLAYING, STATE_UNKNOWN)
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_MEDIA_VOLUME_MUTED, DOMAIN)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import HomeAccessory
|
||||
|
@ -18,10 +18,12 @@ from .const import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
MODE_FRIENDLY_NAME = {FEATURE_ON_OFF: 'Power',
|
||||
FEATURE_PLAY_PAUSE: 'Play/Pause',
|
||||
FEATURE_PLAY_STOP: 'Play/Stop',
|
||||
FEATURE_TOGGLE_MUTE: 'Mute'}
|
||||
MODE_FRIENDLY_NAME = {
|
||||
FEATURE_ON_OFF: 'Power',
|
||||
FEATURE_PLAY_PAUSE: 'Play/Pause',
|
||||
FEATURE_PLAY_STOP: 'Play/Stop',
|
||||
FEATURE_TOGGLE_MUTE: 'Mute',
|
||||
}
|
||||
|
||||
|
||||
@TYPES.register('MediaPlayer')
|
||||
|
|
|
@ -5,10 +5,10 @@ from pyhap.const import CATEGORY_ALARM_SYSTEM
|
|||
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_CODE, SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_HOME,
|
||||
ATTR_CODE, ATTR_ENTITY_ID, SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_HOME,
|
||||
SERVICE_ALARM_ARM_NIGHT, SERVICE_ALARM_DISARM, STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, STATE_ALARM_TRIGGERED,
|
||||
STATE_ALARM_DISARMED)
|
||||
STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT, STATE_ALARM_DISARMED,
|
||||
STATE_ALARM_TRIGGERED)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import HomeAccessory
|
||||
|
@ -18,17 +18,22 @@ from .const import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
HASS_TO_HOMEKIT = {STATE_ALARM_ARMED_HOME: 0,
|
||||
STATE_ALARM_ARMED_AWAY: 1,
|
||||
STATE_ALARM_ARMED_NIGHT: 2,
|
||||
STATE_ALARM_DISARMED: 3,
|
||||
STATE_ALARM_TRIGGERED: 4}
|
||||
HASS_TO_HOMEKIT = {
|
||||
STATE_ALARM_ARMED_HOME: 0,
|
||||
STATE_ALARM_ARMED_AWAY: 1,
|
||||
STATE_ALARM_ARMED_NIGHT: 2,
|
||||
STATE_ALARM_DISARMED: 3,
|
||||
STATE_ALARM_TRIGGERED: 4,
|
||||
}
|
||||
|
||||
HOMEKIT_TO_HASS = {c: s for s, c in HASS_TO_HOMEKIT.items()}
|
||||
|
||||
STATE_TO_SERVICE = {
|
||||
STATE_ALARM_ARMED_AWAY: SERVICE_ALARM_ARM_AWAY,
|
||||
STATE_ALARM_ARMED_HOME: SERVICE_ALARM_ARM_HOME,
|
||||
STATE_ALARM_ARMED_NIGHT: SERVICE_ALARM_ARM_NIGHT,
|
||||
STATE_ALARM_DISARMED: SERVICE_ALARM_DISARM}
|
||||
STATE_ALARM_DISARMED: SERVICE_ALARM_DISARM,
|
||||
}
|
||||
|
||||
|
||||
@TYPES.register('SecuritySystem')
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from pyhap.const import CATEGORY_SENSOR
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS, ATTR_UNIT_OF_MEASUREMENT, STATE_ON, STATE_HOME,
|
||||
ATTR_DEVICE_CLASS, ATTR_UNIT_OF_MEASUREMENT, STATE_HOME, STATE_ON,
|
||||
TEMP_CELSIUS)
|
||||
|
||||
from . import TYPES
|
||||
|
@ -26,7 +26,7 @@ from .const import (
|
|||
SERV_LIGHT_SENSOR, SERV_MOTION_SENSOR, SERV_OCCUPANCY_SENSOR,
|
||||
SERV_SMOKE_SENSOR, SERV_TEMPERATURE_SENSOR, THRESHOLD_CO, THRESHOLD_CO2)
|
||||
from .util import (
|
||||
convert_to_float, temperature_to_homekit, density_to_air_quality)
|
||||
convert_to_float, density_to_air_quality, temperature_to_homekit)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -42,7 +42,8 @@ BINARY_SENSOR_SERVICE_MAP = {
|
|||
DEVICE_CLASS_OCCUPANCY: (SERV_OCCUPANCY_SENSOR, CHAR_OCCUPANCY_DETECTED),
|
||||
DEVICE_CLASS_OPENING: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE),
|
||||
DEVICE_CLASS_SMOKE: (SERV_SMOKE_SENSOR, CHAR_SMOKE_DETECTED),
|
||||
DEVICE_CLASS_WINDOW: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE)}
|
||||
DEVICE_CLASS_WINDOW: (SERV_CONTACT_SENSOR, CHAR_CONTACT_SENSOR_STATE),
|
||||
}
|
||||
|
||||
|
||||
@TYPES.register('TemperatureSensor')
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
import logging
|
||||
|
||||
from pyhap.const import (
|
||||
CATEGORY_FAUCET, CATEGORY_OUTLET, CATEGORY_SHOWER_HEAD,
|
||||
CATEGORY_SPRINKLER, CATEGORY_SWITCH)
|
||||
CATEGORY_FAUCET, CATEGORY_OUTLET, CATEGORY_SHOWER_HEAD, CATEGORY_SPRINKLER,
|
||||
CATEGORY_SWITCH)
|
||||
|
||||
from homeassistant.components.script import ATTR_CAN_CANCEL
|
||||
from homeassistant.components.switch import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, CONF_TYPE, SERVICE_TURN_ON, SERVICE_TURN_OFF, STATE_ON)
|
||||
ATTR_ENTITY_ID, CONF_TYPE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON)
|
||||
from homeassistant.core import split_entity_id
|
||||
from homeassistant.helpers.event import call_later
|
||||
|
||||
|
|
|
@ -5,30 +5,30 @@ from pyhap.const import CATEGORY_THERMOSTAT
|
|||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP,
|
||||
ATTR_OPERATION_LIST, ATTR_OPERATION_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
|
||||
DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, DOMAIN as DOMAIN_CLIMATE,
|
||||
ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP,
|
||||
DOMAIN as DOMAIN_CLIMATE,
|
||||
SERVICE_SET_OPERATION_MODE as SERVICE_SET_OPERATION_MODE_THERMOSTAT,
|
||||
SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_THERMOSTAT,
|
||||
STATE_AUTO, STATE_COOL, STATE_HEAT, SUPPORT_ON_OFF,
|
||||
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
|
||||
SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_THERMOSTAT, STATE_AUTO,
|
||||
STATE_COOL, STATE_HEAT, SUPPORT_ON_OFF, SUPPORT_TARGET_TEMPERATURE_HIGH,
|
||||
SUPPORT_TARGET_TEMPERATURE_LOW)
|
||||
from homeassistant.components.water_heater import (
|
||||
DOMAIN as DOMAIN_WATER_HEATER,
|
||||
SERVICE_SET_TEMPERATURE as SERVICE_SET_TEMPERATURE_WATER_HEATER)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, ATTR_TEMPERATURE,
|
||||
SERVICE_TURN_OFF, SERVICE_TURN_ON,
|
||||
STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||
SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT)
|
||||
|
||||
from . import TYPES
|
||||
from .accessories import debounce, HomeAccessory
|
||||
from .accessories import HomeAccessory, debounce
|
||||
from .const import (
|
||||
CHAR_COOLING_THRESHOLD_TEMPERATURE, CHAR_CURRENT_HEATING_COOLING,
|
||||
CHAR_CURRENT_TEMPERATURE, CHAR_TARGET_HEATING_COOLING,
|
||||
CHAR_HEATING_THRESHOLD_TEMPERATURE, CHAR_TARGET_TEMPERATURE,
|
||||
CHAR_TEMP_DISPLAY_UNITS,
|
||||
DEFAULT_MAX_TEMP_WATER_HEATER, DEFAULT_MIN_TEMP_WATER_HEATER,
|
||||
PROP_MAX_VALUE, PROP_MIN_STEP, PROP_MIN_VALUE, SERV_THERMOSTAT)
|
||||
CHAR_CURRENT_TEMPERATURE, CHAR_HEATING_THRESHOLD_TEMPERATURE,
|
||||
CHAR_TARGET_HEATING_COOLING, CHAR_TARGET_TEMPERATURE,
|
||||
CHAR_TEMP_DISPLAY_UNITS, DEFAULT_MAX_TEMP_WATER_HEATER,
|
||||
DEFAULT_MIN_TEMP_WATER_HEATER, PROP_MAX_VALUE, PROP_MIN_STEP,
|
||||
PROP_MIN_VALUE, SERV_THERMOSTAT)
|
||||
from .util import temperature_to_homekit, temperature_to_states
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""Collection of useful functions for the HomeKit component."""
|
||||
from collections import namedtuple, OrderedDict
|
||||
from collections import OrderedDict, namedtuple
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Homekit device discovery.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit device discovery."""
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
@ -35,7 +30,7 @@ HOMEKIT_ACCESSORY_DISPATCH = {
|
|||
HOMEKIT_IGNORE = [
|
||||
'BSB002',
|
||||
'Home Assistant Bridge',
|
||||
'TRADFRI gateway'
|
||||
'TRADFRI gateway',
|
||||
]
|
||||
|
||||
KNOWN_ACCESSORIES = "{}-accessories".format(DOMAIN)
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
"""
|
||||
Support for Homekit Alarm Control Panel.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/alarm_control_panel.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit Alarm Control Panel."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (HomeKitEntity,
|
||||
KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanel
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME,
|
||||
STATE_ALARM_ARMED_NIGHT, STATE_ALARM_TRIGGERED)
|
||||
from homeassistant.const import ATTR_BATTERY_LEVEL
|
||||
ATTR_BATTERY_LEVEL, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME,
|
||||
STATE_ALARM_ARMED_NIGHT, STATE_ALARM_DISARMED, STATE_ALARM_TRIGGERED)
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
||||
|
@ -25,7 +19,7 @@ CURRENT_STATE_MAP = {
|
|||
1: STATE_ALARM_ARMED_AWAY,
|
||||
2: STATE_ALARM_ARMED_NIGHT,
|
||||
3: STATE_ALARM_DISARMED,
|
||||
4: STATE_ALARM_TRIGGERED
|
||||
4: STATE_ALARM_TRIGGERED,
|
||||
}
|
||||
|
||||
TARGET_STATE_MAP = {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
"""
|
||||
Support for Homekit motion sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit motion sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (HomeKitEntity,
|
||||
KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
"""
|
||||
Support for Homekit climate devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/climate.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit climate devices."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (
|
||||
HomeKitEntity, KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.climate import (
|
||||
ClimateDevice, STATE_HEAT, STATE_COOL, STATE_IDLE,
|
||||
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
|
||||
from homeassistant.const import TEMP_CELSIUS, STATE_OFF, ATTR_TEMPERATURE
|
||||
STATE_COOL, STATE_HEAT, STATE_IDLE, SUPPORT_OPERATION_MODE,
|
||||
SUPPORT_TARGET_TEMPERATURE, ClimateDevice)
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.const import ATTR_TEMPERATURE, STATE_OFF, TEMP_CELSIUS
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
"""
|
||||
Support for Homekit Cover.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/cover.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit covers."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (HomeKitEntity,
|
||||
KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.cover import (
|
||||
CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE, SUPPORT_SET_POSITION,
|
||||
SUPPORT_OPEN_TILT, SUPPORT_CLOSE_TILT, SUPPORT_SET_TILT_POSITION,
|
||||
ATTR_POSITION, ATTR_TILT_POSITION)
|
||||
ATTR_POSITION, ATTR_TILT_POSITION, SUPPORT_CLOSE, SUPPORT_CLOSE_TILT,
|
||||
SUPPORT_OPEN, SUPPORT_OPEN_TILT, SUPPORT_SET_POSITION,
|
||||
SUPPORT_SET_TILT_POSITION, CoverDevice)
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.const import (
|
||||
STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING)
|
||||
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
"""
|
||||
Support for Homekit lights.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit lights."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (
|
||||
HomeKitEntity, KNOWN_ACCESSORIES)
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_COLOR_TEMP, SUPPORT_BRIGHTNESS,
|
||||
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, Light)
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
"""
|
||||
Support for HomeKit Controller locks.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/lock.homekit_controller/
|
||||
"""
|
||||
|
||||
"""Support for HomeKit Controller locks."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (HomeKitEntity,
|
||||
KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.components.lock import LockDevice
|
||||
from homeassistant.const import (STATE_LOCKED, STATE_UNLOCKED,
|
||||
ATTR_BATTERY_LEVEL)
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL, STATE_LOCKED, STATE_UNLOCKED)
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
||||
|
@ -28,7 +22,7 @@ CURRENT_STATE_MAP = {
|
|||
|
||||
TARGET_STATE_MAP = {
|
||||
STATE_UNLOCKED: 0,
|
||||
STATE_LOCKED: 1
|
||||
STATE_LOCKED: 1,
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,8 +31,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
if discovery_info is None:
|
||||
return
|
||||
accessory = hass.data[KNOWN_ACCESSORIES][discovery_info['serial']]
|
||||
add_entities([HomeKitLock(accessory, discovery_info)],
|
||||
True)
|
||||
add_entities([HomeKitLock(accessory, discovery_info)], True)
|
||||
|
||||
|
||||
class HomeKitLock(HomeKitEntity, LockDevice):
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
"""
|
||||
Support for Homekit switches.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.homekit_controller/
|
||||
"""
|
||||
"""Support for Homekit switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homekit_controller import (HomeKitEntity,
|
||||
KNOWN_ACCESSORIES)
|
||||
from homeassistant.components.homekit_controller import (
|
||||
KNOWN_ACCESSORIES, HomeKitEntity)
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
|
||||
DEPENDENCIES = ['homekit_controller']
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HomeMatic devices.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/homematic/
|
||||
"""
|
||||
"""Support for HomeMatic devices."""
|
||||
from datetime import timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
|
@ -13,7 +8,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_NAME, CONF_HOST, CONF_HOSTS, CONF_PASSWORD,
|
||||
CONF_PLATFORM, CONF_USERNAME, CONF_SSL, CONF_VERIFY_SSL,
|
||||
CONF_PLATFORM, CONF_SSL, CONF_USERNAME, CONF_VERIFY_SSL,
|
||||
EVENT_HOMEASSISTANT_STOP, STATE_UNKNOWN)
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HomeMatic binary sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.homematic/
|
||||
"""
|
||||
"""Support for HomeMatic binary sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Homematic thermostats.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/climate.homematic/
|
||||
"""
|
||||
"""Support for Homematic thermostats."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
The HomeMatic cover platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/cover.homematic/
|
||||
"""
|
||||
"""Support for HomeMatic covers."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
"""
|
||||
Support for Homematic lights.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.homematic/
|
||||
"""
|
||||
"""Support for Homematic lights."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, ATTR_HS_COLOR, SUPPORT_COLOR,
|
||||
ATTR_EFFECT, SUPPORT_EFFECT, Light)
|
||||
ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR, SUPPORT_EFFECT, Light)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for Homematic lock.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/lock.homematic/
|
||||
"""
|
||||
"""Support for Homematic locks."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice
|
||||
|
|
|
@ -8,12 +8,12 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
BaseNotificationService, PLATFORM_SCHEMA, ATTR_DATA)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.homematic import (
|
||||
DOMAIN, SERVICE_SET_DEVICE_VALUE, ATTR_ADDRESS, ATTR_CHANNEL, ATTR_PARAM,
|
||||
ATTR_VALUE, ATTR_INTERFACE)
|
||||
ATTR_ADDRESS, ATTR_CHANNEL, ATTR_INTERFACE, ATTR_PARAM, ATTR_VALUE, DOMAIN,
|
||||
SERVICE_SET_DEVICE_VALUE)
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA, PLATFORM_SCHEMA, BaseNotificationService)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.helpers.template as template_helper
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
The HomeMatic sensor platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.homematic/
|
||||
"""
|
||||
"""Support for HomeMatic sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice
|
||||
|
@ -14,26 +9,14 @@ _LOGGER = logging.getLogger(__name__)
|
|||
DEPENDENCIES = ['homematic']
|
||||
|
||||
HM_STATE_HA_CAST = {
|
||||
'RotaryHandleSensor': {0: 'closed',
|
||||
1: 'tilted',
|
||||
2: 'open'},
|
||||
'RotaryHandleSensorIP': {0: 'closed',
|
||||
1: 'tilted',
|
||||
2: 'open'},
|
||||
'WaterSensor': {0: 'dry',
|
||||
1: 'wet',
|
||||
2: 'water'},
|
||||
'CO2Sensor': {0: 'normal',
|
||||
1: 'added',
|
||||
2: 'strong'},
|
||||
'IPSmoke': {0: 'off',
|
||||
1: 'primary',
|
||||
2: 'intrusion',
|
||||
3: 'secondary'},
|
||||
'RFSiren': {0: 'disarmed',
|
||||
1: 'extsens_armed',
|
||||
2: 'allsens_armed',
|
||||
3: 'alarm_blocked'},
|
||||
'RotaryHandleSensor': {0: 'closed', 1: 'tilted', 2: 'open'},
|
||||
'RotaryHandleSensorIP': {0: 'closed', 1: 'tilted', 2: 'open'},
|
||||
'WaterSensor': {0: 'dry', 1: 'wet', 2: 'water'},
|
||||
'CO2Sensor': {0: 'normal', 1: 'added', 2: 'strong'},
|
||||
'IPSmoke': {0: 'off', 1: 'primary', 2: 'intrusion', 3: 'secondary'},
|
||||
'RFSiren': {
|
||||
0: 'disarmed', 1: 'extsens_armed', 2: 'allsens_armed',
|
||||
3: 'alarm_blocked'},
|
||||
}
|
||||
|
||||
HM_UNIT_HA_CAST = {
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HomeMatic switches.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.homematic/
|
||||
"""
|
||||
"""Support for HomeMatic switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud components.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud devices."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud alarm control panel.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/alarm_control_panel.homematicip_cloud/
|
||||
"""
|
||||
|
||||
"""Support for HomematicIP Cloud alarm control panel."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanel
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED,
|
||||
STATE_ALARM_TRIGGERED)
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud binary sensor.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/binary_sensor.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud binary sensor."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
|
||||
DEPENDENCIES = ['homematicip_cloud']
|
||||
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud climate devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/climate.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud climate devices."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_TEMPERATURE, STATE_AUTO, STATE_MANUAL, SUPPORT_TARGET_TEMPERATURE,
|
||||
ClimateDevice)
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -4,9 +4,9 @@ import voluptuous as vol
|
|||
from homeassistant import config_entries
|
||||
from homeassistant.core import callback
|
||||
|
||||
from .const import DOMAIN as HMIPC_DOMAIN
|
||||
from .const import HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, HMIPC_PIN
|
||||
from .const import _LOGGER
|
||||
from .const import (
|
||||
_LOGGER, DOMAIN as HMIPC_DOMAIN, HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME,
|
||||
HMIPC_PIN)
|
||||
from .hap import HomematicipAuth
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,9 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud cover devices.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/cover.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud cover devices."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION, CoverDevice)
|
||||
from homeassistant.components.cover import ATTR_POSITION, CoverDevice
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
HMIPC_HAPID, HomematicipGenericDevice, DOMAIN as HMIPC_DOMAIN)
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
|
||||
DEPENDENCIES = ['homematicip_cloud']
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
||||
from .const import (
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud lights.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud lights."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud sensors.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS)
|
||||
DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE,
|
||||
TEMP_CELSIUS)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
"""
|
||||
Support for HomematicIP Cloud switch.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.homematicip_cloud/
|
||||
"""
|
||||
"""Support for HomematicIP Cloud switches."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
|
||||
DEPENDENCIES = ['homematicip_cloud']
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
"""Component for interfacing to Lutron Homeworks Series 4 and 8 systems.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/homeworks/
|
||||
"""
|
||||
"""Support for Lutron Homeworks Series 4 and 8 systems."""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_ID, CONF_NAME, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
dispatcher_send, async_dispatcher_connect)
|
||||
async_dispatcher_connect, dispatcher_send)
|
||||
from homeassistant.util import slugify
|
||||
|
||||
REQUIREMENTS = ['pyhomeworks==0.0.6']
|
||||
|
@ -39,7 +35,7 @@ CV_FADE_RATE = vol.All(vol.Coerce(float), vol.Range(min=0, max=20))
|
|||
DIMMER_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_ADDR): cv.string,
|
||||
vol.Required(CONF_NAME): cv.string,
|
||||
vol.Optional(CONF_RATE, default=FADE_RATE): CV_FADE_RATE
|
||||
vol.Optional(CONF_RATE, default=FADE_RATE): CV_FADE_RATE,
|
||||
})
|
||||
|
||||
KEYPAD_SCHEMA = vol.Schema({
|
||||
|
@ -52,8 +48,8 @@ CONFIG_SCHEMA = vol.Schema({
|
|||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Required(CONF_PORT): cv.port,
|
||||
vol.Required(CONF_DIMMERS): vol.All(cv.ensure_list, [DIMMER_SCHEMA]),
|
||||
vol.Optional(CONF_KEYPADS, default=[]): vol.All(cv.ensure_list,
|
||||
[KEYPAD_SCHEMA]),
|
||||
vol.Optional(CONF_KEYPADS, default=[]):
|
||||
vol.All(cv.ensure_list, [KEYPAD_SCHEMA]),
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
"""Component for interfacing to Lutron Homeworks lights.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.homeworks/
|
||||
"""
|
||||
"""Support for Lutron Homeworks lights."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.homeworks import (
|
||||
HomeworksDevice, HOMEWORKS_CONTROLLER, ENTITY_SIGNAL,
|
||||
CONF_DIMMERS, CONF_ADDR, CONF_RATE)
|
||||
CONF_ADDR, CONF_DIMMERS, CONF_RATE, ENTITY_SIGNAL, HOMEWORKS_CONTROLLER,
|
||||
HomeworksDevice)
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
async_dispatcher_connect)
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
DEPENDENCIES = ['homeworks']
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
This module provides WSGI application to serve the Home Assistant API.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/http/
|
||||
"""
|
||||
"""Support to serve the Home Assistant API as WSGI application."""
|
||||
from ipaddress import ip_network
|
||||
import logging
|
||||
import os
|
||||
|
@ -18,17 +13,16 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, SERVER_PORT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util as hass_util
|
||||
from homeassistant.util.logging import HideSensitiveDataFilter
|
||||
from homeassistant.util import ssl as ssl_util
|
||||
from homeassistant.util.logging import HideSensitiveDataFilter
|
||||
|
||||
# Import as alias
|
||||
from .auth import setup_auth
|
||||
from .ban import setup_bans
|
||||
from .const import KEY_AUTHENTICATED, KEY_REAL_IP # noqa
|
||||
from .cors import setup_cors
|
||||
from .real_ip import setup_real_ip
|
||||
from .static import CachingFileResponse, CachingStaticResource
|
||||
|
||||
# Import as alias
|
||||
from .const import KEY_AUTHENTICATED, KEY_REAL_IP # noqa
|
||||
from .view import HomeAssistantView # noqa
|
||||
|
||||
REQUIREMENTS = ['aiohttp_cors==0.7.0']
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Authentication for HTTP component."""
|
||||
|
||||
import base64
|
||||
import hmac
|
||||
import logging
|
||||
|
@ -8,20 +7,20 @@ from aiohttp import hdrs
|
|||
from aiohttp.web import middleware
|
||||
import jwt
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import HTTP_HEADER_HA_AUTH
|
||||
from homeassistant.auth.providers import legacy_api_password
|
||||
from homeassistant.auth.util import generate_secret
|
||||
from homeassistant.const import HTTP_HEADER_HA_AUTH
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from .const import KEY_AUTHENTICATED, KEY_REAL_IP
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DATA_API_PASSWORD = 'api_password'
|
||||
DATA_SIGN_SECRET = 'http.auth.sign_secret'
|
||||
SIGN_QUERY_PARAM = 'authSig'
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@callback
|
||||
def async_sign_path(hass, refresh_token_id, path, expiration):
|
||||
|
|
|
@ -9,11 +9,12 @@ from aiohttp.web import middleware
|
|||
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback, HomeAssistant
|
||||
from homeassistant.config import load_yaml_config_file
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util.yaml import dump
|
||||
|
||||
from .const import KEY_REAL_IP
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -26,7 +27,7 @@ NOTIFICATION_ID_BAN = 'ip-ban'
|
|||
NOTIFICATION_ID_LOGIN = 'http-login'
|
||||
|
||||
IP_BANS_FILE = 'ip_bans.yaml'
|
||||
ATTR_BANNED_AT = "banned_at"
|
||||
ATTR_BANNED_AT = 'banned_at'
|
||||
|
||||
SCHEMA_IP_BAN_ENTRY = vol.Schema({
|
||||
vol.Optional('banned_at'): vol.Any(None, cv.datetime)
|
||||
|
@ -52,7 +53,7 @@ def setup_bans(hass, app, login_threshold):
|
|||
async def ban_middleware(request, handler):
|
||||
"""IP Ban middleware."""
|
||||
if KEY_BANNED_IPS not in request.app:
|
||||
_LOGGER.error('IP Ban middleware loaded but banned IPs not loaded')
|
||||
_LOGGER.error("IP Ban middleware loaded but banned IPs not loaded")
|
||||
return await handler(request)
|
||||
|
||||
# Verify if IP is not banned
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
"""Provide CORS support for the HTTP component."""
|
||||
|
||||
|
||||
from aiohttp.hdrs import ACCEPT, ORIGIN, CONTENT_TYPE
|
||||
from aiohttp.hdrs import ACCEPT, CONTENT_TYPE, ORIGIN
|
||||
|
||||
from homeassistant.const import (
|
||||
HTTP_HEADER_X_REQUESTED_WITH, HTTP_HEADER_HA_AUTH)
|
||||
|
||||
|
||||
HTTP_HEADER_HA_AUTH, HTTP_HEADER_X_REQUESTED_WITH)
|
||||
from homeassistant.core import callback
|
||||
|
||||
|
||||
ALLOWED_CORS_HEADERS = [
|
||||
ORIGIN, ACCEPT, HTTP_HEADER_X_REQUESTED_WITH, CONTENT_TYPE,
|
||||
HTTP_HEADER_HA_AUTH]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Decorator for view methods to help with data validation."""
|
||||
|
||||
from functools import wraps
|
||||
import logging
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
"""Middleware to fetch real IP."""
|
||||
|
||||
from ipaddress import ip_address
|
||||
|
||||
from aiohttp.web import middleware
|
||||
from aiohttp.hdrs import X_FORWARDED_FOR
|
||||
from aiohttp.web import middleware
|
||||
|
||||
from homeassistant.core import callback
|
||||
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
"""
|
||||
This module provides WSGI application to serve the Home Assistant API.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/http/
|
||||
"""
|
||||
"""Support for views."""
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp.web_exceptions import (
|
||||
HTTPUnauthorized, HTTPInternalServerError, HTTPBadRequest)
|
||||
HTTPBadRequest, HTTPInternalServerError, HTTPUnauthorized)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.http.ban import process_success_login
|
||||
from homeassistant.core import Context, is_callback
|
||||
from homeassistant.const import CONTENT_TYPE_JSON
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.components.http.ban import process_success_login
|
||||
from homeassistant.const import CONTENT_TYPE_JSON
|
||||
from homeassistant.core import Context, is_callback
|
||||
from homeassistant.helpers.json import JSONEncoder
|
||||
|
||||
from .const import KEY_AUTHENTICATED, KEY_REAL_IP
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue