Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/azerty9971/HAcore into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
azerty9971 committed Jun 21, 2024
2 parents 723af3e + f0da107 commit 83f1b4e
Show file tree
Hide file tree
Showing 535 changed files with 8,545 additions and 6,874 deletions.
6 changes: 1 addition & 5 deletions .core_files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,20 @@ tests: &tests
- pylint/**
- requirements_test_pre_commit.txt
- requirements_test.txt
- tests/*.py
- tests/auth/**
- tests/backports/**
- tests/common.py
- tests/components/history/**
- tests/components/logbook/**
- tests/components/recorder/**
- tests/components/sensor/**
- tests/conftest.py
- tests/hassfest/**
- tests/helpers/**
- tests/ignore_uncaught_exceptions.py
- tests/mock/**
- tests/pylint/**
- tests/scripts/**
- tests/syrupy.py
- tests/test_util/**
- tests/testing_config/**
- tests/typing.py
- tests/util/**

other: &other
Expand Down
6 changes: 4 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ omit =
homeassistant/components/apsystems/__init__.py
homeassistant/components/apsystems/coordinator.py
homeassistant/components/apsystems/entity.py
homeassistant/components/apsystems/number.py
homeassistant/components/apsystems/sensor.py
homeassistant/components/aqualogic/*
homeassistant/components/aquostv/media_player.py
Expand Down Expand Up @@ -120,6 +121,7 @@ omit =
homeassistant/components/awair/coordinator.py
homeassistant/components/azure_service_bus/*
homeassistant/components/baf/__init__.py
homeassistant/components/baf/binary_sensor.py
homeassistant/components/baf/climate.py
homeassistant/components/baf/entity.py
homeassistant/components/baf/fan.py
Expand Down Expand Up @@ -180,7 +182,6 @@ omit =
homeassistant/components/canary/camera.py
homeassistant/components/cert_expiry/helper.py
homeassistant/components/channels/*
homeassistant/components/circuit/*
homeassistant/components/cisco_ios/device_tracker.py
homeassistant/components/cisco_mobility_express/device_tracker.py
homeassistant/components/cisco_webex_teams/notify.py
Expand Down Expand Up @@ -853,6 +854,7 @@ omit =
homeassistant/components/nad/media_player.py
homeassistant/components/nanoleaf/__init__.py
homeassistant/components/nanoleaf/button.py
homeassistant/components/nanoleaf/coordinator.py
homeassistant/components/nanoleaf/entity.py
homeassistant/components/nanoleaf/light.py
homeassistant/components/neato/__init__.py
Expand Down Expand Up @@ -1061,7 +1063,6 @@ omit =
homeassistant/components/pushbullet/sensor.py
homeassistant/components/pushover/notify.py
homeassistant/components/pushsafer/notify.py
homeassistant/components/pyload/sensor.py
homeassistant/components/qbittorrent/__init__.py
homeassistant/components/qbittorrent/coordinator.py
homeassistant/components/qbittorrent/sensor.py
Expand Down Expand Up @@ -1109,6 +1110,7 @@ omit =
homeassistant/components/refoss/bridge.py
homeassistant/components/refoss/coordinator.py
homeassistant/components/refoss/entity.py
homeassistant/components/refoss/sensor.py
homeassistant/components/refoss/switch.py
homeassistant/components/refoss/util.py
homeassistant/components/rejseplanen/sensor.py
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"python.pythonPath": "/home/vscode/.local/ha-venv/bin/python",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.testing.pytestArgs": ["--no-cov"],
"pylint.importStrategy": "fromEnvironment",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ jobs:
pattern: coverage-*
- name: Upload coverage to Codecov
if: needs.info.outputs.test_full_suite == 'true'
uses: codecov/codecov-action@v4.4.1
uses: codecov/codecov-action@v4.5.0
with:
fail_ci_if_error: true
flags: full-suite
Expand Down Expand Up @@ -1244,7 +1244,7 @@ jobs:
pattern: coverage-*
- name: Upload coverage to Codecov
if: needs.info.outputs.test_full_suite == 'false'
uses: codecov/codecov-action@v4.4.1
uses: codecov/codecov-action@v4.5.0
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
uses: actions/checkout@v4.1.7

- name: Initialize CodeQL
uses: github/codeql-action/init@v3.25.9
uses: github/codeql-action/init@v3.25.10
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.25.9
uses: github/codeql-action/analyze@v3.25.10
with:
category: "/language:python"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.4.9
hooks:
- id: ruff
args:
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
// https://github.com/microsoft/vscode-python/issues/14067
"python.testing.pytestArgs": ["--no-cov"],
// https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings
"python.testing.pytestEnabled": false
"python.testing.pytestEnabled": false,
// https://code.visualstudio.com/docs/python/linting#_general-settings
"pylint.importStrategy": "fromEnvironment"
}
11 changes: 6 additions & 5 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ build.json @home-assistant/supervisor
/tests/components/ccm15/ @ocalvo
/homeassistant/components/cert_expiry/ @jjlawren
/tests/components/cert_expiry/ @jjlawren
/homeassistant/components/circuit/ @braam
/homeassistant/components/cisco_ios/ @fbradyirl
/homeassistant/components/cisco_mobility_express/ @fbradyirl
/homeassistant/components/cisco_webex_teams/ @fbradyirl
Expand Down Expand Up @@ -910,8 +909,8 @@ build.json @home-assistant/supervisor
/tests/components/myuplink/ @pajzo @astrandb
/homeassistant/components/nam/ @bieniu
/tests/components/nam/ @bieniu
/homeassistant/components/nanoleaf/ @milanmeu
/tests/components/nanoleaf/ @milanmeu
/homeassistant/components/nanoleaf/ @milanmeu @joostlek
/tests/components/nanoleaf/ @milanmeu @joostlek
/homeassistant/components/neato/ @Santobert
/tests/components/neato/ @Santobert
/homeassistant/components/nederlandse_spoorwegen/ @YarmoM
Expand Down Expand Up @@ -1100,6 +1099,8 @@ build.json @home-assistant/supervisor
/tests/components/pvoutput/ @frenck
/homeassistant/components/pvpc_hourly_pricing/ @azogue
/tests/components/pvpc_hourly_pricing/ @azogue
/homeassistant/components/pyload/ @tr4nt0r
/tests/components/pyload/ @tr4nt0r
/homeassistant/components/qbittorrent/ @geoffreylagaisse @finder39
/tests/components/qbittorrent/ @geoffreylagaisse @finder39
/homeassistant/components/qingping/ @bdraco
Expand Down Expand Up @@ -1303,8 +1304,8 @@ build.json @home-assistant/supervisor
/homeassistant/components/solaredge/ @frenck @bdraco
/tests/components/solaredge/ @frenck @bdraco
/homeassistant/components/solaredge_local/ @drobtravels @scheric
/homeassistant/components/solarlog/ @Ernst79
/tests/components/solarlog/ @Ernst79
/homeassistant/components/solarlog/ @Ernst79 @dontinelli
/tests/components/solarlog/ @Ernst79 @dontinelli
/homeassistant/components/solax/ @squishykid
/tests/components/solax/ @squishykid
/homeassistant/components/soma/ @ratsept @sebfortier2288
Expand Down
123 changes: 0 additions & 123 deletions homeassistant/auth/providers/legacy_api_password.py

This file was deleted.

61 changes: 39 additions & 22 deletions homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,39 @@ async def async_setup_hass(
runtime_config: RuntimeConfig,
) -> core.HomeAssistant | None:
"""Set up Home Assistant."""
hass = core.HomeAssistant(runtime_config.config_dir)

async_enable_logging(
hass,
runtime_config.verbose,
runtime_config.log_rotate_days,
runtime_config.log_file,
runtime_config.log_no_color,
)

if runtime_config.debug or hass.loop.get_debug():
hass.config.debug = True
def create_hass() -> core.HomeAssistant:
"""Create the hass object and do basic setup."""
hass = core.HomeAssistant(runtime_config.config_dir)
loader.async_setup(hass)

async_enable_logging(
hass,
runtime_config.verbose,
runtime_config.log_rotate_days,
runtime_config.log_file,
runtime_config.log_no_color,
)

if runtime_config.debug or hass.loop.get_debug():
hass.config.debug = True

hass.config.safe_mode = runtime_config.safe_mode
hass.config.skip_pip = runtime_config.skip_pip
hass.config.skip_pip_packages = runtime_config.skip_pip_packages

return hass

async def stop_hass(hass: core.HomeAssistant) -> None:
"""Stop hass."""
# Ask integrations to shut down. It's messy but we can't
# do a clean stop without knowing what is broken
with contextlib.suppress(TimeoutError):
async with hass.timeout.async_timeout(10):
await hass.async_stop()

hass = create_hass()

hass.config.safe_mode = runtime_config.safe_mode
hass.config.skip_pip = runtime_config.skip_pip
hass.config.skip_pip_packages = runtime_config.skip_pip_packages
if runtime_config.skip_pip or runtime_config.skip_pip_packages:
_LOGGER.warning(
"Skipping pip installation of required modules. This may cause issues"
Expand All @@ -283,7 +300,6 @@ async def async_setup_hass(

_LOGGER.info("Config directory: %s", runtime_config.config_dir)

loader.async_setup(hass)
block_async_io.enable()

config_dict = None
Expand All @@ -309,27 +325,28 @@ async def async_setup_hass(

if config_dict is None:
recovery_mode = True
await stop_hass(hass)
hass = create_hass()

elif not basic_setup_success:
_LOGGER.warning("Unable to set up core integrations. Activating recovery mode")
recovery_mode = True
await stop_hass(hass)
hass = create_hass()

elif any(domain not in hass.config.components for domain in CRITICAL_INTEGRATIONS):
_LOGGER.warning(
"Detected that %s did not load. Activating recovery mode",
",".join(CRITICAL_INTEGRATIONS),
)
# Ask integrations to shut down. It's messy but we can't
# do a clean stop without knowing what is broken
with contextlib.suppress(TimeoutError):
async with hass.timeout.async_timeout(10):
await hass.async_stop()

recovery_mode = True
old_config = hass.config
old_logging = hass.data.get(DATA_LOGGING)

hass = core.HomeAssistant(old_config.config_dir)
recovery_mode = True
await stop_hass(hass)
hass = create_hass()

if old_logging:
hass.data[DATA_LOGGING] = old_logging
hass.config.debug = old_config.debug
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/air_quality/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType, StateType

from . import group as group_pre_import # noqa: F401
from .const import DOMAIN

_LOGGER: Final = logging.getLogger(__name__)
Expand Down
Loading

0 comments on commit 83f1b4e

Please sign in to comment.