Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
cache: "pip"
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -185,7 +185,7 @@ jobs:
pip install "$(cat requirements_test.txt | grep pre-commit)"
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -211,7 +211,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -222,7 +222,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }}
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -271,7 +271,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }}
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -323,7 +323,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }}
Expand Down Expand Up @@ -353,7 +353,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-venv-${{ needs.info.outputs.pre-commit_cache_key }}
Expand All @@ -364,7 +364,7 @@ jobs:
exit 1
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-pre-commit-${{ needs.info.outputs.pre-commit_cache_key }}
Expand Down Expand Up @@ -480,15 +480,15 @@ jobs:
env.HA_SHORT_VERSION }}-$(date -u '+%Y-%m-%dT%H:%M:%s')"
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
needs.info.outputs.python_cache_key }}
- name: Restore pip wheel cache
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: ${{ env.PIP_CACHE }}
key: >-
Expand Down Expand Up @@ -538,7 +538,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
Expand Down Expand Up @@ -570,7 +570,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
Expand Down Expand Up @@ -603,7 +603,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
Expand Down Expand Up @@ -647,7 +647,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore full Python ${{ env.DEFAULT_PYTHON }} virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
Expand Down Expand Up @@ -695,7 +695,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: >-
Expand Down Expand Up @@ -749,7 +749,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Restore full Python ${{ matrix.python-version }} virtual environment
id: cache-venv
uses: actions/cache@v3.0.6
uses: actions/cache@v3.0.7
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def async_import_client_credential(
hass: HomeAssistant,
domain: str,
credential: ClientCredential,
auth_domain: str = None,
auth_domain: str | None = None,
) -> None:
"""Import an existing credential from configuration.yaml."""
if DOMAIN not in hass.data:
Expand Down
18 changes: 13 additions & 5 deletions homeassistant/components/bmw_connected_drive/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,27 @@
"VEHICLE_CHECK",
"VEHICLE_TUV",
}
LOGGED_CONDITION_BASED_SERVICE_WARNINGS = set()

ALLOWED_CHECK_CONTROL_MESSAGE_KEYS = {"ENGINE_OIL", "TIRE_PRESSURE"}
LOGGED_CHECK_CONTROL_MESSAGE_WARNINGS = set()


def _condition_based_services(
vehicle: MyBMWVehicle, unit_system: UnitSystem
) -> dict[str, Any]:
extra_attributes = {}
for report in vehicle.condition_based_services.messages:
if report.service_type not in ALLOWED_CONDITION_BASED_SERVICE_KEYS:
if (
report.service_type not in ALLOWED_CONDITION_BASED_SERVICE_KEYS
and report.service_type not in LOGGED_CONDITION_BASED_SERVICE_WARNINGS
):
_LOGGER.warning(
"'%s' not an allowed condition based service (%s)",
report.service_type,
report,
)
LOGGED_CONDITION_BASED_SERVICE_WARNINGS.add(report.service_type)
continue

extra_attributes.update(_format_cbs_report(report, unit_system))
Expand All @@ -61,17 +67,19 @@ def _condition_based_services(
def _check_control_messages(vehicle: MyBMWVehicle) -> dict[str, Any]:
extra_attributes: dict[str, Any] = {}
for message in vehicle.check_control_messages.messages:
if message.description_short not in ALLOWED_CHECK_CONTROL_MESSAGE_KEYS:
if (
message.description_short not in ALLOWED_CHECK_CONTROL_MESSAGE_KEYS
and message.description_short not in LOGGED_CHECK_CONTROL_MESSAGE_WARNINGS
):
_LOGGER.warning(
"'%s' not an allowed check control message (%s)",
message.description_short,
message,
)
LOGGED_CHECK_CONTROL_MESSAGE_WARNINGS.add(message.description_short)
continue

extra_attributes.update(
{message.description_short.lower(): message.state.value}
)
extra_attributes[message.description_short.lower()] = message.state.value
return extra_attributes


Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/climacell/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize ClimaCell options flow."""
self._config_entry = config_entry

async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult:
async def async_step_init(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Manage the ClimaCell options."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/directv/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowRes
return await self.async_step_ssdp_confirm()

async def async_step_ssdp_confirm(
self, user_input: dict[str, Any] = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle a confirmation flow initiated by SSDP."""
if user_input is None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/escea/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def controller_update(ctrl: Controller) -> None:
)

@callback
def set_available(self, available: bool, ex: Exception = None) -> None:
def set_available(self, available: bool, ex: Exception | None = None) -> None:
"""Set availability for the controller."""
if self._attr_available == available:
return
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/google/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ async def async_setup_entry(
calendar_id,
data.get(CONF_SEARCH),
)
await coordinator.async_config_entry_first_refresh()
entities.append(
GoogleCalendarEntity(
coordinator,
Expand Down Expand Up @@ -342,6 +341,9 @@ def _event_filter(self, event: Event) -> bool:
async def async_added_to_hass(self) -> None:
"""When entity is added to hass."""
await super().async_added_to_hass()
# We do not ask for an update with async_add_entities()
# because it will update disabled entities
await self.coordinator.async_request_refresh()
self._apply_coordinator_update()

async def async_get_events(
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/harmony/subscriber.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixin class for handling harmony callback subscriptions."""
from __future__ import annotations

import asyncio
import logging
Expand Down Expand Up @@ -85,7 +86,9 @@ def _activity_started(self, activity_info: tuple) -> None:
self.async_unlock_start_activity()
self._call_callbacks("activity_started", activity_info)

def _call_callbacks(self, callback_func_name: str, argument: tuple = None) -> None:
def _call_callbacks(
self, callback_func_name: str, argument: tuple | None = None
) -> None:
for subscription in self._subscriptions:
current_callback = getattr(subscription, callback_func_name)
if current_callback:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/huisbaasje/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
user_id: str,
name: str,
source_type: str,
device_class: str = None,
device_class: str | None = None,
sensor_type: str = SENSOR_TYPE_RATE,
unit_of_measurement: str = POWER_WATT,
icon: str = "mdi:lightning-bolt",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ipp/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def async_step_zeroconf(
return await self.async_step_zeroconf_confirm()

async def async_step_zeroconf_confirm(
self, user_input: dict[str, Any] = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle a confirmation flow initiated by zeroconf."""
if user_input is None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/izone/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def available(self) -> bool:
return self._available

@callback
def set_available(self, available: bool, ex: Exception = None) -> None:
def set_available(self, available: bool, ex: Exception | None = None) -> None:
"""
Set availability for the controller.

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/minecraft_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async def async_check_connection(self) -> None:
)
self.online = False

async def async_update(self, now: datetime = None) -> None:
async def async_update(self, now: datetime | None = None) -> None:
"""Get server data from 3rd party library and update properties."""
# Check connection status.
server_online_old = self.online
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/mobile_app/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def registration_context(registration: dict) -> Context:


def empty_okay_response(
headers: dict = None, status: HTTPStatus = HTTPStatus.OK
headers: dict | None = None, status: HTTPStatus = HTTPStatus.OK
) -> Response:
"""Return a Response with empty JSON object and a 200."""
return Response(
Expand All @@ -129,7 +129,7 @@ def error_response(
code: str,
message: str,
status: HTTPStatus = HTTPStatus.BAD_REQUEST,
headers: dict = None,
headers: dict | None = None,
) -> Response:
"""Return an error Response."""
return json_response(
Expand Down Expand Up @@ -177,7 +177,7 @@ def webhook_response(
*,
registration: dict,
status: HTTPStatus = HTTPStatus.OK,
headers: dict = None,
headers: dict | None = None,
) -> Response:
"""Return a encrypted response if registration supports it."""
data = json.dumps(data, cls=JSONEncoder)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/motioneye/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def __init__(
client: MotionEyeClient,
coordinator: DataUpdateCoordinator,
options: MappingProxyType[str, Any],
entity_description: EntityDescription = None,
entity_description: EntityDescription | None = None,
) -> None:
"""Initialize a motionEye entity."""
self._camera_id = camera[KEY_ID]
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/motioneye/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ def motion_detection_enabled(self) -> bool:

async def async_set_text_overlay(
self,
left_text: str = None,
right_text: str = None,
custom_left_text: str = None,
custom_right_text: str = None,
left_text: str | None = None,
right_text: str | None = None,
custom_left_text: str | None = None,
custom_right_text: str | None = None,
) -> None:
"""Set text overlay for a camera."""
# Fetch the very latest camera config to reduce the risk of updating with a
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/mqtt/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def async_discover_yaml_entities(
async def async_get_platform_config_from_yaml(
hass: HomeAssistant,
platform_domain: str,
config_yaml: ConfigType = None,
config_yaml: ConfigType | None = None,
) -> list[ConfigType]:
"""Return a list of validated configurations for the domain."""

Expand Down
Loading