Extract core into own submodule
parent
60abaa585c
commit
1b89a502c4
|
@ -13,7 +13,7 @@ import os
|
|||
import logging
|
||||
from collections import defaultdict
|
||||
|
||||
import homeassistant
|
||||
import homeassistant.core as core
|
||||
import homeassistant.util.dt as date_util
|
||||
import homeassistant.util.package as pkg_util
|
||||
import homeassistant.util.location as loc_util
|
||||
|
@ -152,9 +152,9 @@ def from_config_dict(config, hass=None):
|
|||
Dynamically loads required components and its dependencies.
|
||||
"""
|
||||
if hass is None:
|
||||
hass = homeassistant.HomeAssistant()
|
||||
hass = core.HomeAssistant()
|
||||
|
||||
process_ha_core_config(hass, config.get(homeassistant.DOMAIN, {}))
|
||||
process_ha_core_config(hass, config.get(core.DOMAIN, {}))
|
||||
|
||||
enable_logging(hass)
|
||||
|
||||
|
@ -168,7 +168,7 @@ def from_config_dict(config, hass=None):
|
|||
|
||||
# Filter out the repeating and common config section [homeassistant]
|
||||
components = (key for key in config.keys()
|
||||
if ' ' not in key and key != homeassistant.DOMAIN)
|
||||
if ' ' not in key and key != core.DOMAIN)
|
||||
|
||||
if not core_components.setup(hass, config):
|
||||
_LOGGER.error('Home Assistant core failed to initialize. '
|
||||
|
@ -192,7 +192,7 @@ def from_config_file(config_path, hass=None):
|
|||
instantiates a new Home Assistant object if 'hass' is not given.
|
||||
"""
|
||||
if hass is None:
|
||||
hass = homeassistant.HomeAssistant()
|
||||
hass = core.HomeAssistant()
|
||||
|
||||
# Set config dir to directory holding config file
|
||||
hass.config.config_dir = os.path.abspath(os.path.dirname(config_path))
|
||||
|
@ -222,7 +222,8 @@ def enable_logging(hass):
|
|||
}
|
||||
))
|
||||
except ImportError:
|
||||
_LOGGER.warn("Colorlog package not found, console coloring disabled")
|
||||
_LOGGER.warning(
|
||||
"Colorlog package not found, console coloring disabled")
|
||||
|
||||
# Log errors to a file if we have write access to file or config dir
|
||||
err_log_path = hass.config.path('home-assistant.log')
|
||||
|
|
|
@ -17,7 +17,7 @@ Each component should publish services only under its own domain.
|
|||
import itertools as it
|
||||
import logging
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util as util
|
||||
from homeassistant.helpers import extract_entity_ids
|
||||
from homeassistant.loader import get_component
|
||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
|||
import threading
|
||||
import json
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.helpers.state import TrackStates
|
||||
import homeassistant.remote as rem
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -8,7 +8,7 @@ This is more a proof of concept.
|
|||
import logging
|
||||
import re
|
||||
|
||||
import homeassistant
|
||||
from homeassistant import core
|
||||
from homeassistant.const import (
|
||||
ATTR_FRIENDLY_NAME, ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF)
|
||||
|
||||
|
@ -52,16 +52,14 @@ def setup(hass, config):
|
|||
return
|
||||
|
||||
if command == 'on':
|
||||
hass.services.call(
|
||||
homeassistant.DOMAIN, SERVICE_TURN_ON, {
|
||||
ATTR_ENTITY_ID: entity_ids,
|
||||
}, blocking=True)
|
||||
hass.services.call(core.DOMAIN, SERVICE_TURN_ON, {
|
||||
ATTR_ENTITY_ID: entity_ids,
|
||||
}, blocking=True)
|
||||
|
||||
elif command == 'off':
|
||||
hass.services.call(
|
||||
homeassistant.DOMAIN, SERVICE_TURN_OFF, {
|
||||
ATTR_ENTITY_ID: entity_ids,
|
||||
}, blocking=True)
|
||||
hass.services.call(core.DOMAIN, SERVICE_TURN_OFF, {
|
||||
ATTR_ENTITY_ID: entity_ids,
|
||||
}, blocking=True)
|
||||
|
||||
else:
|
||||
logger.error(
|
||||
|
|
|
@ -6,7 +6,7 @@ Sets up a demo environment that mimics interaction with devices.
|
|||
"""
|
||||
import time
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
import homeassistant.loader as loader
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,7 +5,7 @@ homeassistant.components.group
|
|||
Provides functionality to group devices that can be turned on or off.
|
||||
"""
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.helpers import generate_entity_id
|
||||
from homeassistant.helpers.event import track_state_change
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
|
|
@ -86,7 +86,7 @@ from http import cookies
|
|||
from socketserver import ThreadingMixIn
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.const import (
|
||||
SERVER_PORT, CONTENT_TYPE_JSON,
|
||||
HTTP_HEADER_HA_AUTH, HTTP_HEADER_CONTENT_TYPE, HTTP_HEADER_ACCEPT_ENCODING,
|
||||
|
|
|
@ -8,7 +8,7 @@ from datetime import timedelta
|
|||
from itertools import groupby
|
||||
import re
|
||||
|
||||
from homeassistant import State, DOMAIN as HA_DOMAIN
|
||||
from homeassistant.core import State, DOMAIN as HA_DOMAIN
|
||||
from homeassistant.const import (
|
||||
EVENT_STATE_CHANGED, STATE_HOME, STATE_ON, STATE_OFF,
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, HTTP_BAD_REQUEST)
|
||||
|
|
|
@ -46,7 +46,7 @@ The keep alive in seconds for this client. Default is 60.
|
|||
import logging
|
||||
import socket
|
||||
|
||||
from homeassistant import HomeAssistantError
|
||||
from homeassistant.core import HomeAssistantError
|
||||
import homeassistant.util as util
|
||||
from homeassistant.helpers import validate_config
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -13,7 +13,7 @@ from datetime import datetime, date
|
|||
import json
|
||||
import atexit
|
||||
|
||||
from homeassistant import Event, EventOrigin, State
|
||||
from homeassistant.core import Event, EventOrigin, State
|
||||
import homeassistant.util.dt as date_util
|
||||
from homeassistant.remote import JSONEncoder
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -18,7 +18,7 @@ old state will not be restored when it is being deactivated.
|
|||
import logging
|
||||
from collections import namedtuple
|
||||
|
||||
from homeassistant import State
|
||||
from homeassistant.core import State
|
||||
from homeassistant.helpers.event import track_state_change
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
|
|
|
@ -7,7 +7,7 @@ Module to help with parsing and generating configuration files.
|
|||
import logging
|
||||
import os
|
||||
|
||||
from homeassistant import HomeAssistantError
|
||||
from homeassistant.core import HomeAssistantError
|
||||
from homeassistant.const import (
|
||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
|
||||
CONF_TIME_ZONE)
|
||||
|
|
|
@ -7,7 +7,7 @@ Provides ABC for entities in HA.
|
|||
|
||||
from collections import defaultdict
|
||||
|
||||
from homeassistant import NoEntitySpecifiedError
|
||||
from homeassistant.core import NoEntitySpecifiedError
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_FRIENDLY_NAME, ATTR_UNIT_OF_MEASUREMENT, ATTR_HIDDEN,
|
||||
|
|
|
@ -6,7 +6,7 @@ Helpers that help with state related things.
|
|||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant import State
|
||||
from homeassistant.core import State
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
|
||||
|
|
|
@ -17,7 +17,7 @@ import urllib.parse
|
|||
|
||||
import requests
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
from datetime import timedelta
|
||||
from unittest import mock
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util.location as location_util
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.components.automation.event as event
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.components.automation.event as event
|
||||
from homeassistant.const import CONF_PLATFORM, ATTR_ENTITY_ID
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.components.automation.mqtt as mqtt
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.components.automation.state as state
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.loader as loader
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.automation as automation
|
||||
|
|
|
@ -10,7 +10,7 @@ import json
|
|||
|
||||
import requests
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
import homeassistant.remote as remote
|
||||
import homeassistant.components.http as http
|
||||
|
|
|
@ -7,7 +7,7 @@ Tests Configurator component.
|
|||
# pylint: disable=too-many-public-methods,protected-access
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.configurator as configurator
|
||||
from homeassistant.const import EVENT_TIME_CHANGED
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Tests demo component.
|
|||
"""
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.components.demo as demo
|
||||
|
||||
from tests.common import mock_http_component
|
||||
|
|
|
@ -10,7 +10,7 @@ from datetime import timedelta
|
|||
import logging
|
||||
import os
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.loader as loader
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -10,7 +10,7 @@ import unittest
|
|||
|
||||
import requests
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
import homeassistant.components.http as http
|
||||
from homeassistant.const import HTTP_HEADER_HA_AUTH
|
||||
|
|
|
@ -8,7 +8,7 @@ Tests the group compoments.
|
|||
import unittest
|
||||
import logging
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN
|
||||
import homeassistant.components.group as group
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import time
|
|||
import os
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components import history, recorder
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Tests core compoments.
|
|||
# pylint: disable=protected-access,too-many-public-methods
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.loader as loader
|
||||
from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF)
|
||||
|
|
|
@ -8,7 +8,7 @@ Tests the logbook component.
|
|||
import unittest
|
||||
from datetime import timedelta
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.const import (
|
||||
EVENT_STATE_CHANGED, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
|
|
@ -8,7 +8,7 @@ Tests media_player component.
|
|||
import logging
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
SERVICE_TURN_ON, SERVICE_TURN_OFF, SERVICE_VOLUME_UP, SERVICE_VOLUME_DOWN,
|
||||
|
|
|
@ -10,7 +10,7 @@ from datetime import timedelta
|
|||
|
||||
from astral import Astral
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.sun as sun
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Tests the entity helper.
|
|||
# pylint: disable=protected-access,too-many-public-methods
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.helpers.entity as entity
|
||||
from homeassistant.const import ATTR_HIDDEN
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Tests event helpers.
|
|||
import unittest
|
||||
from datetime import datetime
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
from homeassistant.helpers.event import *
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import unittest
|
|||
|
||||
from common import get_test_home_assistant
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.loader as loader
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ENTITY_ID
|
||||
from homeassistant.helpers import extract_entity_ids
|
||||
|
|
|
@ -9,7 +9,7 @@ import unittest
|
|||
import unittest.mock as mock
|
||||
import os
|
||||
|
||||
from homeassistant import DOMAIN, HomeAssistantError
|
||||
from homeassistant.core import DOMAIN, HomeAssistantError
|
||||
import homeassistant.config as config_util
|
||||
from homeassistant.const import (
|
||||
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
|
||||
|
|
|
@ -9,7 +9,7 @@ Uses port 8125 as a port that nothing runs on
|
|||
# pylint: disable=protected-access,too-many-public-methods
|
||||
import unittest
|
||||
|
||||
import homeassistant as ha
|
||||
import homeassistant.core as ha
|
||||
import homeassistant.bootstrap as bootstrap
|
||||
import homeassistant.remote as remote
|
||||
import homeassistant.components.http as http
|
||||
|
|
Loading…
Reference in New Issue