Skip to content

Commit

Permalink
Merge branch 'dev' into aa-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Dec 6, 2023
2 parents 33af0fc + 05e122e commit 519bf77
Show file tree
Hide file tree
Showing 320 changed files with 7,358 additions and 2,534 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fetch-depth: 0

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
uses: actions/checkout@v4.1.1

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}

Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
if: needs.init.outputs.channel == 'dev'
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}

Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:
- name: Check out code from GitHub
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
Expand Down Expand Up @@ -443,7 +443,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
Expand Down Expand Up @@ -511,7 +511,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
Expand Down Expand Up @@ -543,7 +543,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
Expand Down Expand Up @@ -576,7 +576,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
Expand Down Expand Up @@ -620,7 +620,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
Expand Down Expand Up @@ -702,7 +702,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
Expand Down Expand Up @@ -854,7 +854,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
Expand Down Expand Up @@ -978,7 +978,7 @@ jobs:
uses: actions/checkout@v4.1.1
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ matrix.python-version }}
check-latest: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4.1.1

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4.7.1
uses: actions/setup-python@v4.8.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ${BUILD_FROM}

# Synchronize with homeassistant/core.py:async_stop
ENV \
S6_SERVICES_GRACETIME=220000
S6_SERVICES_GRACETIME=240000

ARG QEMU_CPU

Expand Down
5 changes: 4 additions & 1 deletion homeassistant/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .exceptions import HomeAssistantError
from .helpers import (
area_registry,
config_validation as cv,
device_registry,
entity,
entity_registry,
Expand Down Expand Up @@ -473,7 +474,9 @@ async def async_mount_local_lib_path(config_dir: str) -> str:
def _get_domains(hass: core.HomeAssistant, config: dict[str, Any]) -> set[str]:
"""Get domains of components to set up."""
# Filter out the repeating and common config section [homeassistant]
domains = {key.partition(" ")[0] for key in config if key != core.DOMAIN}
domains = {
domain for key in config if (domain := cv.domain_key(key)) != core.DOMAIN
}

# Add config entry domains
if not hass.config.recovery_mode:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/automation/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from homeassistant.components import blueprint
from homeassistant.components.trace import TRACE_CONFIG_SCHEMA
from homeassistant.config import config_without_domain
from homeassistant.config import config_per_platform, config_without_domain
from homeassistant.const import (
CONF_ALIAS,
CONF_CONDITION,
Expand All @@ -21,7 +21,7 @@
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_per_platform, config_validation as cv, script
from homeassistant.helpers import config_validation as cv, script
from homeassistant.helpers.condition import async_validate_conditions_config
from homeassistant.helpers.trigger import async_validate_trigger_config
from homeassistant.helpers.typing import ConfigType
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/balboa/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"host": "[%key:common::config_flow::data::host%]"
},
"data_description": {
"host": "Hostname or IP address of your Balboa Spa Wifi Device. For example, 192.168.1.58."
"host": "Hostname or IP address of your Balboa Spa Wi-Fi Device. For example, 192.168.1.58."
}
}
},
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/blueprint/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def async_reset_cache(self) -> None:
def _load_blueprint(self, blueprint_path) -> Blueprint:
"""Load a blueprint."""
try:
blueprint_data = yaml.load_yaml(self.blueprint_folder / blueprint_path)
blueprint_data = yaml.load_yaml_dict(self.blueprint_folder / blueprint_path)
except FileNotFoundError as err:
raise FailedToLoad(
self.domain,
Expand All @@ -225,7 +225,6 @@ def _load_blueprint(self, blueprint_path) -> Blueprint:
except HomeAssistantError as err:
raise FailedToLoad(self.domain, blueprint_path, err) from err

assert isinstance(blueprint_data, dict)
return Blueprint(
blueprint_data, expected_domain=self.domain, path=blueprint_path
)
Expand Down
22 changes: 14 additions & 8 deletions homeassistant/components/bluetooth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
adapter_unique_name,
get_adapters,
)
from habluetooth import HaBluetoothConnector
from habluetooth import (
BluetoothScanningMode,
HaBluetoothConnector,
HaScanner,
ScannerStartError,
)
from home_assistant_bluetooth import BluetoothServiceInfo, BluetoothServiceInfoBleak

from homeassistant.components import usb
Expand Down Expand Up @@ -76,10 +81,9 @@
LINUX_FIRMWARE_LOAD_FALLBACK_SECONDS,
SOURCE_LOCAL,
)
from .manager import BluetoothManager
from .manager import MONOTONIC_TIME, HomeAssistantBluetoothManager
from .match import BluetoothCallbackMatcher, IntegrationMatcher
from .models import BluetoothCallback, BluetoothChange, BluetoothScanningMode
from .scanner import MONOTONIC_TIME, HaScanner, ScannerStartError
from .models import BluetoothCallback, BluetoothChange
from .storage import BluetoothStorage

if TYPE_CHECKING:
Expand Down Expand Up @@ -139,11 +143,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
await bluetooth_storage.async_setup()
slot_manager = BleakSlotManager()
await slot_manager.async_setup()
manager = BluetoothManager(
manager = HomeAssistantBluetoothManager(
hass, integration_matcher, bluetooth_adapters, bluetooth_storage, slot_manager
)
await manager.async_setup()
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, manager.async_stop)
hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STOP, lambda event: manager.async_stop()
)
hass.data[DATA_MANAGER] = models.MANAGER = manager
adapters = await manager.async_get_bluetooth_adapters()

Expand Down Expand Up @@ -280,8 +286,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
passive = entry.options.get(CONF_PASSIVE)
mode = BluetoothScanningMode.PASSIVE if passive else BluetoothScanningMode.ACTIVE
new_info_callback = async_get_advertisement_callback(hass)
manager: BluetoothManager = hass.data[DATA_MANAGER]
scanner = HaScanner(hass, mode, adapter, address, new_info_callback)
manager: HomeAssistantBluetoothManager = hass.data[DATA_MANAGER]
scanner = HaScanner(mode, adapter, address, new_info_callback)
try:
scanner.async_setup()
except RuntimeError as err:
Expand Down
82 changes: 0 additions & 82 deletions homeassistant/components/bluetooth/advertisement_tracker.py

This file was deleted.

14 changes: 5 additions & 9 deletions homeassistant/components/bluetooth/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,25 @@
from collections.abc import Callable, Iterable
from typing import TYPE_CHECKING, cast

from habluetooth import BluetoothScanningMode
from home_assistant_bluetooth import BluetoothServiceInfoBleak

from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback as hass_callback

from .base_scanner import BaseHaScanner, BluetoothScannerDevice
from .const import DATA_MANAGER
from .manager import BluetoothManager
from .manager import HomeAssistantBluetoothManager
from .match import BluetoothCallbackMatcher
from .models import (
BluetoothCallback,
BluetoothChange,
BluetoothScanningMode,
ProcessAdvertisementCallback,
)
from .models import BluetoothCallback, BluetoothChange, ProcessAdvertisementCallback
from .wrappers import HaBleakScannerWrapper

if TYPE_CHECKING:
from bleak.backends.device import BLEDevice


def _get_manager(hass: HomeAssistant) -> BluetoothManager:
def _get_manager(hass: HomeAssistant) -> HomeAssistantBluetoothManager:
"""Get the bluetooth manager."""
return cast(BluetoothManager, hass.data[DATA_MANAGER])
return cast(HomeAssistantBluetoothManager, hass.data[DATA_MANAGER])


@hass_callback
Expand Down
Loading

0 comments on commit 519bf77

Please sign in to comment.