Skip to content

Commit

Permalink
Merge branch 'dev' into roborock_new_sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L authored Sep 9, 2023
2 parents b50fa99 + c77eb70 commit d17caab
Show file tree
Hide file tree
Showing 153 changed files with 2,320 additions and 1,458 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ omit =
homeassistant/components/freebox/device_tracker.py
homeassistant/components/freebox/home_base.py
homeassistant/components/freebox/router.py
homeassistant/components/freebox/sensor.py
homeassistant/components/freebox/switch.py
homeassistant/components/fritz/common.py
homeassistant/components/fritz/device_tracker.py
Expand Down Expand Up @@ -1010,6 +1009,7 @@ omit =
homeassistant/components/renson/const.py
homeassistant/components/renson/entity.py
homeassistant/components/renson/sensor.py
homeassistant/components/renson/fan.py
homeassistant/components/renson/binary_sensor.py
homeassistant/components/raspyrfm/*
homeassistant/components/recollect_waste/sensor.py
Expand Down
61 changes: 42 additions & 19 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ env:
CACHE_VERSION: 5
PIP_CACHE_VERSION: 4
MYPY_CACHE_VERSION: 4
BLACK_CACHE_VERSION: 1
HA_SHORT_VERSION: "2023.10"
DEFAULT_PYTHON: "3.11"
ALL_PYTHON_VERSIONS: "['3.11']"
Expand All @@ -55,6 +56,7 @@ env:
POSTGRESQL_VERSIONS: "['postgres:12.14','postgres:15.2']"
PRE_COMMIT_CACHE: ~/.cache/pre-commit
PIP_CACHE: /tmp/pip-cache
BLACK_CACHE: /tmp/black-cache
SQLALCHEMY_WARN_20: 1
PYTHONASYNCIODEBUG: 1
HASS_CI: 1
Expand Down Expand Up @@ -229,7 +231,7 @@ jobs:
check-latest: true
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: venv
key: >-
Expand All @@ -244,7 +246,7 @@ jobs:
pip install "$(cat requirements_test.txt | grep pre-commit)"
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
lookup-only: true
Expand Down Expand Up @@ -272,9 +274,16 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Generate partial black restore key
id: generate-black-key
run: |
black_version=$(cat requirements_test_pre_commit.txt | grep black | cut -d '=' -f 3)
echo "version=$black_version" >> $GITHUB_OUTPUT
echo "key=black-${{ env.BLACK_CACHE_VERSION }}-$black_version-${{
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')" >> $GITHUB_OUTPUT
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand All @@ -283,21 +292,35 @@ jobs:
needs.info.outputs.pre-commit_cache_key }}
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
fail-on-cache-miss: true
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.info.outputs.pre-commit_cache_key }}
- name: Restore black cache
uses: actions/[email protected]
with:
path: ${{ env.BLACK_CACHE }}
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
steps.generate-black-key.outputs.key }}
restore-keys: |
${{ runner.os }}-${{ steps.python.outputs.python-version }}-black-${{
env.BLACK_CACHE_VERSION }}-${{ steps.generate-black-key.outputs.version }}-${{
env.HA_SHORT_VERSION }}-
- name: Run black (fully)
if: needs.info.outputs.test_full_suite == 'true'
env:
BLACK_CACHE_DIR: ${{ env.BLACK_CACHE }}
run: |
. venv/bin/activate
pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
- name: Run black (partially)
if: needs.info.outputs.test_full_suite == 'false'
shell: bash
env:
BLACK_CACHE_DIR: ${{ env.BLACK_CACHE }}
run: |
. venv/bin/activate
shopt -s globstar
Expand All @@ -320,7 +343,7 @@ jobs:
check-latest: true
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand All @@ -329,7 +352,7 @@ jobs:
needs.info.outputs.pre-commit_cache_key }}
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
fail-on-cache-miss: true
Expand Down Expand Up @@ -369,7 +392,7 @@ jobs:
check-latest: true
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand All @@ -378,7 +401,7 @@ jobs:
needs.info.outputs.pre-commit_cache_key }}
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
fail-on-cache-miss: true
Expand Down Expand Up @@ -468,7 +491,7 @@ jobs:
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')" >> $GITHUB_OUTPUT
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: venv
lookup-only: true
Expand All @@ -477,7 +500,7 @@ jobs:
needs.info.outputs.python_cache_key }}
- name: Restore pip wheel cache
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: ${{ env.PIP_CACHE }}
key: >-
Expand Down Expand Up @@ -531,7 +554,7 @@ jobs:
check-latest: true
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down Expand Up @@ -563,7 +586,7 @@ jobs:
check-latest: true
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down Expand Up @@ -596,7 +619,7 @@ jobs:
check-latest: true
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down Expand Up @@ -647,15 +670,15 @@ jobs:
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')" >> $GITHUB_OUTPUT
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.info.outputs.python_cache_key }}
- name: Restore mypy cache
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: .mypy_cache
key: >-
Expand Down Expand Up @@ -722,7 +745,7 @@ jobs:
check-latest: true
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down Expand Up @@ -874,7 +897,7 @@ jobs:
check-latest: true
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down Expand Up @@ -998,7 +1021,7 @@ jobs:
check-latest: true
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache/[email protected].1
uses: actions/cache/[email protected].2
with:
path: venv
fail-on-cache-miss: true
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
args:
- --fix
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.7.0
rev: 23.9.0
hooks:
- id: black
args:
Expand Down
1 change: 1 addition & 0 deletions .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ homeassistant.components.input_select.*
homeassistant.components.integration.*
homeassistant.components.ipp.*
homeassistant.components.iqvia.*
homeassistant.components.islamic_prayer_times.*
homeassistant.components.isy994.*
homeassistant.components.jellyfin.*
homeassistant.components.jewish_calendar.*
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ build.json @home-assistant/supervisor
/tests/components/airq/ @Sibgatulin @dl2080
/homeassistant/components/airthings/ @danielhiversen
/tests/components/airthings/ @danielhiversen
/homeassistant/components/airthings_ble/ @vincegio
/tests/components/airthings_ble/ @vincegio
/homeassistant/components/airthings_ble/ @vincegio @LaStrada
/tests/components/airthings_ble/ @vincegio @LaStrada
/homeassistant/components/airvisual/ @bachya
/tests/components/airvisual/ @bachya
/homeassistant/components/airvisual_pro/ @bachya
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/airthings_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"service_uuid": "b42e3882-ade7-11e4-89d3-123b93f75cba"
}
],
"codeowners": ["@vincegio"],
"codeowners": ["@vincegio", "@LaStrada"],
"config_flow": true,
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/airthings_ble",
Expand Down
29 changes: 29 additions & 0 deletions homeassistant/components/aladdin_connect/diagnostics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Diagnostics support for Aladdin Connect."""
from __future__ import annotations

from typing import Any

from AIOAladdinConnect import AladdinConnectClient

from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant

from .const import DOMAIN

TO_REDACT = {"serial", "device_id"}


async def async_get_config_entry_diagnostics(
hass: HomeAssistant,
config_entry: ConfigEntry,
) -> dict[str, Any]:
"""Return diagnostics for a config entry."""

acc: AladdinConnectClient = hass.data[DOMAIN][config_entry.entry_id]

diagnostics_data = {
"doors": async_redact_data(acc.doors, TO_REDACT),
}

return diagnostics_data
2 changes: 1 addition & 1 deletion homeassistant/components/aladdin_connect/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/aladdin_connect",
"iot_class": "cloud_polling",
"loggers": ["aladdin_connect"],
"requirements": ["AIOAladdinConnect==0.1.57"]
"requirements": ["AIOAladdinConnect==0.1.58"]
}
23 changes: 18 additions & 5 deletions homeassistant/components/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
)
import homeassistant.core as ha
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceNotFound, TemplateError, Unauthorized
from homeassistant.exceptions import (
InvalidEntityFormatError,
InvalidStateError,
ServiceNotFound,
TemplateError,
Unauthorized,
)
from homeassistant.helpers import config_validation as cv, template
from homeassistant.helpers.json import json_dumps
from homeassistant.helpers.service import async_get_all_descriptions
Expand Down Expand Up @@ -236,7 +242,7 @@ async def post(self, request, entity_id):
"""Update state of entity."""
if not request["hass_user"].is_admin:
raise Unauthorized(entity_id=entity_id)
hass = request.app["hass"]
hass: HomeAssistant = request.app["hass"]
try:
data = await request.json()
except ValueError:
Expand All @@ -251,9 +257,16 @@ async def post(self, request, entity_id):
is_new_state = hass.states.get(entity_id) is None

# Write state
hass.states.async_set(
entity_id, new_state, attributes, force_update, self.context(request)
)
try:
hass.states.async_set(
entity_id, new_state, attributes, force_update, self.context(request)
)
except InvalidEntityFormatError:
return self.json_message(
"Invalid entity ID specified.", HTTPStatus.BAD_REQUEST
)
except InvalidStateError:
return self.json_message("Invalid state specified.", HTTPStatus.BAD_REQUEST)

# Read the state back for our response
status_code = HTTPStatus.CREATED if is_new_state else HTTPStatus.OK
Expand Down
10 changes: 7 additions & 3 deletions homeassistant/components/assist_pipeline/websocket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async def websocket_list_languages(
dialect = language_util.Dialect.parse(language_tag)
languages.add(dialect.language)
if pipeline_languages is not None:
pipeline_languages &= languages
pipeline_languages = language_util.intersect(pipeline_languages, languages)
else:
pipeline_languages = languages

Expand All @@ -342,11 +342,15 @@ async def websocket_list_languages(
dialect = language_util.Dialect.parse(language_tag)
languages.add(dialect.language)
if pipeline_languages is not None:
pipeline_languages &= languages
pipeline_languages = language_util.intersect(pipeline_languages, languages)
else:
pipeline_languages = languages

connection.send_result(
msg["id"],
{"languages": pipeline_languages},
{
"languages": sorted(pipeline_languages)
if pipeline_languages
else pipeline_languages
},
)
10 changes: 5 additions & 5 deletions homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
],
"quality_scale": "internal",
"requirements": [
"bleak==0.21.0",
"bleak-retry-connector==3.1.2",
"bluetooth-adapters==0.16.0",
"bluetooth-auto-recovery==1.2.1",
"bleak==0.21.1",
"bleak-retry-connector==3.1.3",
"bluetooth-adapters==0.16.1",
"bluetooth-auto-recovery==1.2.2",
"bluetooth-data-tools==1.11.0",
"dbus-fast==1.95.0"
"dbus-fast==2.0.1"
]
}
Loading

0 comments on commit d17caab

Please sign in to comment.