diff --git a/docs/source/conf.py b/docs/source/conf.py index 8ca22e1a126bda..595c15717eb412 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,15 +19,13 @@ # import sys import os -from os.path import relpath import inspect -from homeassistant.const import (__version__, __short_version__, PROJECT_NAME, - PROJECT_LONG_DESCRIPTION, - PROJECT_COPYRIGHT, PROJECT_AUTHOR, - PROJECT_GITHUB_USERNAME, - PROJECT_GITHUB_REPOSITORY, - GITHUB_PATH, GITHUB_URL) +from homeassistant.const import __version__, __short_version__ +from setup import ( + PROJECT_NAME, PROJECT_LONG_DESCRIPTION, PROJECT_COPYRIGHT, PROJECT_AUTHOR, + PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY, GITHUB_PATH, + GITHUB_URL) sys.path.insert(0, os.path.abspath('_ext')) sys.path.insert(0, os.path.abspath('../homeassistant')) @@ -87,9 +85,7 @@ def linkcode_resolve(domain, info): - """ - Determine the URL corresponding to Python object - """ + """Determine the URL corresponding to Python object.""" if domain != 'py': return None modname = info['module'] diff --git a/homeassistant/components/dialogflow.py b/homeassistant/components/dialogflow.py index 3f2cae112f564f..726b8d99e01d62 100644 --- a/homeassistant/components/dialogflow.py +++ b/homeassistant/components/dialogflow.py @@ -9,7 +9,7 @@ import voluptuous as vol -from homeassistant.const import PROJECT_NAME, HTTP_BAD_REQUEST +from homeassistant.const import HTTP_BAD_REQUEST from homeassistant.helpers import intent, template from homeassistant.components.http import HomeAssistantView @@ -26,6 +26,8 @@ INTENTS_API_ENDPOINT = '/api/dialogflow' +SOURCE = "Home Assistant Dialogflow" + CONFIG_SCHEMA = vol.Schema({ DOMAIN: {} }, extra=vol.ALLOW_EXTRA) @@ -128,5 +130,5 @@ def as_dict(self): return { 'speech': self.speech, 'displayText': self.speech, - 'source': PROJECT_NAME, + 'source': SOURCE, } diff --git a/homeassistant/components/no_ip.py b/homeassistant/components/no_ip.py index d92cd752aefdbf..48bd681ac62abf 100644 --- a/homeassistant/components/no_ip.py +++ b/homeassistant/components/no_ip.py @@ -16,13 +16,16 @@ import homeassistant.helpers.config_validation as cv from homeassistant.const import ( CONF_DOMAIN, CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME, HTTP_HEADER_AUTH, - HTTP_HEADER_USER_AGENT, PROJECT_EMAIL) + HTTP_HEADER_USER_AGENT) from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE _LOGGER = logging.getLogger(__name__) DOMAIN = 'no_ip' +# We should set a dedicated address for the user agent. +EMAIL = 'hello@home-assistant.io' + INTERVAL = timedelta(minutes=5) DEFAULT_TIMEOUT = 10 @@ -38,7 +41,7 @@ } UPDATE_URL = 'https://dynupdate.noip.com/nic/update' -USER_AGENT = "{} {}".format(SERVER_SOFTWARE, PROJECT_EMAIL) +USER_AGENT = "{} {}".format(SERVER_SOFTWARE, EMAIL) CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ diff --git a/homeassistant/const.py b/homeassistant/const.py index aef543e3666ff4..f9a1ed13e220c1 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -9,37 +9,7 @@ REQUIRED_PYTHON_VER_WIN = (3, 5, 2) CONSTRAINT_FILE = 'package_constraints.txt' -PROJECT_NAME = 'Home Assistant' -PROJECT_PACKAGE_NAME = 'homeassistant' -PROJECT_LICENSE = 'Apache License 2.0' -PROJECT_AUTHOR = 'The Home Assistant Authors' -PROJECT_COPYRIGHT = ' 2013, {}'.format(PROJECT_AUTHOR) -PROJECT_URL = 'https://home-assistant.io/' -PROJECT_EMAIL = 'hello@home-assistant.io' -PROJECT_DESCRIPTION = ('Open-source home automation platform ' - 'running on Python 3.') -PROJECT_LONG_DESCRIPTION = ('Home Assistant is an open-source ' - 'home automation platform running on Python 3. ' - 'Track and control all devices at home and ' - 'automate control. ' - 'Installation in less than a minute.') -PROJECT_CLASSIFIERS = [ - 'Intended Audience :: End Users/Desktop', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.4', - 'Topic :: Home Automation' -] - -PROJECT_GITHUB_USERNAME = 'home-assistant' -PROJECT_GITHUB_REPOSITORY = 'home-assistant' - -PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME) -GITHUB_PATH = '{}/{}'.format(PROJECT_GITHUB_USERNAME, - PROJECT_GITHUB_REPOSITORY) -GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH) - +# Format for platforms PLATFORM_FORMAT = '{}.{}' # Can be used to specify a catch all when registering state or event listeners. @@ -48,8 +18,7 @@ # If no name is specified DEVICE_DEFAULT_NAME = 'Unnamed Device' -WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] - +# Sun events SUN_EVENT_SUNSET = 'sunset' SUN_EVENT_SUNRISE = 'sunrise' @@ -463,3 +432,5 @@ TEMPERATURE = 'temperature' # type: str SPEED_MS = 'speed_ms' # type: str ILLUMINANCE = 'illuminance' # type: str + +WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] diff --git a/homeassistant/setup.py b/homeassistant/setup.py index a7083d010e6d88..05a8ee1e2f19c7 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -1,6 +1,5 @@ """All methods needed to bootstrap a Home Assistant instance.""" import asyncio -import logging import logging.handlers import os from timeit import default_timer as timer @@ -9,13 +8,13 @@ from typing import Optional, Dict import homeassistant.config as conf_util -from homeassistant.config import async_notify_setup_error import homeassistant.core as core import homeassistant.loader as loader import homeassistant.util.package as pkg_util -from homeassistant.util.async import run_coroutine_threadsafe +from homeassistant.config import async_notify_setup_error from homeassistant.const import ( EVENT_COMPONENT_LOADED, PLATFORM_FORMAT, CONSTRAINT_FILE) +from homeassistant.util.async import run_coroutine_threadsafe _LOGGER = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index cd7043650ad245..2bb78877f6d813 100755 --- a/setup.py +++ b/setup.py @@ -2,15 +2,46 @@ """Home Assistant setup script.""" import os from setuptools import setup, find_packages -from homeassistant.const import (__version__, PROJECT_PACKAGE_NAME, - PROJECT_LICENSE, PROJECT_URL, - PROJECT_EMAIL, PROJECT_DESCRIPTION, - PROJECT_CLASSIFIERS, GITHUB_URL, - PROJECT_AUTHOR) + +from homeassistant.const import __version__ + +PROJECT_NAME = 'Home Assistant' +PROJECT_PACKAGE_NAME = 'homeassistant' +PROJECT_LICENSE = 'Apache License 2.0' +PROJECT_AUTHOR = 'The Home Assistant Authors' +PROJECT_COPYRIGHT = ' 2013-2017, {}'.format(PROJECT_AUTHOR) +PROJECT_URL = 'https://home-assistant.io/' +PROJECT_EMAIL = 'hello@home-assistant.io' +PROJECT_DESCRIPTION = ('Open-source home automation platform ' + 'running on Python 3.') +PROJECT_LONG_DESCRIPTION = ('Home Assistant is an open-source ' + 'home automation platform running on Python 3. ' + 'Track and control all devices at home and ' + 'automate control. ' + 'Installation in less than a minute.') +PROJECT_CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: End Users/Desktop', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Topic :: Home Automation' +] + +PROJECT_GITHUB_USERNAME = 'home-assistant' +PROJECT_GITHUB_REPOSITORY = 'home-assistant' + +PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME) +GITHUB_PATH = '{}/{}'.format( + PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) +GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH) + HERE = os.path.abspath(os.path.dirname(__file__)) -DOWNLOAD_URL = ('{}/archive/' - '{}.zip'.format(GITHUB_URL, __version__)) +DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, __version__) PACKAGES = find_packages(exclude=['tests', 'tests.*'])