mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-05 17:09:36 +00:00
* Add Ingress support to supervisor * Update security * cleanup add-on extraction * update description * fix header part * fix * Fix header check * fix tox * Migrate docker interface typing * Update home assistant to new docker * Migrate supervisor * Fix host add-on problem * Update hassos * Update API * Expose data to API * Check on API ingress support * Add ingress URL * Some cleanups * debug * disable uvloop * Fix issue * test * Fix bug * Fix flow * Fix interface * Fix network * Fix metadata * cleanups * Fix exception * Migrate to token system * Fix webui * Fix update * Fix relaod * Update log messages * Attach ingress url only if enabled * Cleanup ingress url handling * Ingress update * Support check version * Fix raise error * Migrate default port * Fix junks * search error * Fix content filter * Add debug * Update log * Update flags * Update documentation * Cleanup debugs * Fix lint * change default port to 8099 * Fix lint * fix lint
61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
"""Main file for Hass.io."""
|
|
import asyncio
|
|
from concurrent.futures import ThreadPoolExecutor
|
|
import logging
|
|
import sys
|
|
|
|
from hassio import bootstrap
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
def initialize_event_loop():
|
|
"""Attempt to use uvloop."""
|
|
try:
|
|
import uvloop
|
|
|
|
uvloop.install()
|
|
except ImportError:
|
|
pass
|
|
|
|
return asyncio.get_event_loop()
|
|
|
|
|
|
# pylint: disable=invalid-name
|
|
if __name__ == "__main__":
|
|
bootstrap.initialize_logging()
|
|
|
|
# Init async event loop
|
|
loop = initialize_event_loop()
|
|
|
|
# Check if all information are available to setup Hass.io
|
|
if not bootstrap.check_environment():
|
|
sys.exit(1)
|
|
|
|
# init executor pool
|
|
executor = ThreadPoolExecutor(thread_name_prefix="SyncWorker")
|
|
loop.set_default_executor(executor)
|
|
|
|
_LOGGER.info("Initialize Hass.io setup")
|
|
coresys = loop.run_until_complete(bootstrap.initialize_coresys())
|
|
|
|
bootstrap.migrate_system_env(coresys)
|
|
|
|
_LOGGER.info("Setup HassIO")
|
|
loop.run_until_complete(coresys.core.setup())
|
|
|
|
loop.call_soon_threadsafe(loop.create_task, coresys.core.start())
|
|
loop.call_soon_threadsafe(bootstrap.reg_signal, loop)
|
|
|
|
try:
|
|
_LOGGER.info("Run Hass.io")
|
|
loop.run_forever()
|
|
finally:
|
|
_LOGGER.info("Stopping Hass.io")
|
|
loop.run_until_complete(coresys.core.stop())
|
|
executor.shutdown(wait=False)
|
|
loop.close()
|
|
|
|
_LOGGER.info("Close Hass.io")
|
|
sys.exit(0)
|