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