Skip to content

Commit

Permalink
2022.12.4 (#83870)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Dec 13, 2022
2 parents 0f68a57 + 31d0e5e commit 05c429b
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 52 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"quality_scale": "internal",
"requirements": [
"bleak==0.19.2",
"bleak-retry-connector==2.10.1",
"bleak-retry-connector==2.10.2",
"bluetooth-adapters==0.12.0",
"bluetooth-auto-recovery==0.5.5",
"bluetooth-auto-recovery==1.0.0",
"bluetooth-data-tools==0.3.0",
"dbus-fast==1.75.0"
],
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/bluetooth/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def __init__(
new_info_callback: Callable[[BluetoothServiceInfoBleak], None],
) -> None:
"""Init bluetooth discovery."""
self.mac_address = address
source = address if address != DEFAULT_ADDRESS else adapter or SOURCE_LOCAL
super().__init__(hass, source, adapter)
self.mode = mode
Expand Down Expand Up @@ -375,7 +376,7 @@ async def _async_reset_adapter(self) -> None:
# so we log at debug level. If we later come up with a repair
# strategy, we will change this to raise a repair issue as well.
_LOGGER.debug("%s: adapter stopped responding; executing reset", self.name)
result = await async_reset_adapter(self.adapter)
result = await async_reset_adapter(self.adapter, self.mac_address)
_LOGGER.debug("%s: adapter reset result: %s", self.name, result)

async def async_stop(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/bluetooth/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def async_load_history_from_system(
}


async def async_reset_adapter(adapter: str | None) -> bool | None:
async def async_reset_adapter(adapter: str | None, mac_address: str) -> bool | None:
"""Reset the adapter."""
if adapter and adapter.startswith("hci"):
adapter_id = int(adapter[3:])
return await recover_adapter(adapter_id)
return await recover_adapter(adapter_id, mac_address)
return False
2 changes: 1 addition & 1 deletion homeassistant/components/cast/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Google Cast",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/cast",
"requirements": ["pychromecast==13.0.2"],
"requirements": ["pychromecast==13.0.3"],
"after_dependencies": [
"cloud",
"http",
Expand Down
9 changes: 5 additions & 4 deletions homeassistant/components/cloud/repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from homeassistant.helpers import issue_registry as ir

from .const import DOMAIN
from .subscription import async_subscription_info
from .subscription import async_migrate_paypal_agreement, async_subscription_info

BACKOFF_TIME = 5
MAX_RETRIES = 60 # This allows for 10 minutes of retries
Expand Down Expand Up @@ -68,13 +68,13 @@ async def async_step_confirm_change_plan(
async def async_step_change_plan(self, _: None = None) -> FlowResult:
"""Wait for the user to authorize the app installation."""

cloud: Cloud = self.hass.data[DOMAIN]

async def _async_wait_for_plan_change() -> None:
flow_manager = repairs_flow_manager(self.hass)
# We can not get here without a flow manager
assert flow_manager is not None

cloud: Cloud = self.hass.data[DOMAIN]

retries = 0
while retries < MAX_RETRIES:
self._data = await async_subscription_info(cloud)
Expand All @@ -90,9 +90,10 @@ async def _async_wait_for_plan_change() -> None:

if not self.wait_task:
self.wait_task = self.hass.async_create_task(_async_wait_for_plan_change())
migration = await async_migrate_paypal_agreement(cloud)
return self.async_external_step(
step_id="change_plan",
url="https://account.nabucasa.com/",
url=migration["url"] if migration else "https://account.nabucasa.com/",
)

await self.wait_task
Expand Down
22 changes: 22 additions & 0 deletions homeassistant/components/cloud/subscription.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Subscription information."""
from __future__ import annotations

import asyncio
import logging
from typing import Any

Expand All @@ -18,7 +19,28 @@ async def async_subscription_info(cloud: Cloud) -> dict[str, Any] | None:
try:
async with async_timeout.timeout(REQUEST_TIMEOUT):
return await cloud_api.async_subscription_info(cloud)
except asyncio.TimeoutError:
_LOGGER.error(
"A timeout of %s was reached while trying to fetch subscription information",
REQUEST_TIMEOUT,
)
except ClientError:
_LOGGER.error("Failed to fetch subscription information")

return None


async def async_migrate_paypal_agreement(cloud: Cloud) -> dict[str, Any] | None:
"""Migrate a paypal agreement from legacy."""
try:
async with async_timeout.timeout(REQUEST_TIMEOUT):
return await cloud_api.async_migrate_paypal_agreement(cloud)
except asyncio.TimeoutError:
_LOGGER.error(
"A timeout of %s was reached while trying to start agreement migration",
REQUEST_TIMEOUT,
)
except ClientError as exception:
_LOGGER.error("Failed to start agreement migration - %s", exception)

return None
12 changes: 11 additions & 1 deletion homeassistant/components/fritzbox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from xml.etree.ElementTree import ParseError

from pyfritzhome import Fritzhome, FritzhomeDevice, LoginError
from pyfritzhome.devicetypes.fritzhomeentitybase import FritzhomeEntityBase
Expand Down Expand Up @@ -43,7 +44,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
CONF_CONNECTIONS: fritz,
}

coordinator = FritzboxDataUpdateCoordinator(hass, entry)
try:
await hass.async_add_executor_job(fritz.update_templates)
except ParseError:
LOGGER.debug("Disable smarthome templates")
has_templates = False
else:
LOGGER.debug("Enable smarthome templates")
has_templates = True

coordinator = FritzboxDataUpdateCoordinator(hass, entry, has_templates)

await coordinator.async_config_entry_first_refresh()

Expand Down
12 changes: 4 additions & 8 deletions homeassistant/components/fritzbox/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from dataclasses import dataclass
from datetime import timedelta
from xml.etree.ElementTree import ParseError

from pyfritzhome import Fritzhome, FritzhomeDevice, LoginError
from pyfritzhome.devicetypes import FritzhomeTemplate
Expand All @@ -30,17 +29,14 @@ class FritzboxDataUpdateCoordinator(DataUpdateCoordinator[FritzboxCoordinatorDat

configuration_url: str

def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
def __init__(
self, hass: HomeAssistant, entry: ConfigEntry, has_templates: bool
) -> None:
"""Initialize the Fritzbox Smarthome device coordinator."""
self.entry = entry
self.fritz: Fritzhome = hass.data[DOMAIN][self.entry.entry_id][CONF_CONNECTIONS]
self.configuration_url = self.fritz.get_prefixed_host()
self.has_templates = True
try:
hass.async_add_executor_job(self.fritz.update_templates)
except ParseError:
LOGGER.info("Disable smarthome templates")
self.has_templates = False
self.has_templates = has_templates

super().__init__(
hass,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/frontend/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "frontend",
"name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/integrations/frontend",
"requirements": ["home-assistant-frontend==20221208.0"],
"requirements": ["home-assistant-frontend==20221212.0"],
"dependencies": [
"api",
"auth",
Expand Down
21 changes: 18 additions & 3 deletions homeassistant/components/homekit/type_remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
SERVICE_TURN_ON,
STATE_ON,
)
from homeassistant.core import callback
from homeassistant.core import State, callback

from .accessories import TYPES, HomeAccessory
from .const import (
Expand Down Expand Up @@ -96,7 +96,7 @@ def __init__(
self.sources = []
self.support_select_source = False
if features & required_feature:
sources = state.attributes.get(source_list_key, [])
sources = self._get_ordered_source_list_from_state(state)
if len(sources) > MAXIMUM_SOURCES:
_LOGGER.warning(
"%s: Reached maximum number of sources (%s)",
Expand Down Expand Up @@ -143,6 +143,21 @@ def __init__(
serv_input.configure_char(CHAR_CURRENT_VISIBILITY_STATE, value=False)
_LOGGER.debug("%s: Added source %s", self.entity_id, source)

def _get_ordered_source_list_from_state(self, state: State) -> list[str]:
"""Return ordered source list while preserving order with duplicates removed.
Some integrations have duplicate sources in the source list
which will make the source list conflict as HomeKit requires
unique source names.
"""
seen = set()
sources: list[str] = []
for source in state.attributes.get(self.source_list_key, []):
if source not in seen:
sources.append(source)
seen.add(source)
return sources

@abstractmethod
def set_on_off(self, value):
"""Move switch state to value if call came from HomeKit."""
Expand All @@ -169,7 +184,7 @@ def _async_update_input_state(self, hk_state, new_state):
self.char_input_source.set_value(index)
return

possible_sources = new_state.attributes.get(self.source_list_key, [])
possible_sources = self._get_ordered_source_list_from_state(new_state)
if source in possible_sources:
index = possible_sources.index(source)
if index >= MAXIMUM_SOURCES:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/overkiz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"integration_type": "hub",
"documentation": "https://www.home-assistant.io/integrations/overkiz",
"requirements": ["pyoverkiz==1.7.1"],
"requirements": ["pyoverkiz==1.7.2"],
"zeroconf": [
{
"type": "_kizbox._tcp.local.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,6 @@ async def async_set_operation_mode(self, operation_mode: str) -> None:
OverkizCommand.SET_BOOST_MODE, OverkizCommand.OFF
)

if self.executor.has_command(OverkizCommand.SET_BOOST_MODE_DURATION):
await self.executor.async_execute_command(
OverkizCommand.SET_BOOST_MODE_DURATION, 0
)
await self.executor.async_execute_command(
OverkizCommand.REFRESH_BOOST_MODE_DURATION
)

if self.executor.has_command(OverkizCommand.SET_CURRENT_OPERATING_MODE):
current_operating_mode = self.executor.select_state(
OverkizState.CORE_OPERATING_MODE
Expand All @@ -331,5 +323,10 @@ async def async_set_operation_mode(self, operation_mode: str) -> None:
OverkizCommand.SET_DHW_MODE, self.overkiz_to_operation_mode[operation_mode]
)

if self.executor.has_command(OverkizCommand.REFRESH_BOOST_MODE_DURATION):
await self.executor.async_execute_command(
OverkizCommand.REFRESH_BOOST_MODE_DURATION
)

if self.executor.has_command(OverkizCommand.REFRESH_DHW_MODE):
await self.executor.async_execute_command(OverkizCommand.REFRESH_DHW_MODE)
2 changes: 1 addition & 1 deletion homeassistant/components/sleepiq/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult:
self._reauth_entry = self.hass.config_entries.async_get_entry(
self.context["entry_id"]
)
return await self.async_step_reauth_confirm(dict(entry_data))
return await self.async_step_reauth_confirm()

async def async_step_reauth_confirm(
self, user_input: dict[str, Any] | None = None
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"bellows==0.34.5",
"pyserial==3.5",
"pyserial-asyncio==0.6",
"zha-quirks==0.0.88",
"zha-quirks==0.0.89",
"zigpy-deconz==0.19.2",
"zigpy==0.52.3",
"zigpy-xbee==0.16.2",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2022
MINOR_VERSION: Final = 12
PATCH_VERSION: Final = "3"
PATCH_VERSION: Final = "4"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0)
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ atomicwrites-homeassistant==1.4.1
attrs==21.2.0
awesomeversion==22.9.0
bcrypt==3.1.7
bleak-retry-connector==2.10.1
bleak-retry-connector==2.10.2
bleak==0.19.2
bluetooth-adapters==0.12.0
bluetooth-auto-recovery==0.5.5
bluetooth-auto-recovery==1.0.0
bluetooth-data-tools==0.3.0
certifi>=2021.5.30
ciso8601==2.2.0
Expand All @@ -22,7 +22,7 @@ dbus-fast==1.75.0
fnvhash==0.1.0
hass-nabucasa==0.61.0
home-assistant-bluetooth==1.8.1
home-assistant-frontend==20221208.0
home-assistant-frontend==20221212.0
httpx==0.23.1
ifaddr==0.1.7
janus==1.0.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "homeassistant"
version = "2022.12.3"
version = "2022.12.4"
license = {text = "Apache-2.0"}
description = "Open-source home automation platform running on Python 3."
readme = "README.rst"
Expand Down
12 changes: 6 additions & 6 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ bimmer_connected==0.10.4
bizkaibus==0.1.1

# homeassistant.components.bluetooth
bleak-retry-connector==2.10.1
bleak-retry-connector==2.10.2

# homeassistant.components.bluetooth
bleak==0.19.2
Expand Down Expand Up @@ -450,7 +450,7 @@ bluemaestro-ble==0.2.0
bluetooth-adapters==0.12.0

# homeassistant.components.bluetooth
bluetooth-auto-recovery==0.5.5
bluetooth-auto-recovery==1.0.0

# homeassistant.components.bluetooth
# homeassistant.components.led_ble
Expand Down Expand Up @@ -884,7 +884,7 @@ hole==0.7.0
holidays==0.17.2

# homeassistant.components.frontend
home-assistant-frontend==20221208.0
home-assistant-frontend==20221212.0

# homeassistant.components.home_connect
homeconnect==0.7.2
Expand Down Expand Up @@ -1504,7 +1504,7 @@ pycfdns==2.0.1
pychannels==1.2.3

# homeassistant.components.cast
pychromecast==13.0.2
pychromecast==13.0.3

# homeassistant.components.pocketcasts
pycketcasts==1.0.1
Expand Down Expand Up @@ -1812,7 +1812,7 @@ pyotgw==2.1.3
pyotp==2.7.0

# homeassistant.components.overkiz
pyoverkiz==1.7.1
pyoverkiz==1.7.2

# homeassistant.components.openweathermap
pyowm==3.2.0
Expand Down Expand Up @@ -2639,7 +2639,7 @@ zengge==0.2
zeroconf==0.39.4

# homeassistant.components.zha
zha-quirks==0.0.88
zha-quirks==0.0.89

# homeassistant.components.zhong_hong
zhong_hong_hvac==1.0.9
Expand Down

0 comments on commit 05c429b

Please sign in to comment.