Skip to content

Commit

Permalink
2024.7.3 (#122194)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Jul 19, 2024
2 parents 058b012 + a08ffdc commit 267dfac
Show file tree
Hide file tree
Showing 75 changed files with 592 additions and 256 deletions.
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,8 @@ build.json @home-assistant/supervisor
/tests/components/lg_netcast/ @Drafteed @splinter98
/homeassistant/components/lidarr/ @tkdrob
/tests/components/lidarr/ @tkdrob
/homeassistant/components/lifx/ @Djelibeybi
/tests/components/lifx/ @Djelibeybi
/homeassistant/components/light/ @home-assistant/core
/tests/components/light/ @home-assistant/core
/homeassistant/components/linear_garage_door/ @IceBotYT
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alexa/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ async def async_api_adjust_range(
if instance == f"{cover.DOMAIN}.{cover.ATTR_POSITION}":
range_delta = int(range_delta * 20) if range_delta_default else int(range_delta)
service = SERVICE_SET_COVER_POSITION
if not (current := entity.attributes.get(cover.ATTR_POSITION)):
if not (current := entity.attributes.get(cover.ATTR_CURRENT_POSITION)):
msg = f"Unable to determine {entity.entity_id} current position"
raise AlexaInvalidValueError(msg)
position = response_value = min(100, max(0, range_delta + current))
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bring/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def async_step_user(
):
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=self.info["name"] or user_input[CONF_EMAIL], data=user_input
title=self.info.get("name") or user_input[CONF_EMAIL], data=user_input
)

return self.async_show_form(
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/enigma2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_create_clientsession

from .const import CONF_SOURCE_BOUQUET

type Enigma2ConfigEntry = ConfigEntry[OpenWebIfDevice]

PLATFORMS = [Platform.MEDIA_PLAYER]
Expand All @@ -35,7 +37,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: Enigma2ConfigEntry) -> b
hass, verify_ssl=entry.data[CONF_VERIFY_SSL], base_url=base_url
)

entry.runtime_data = OpenWebIfDevice(session)
entry.runtime_data = OpenWebIfDevice(
session, source_bouquet=entry.options.get(CONF_SOURCE_BOUQUET)
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/enigma2/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["openwebif"],
"requirements": ["openwebifpy==4.2.4"]
"requirements": ["openwebifpy==4.2.5"]
}
3 changes: 2 additions & 1 deletion homeassistant/components/enigma2/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ async def async_media_previous_track(self) -> None:

async def async_mute_volume(self, mute: bool) -> None:
"""Mute or unmute."""
await self._device.toggle_mute()
if mute != self._device.status.muted:
await self._device.toggle_mute()

async def async_select_source(self, source: str) -> None:
"""Select input source."""
Expand Down
7 changes: 4 additions & 3 deletions homeassistant/components/hive/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ async def async_update(self) -> None:
self.device = await self.hive.heating.getClimate(self.device)
self._attr_available = self.device["deviceData"].get("online")
if self._attr_available:
self._attr_hvac_mode = HIVE_TO_HASS_STATE[self.device["status"]["mode"]]
self._attr_hvac_action = HIVE_TO_HASS_HVAC_ACTION[
self._attr_hvac_mode = HIVE_TO_HASS_STATE.get(self.device["status"]["mode"])
self._attr_hvac_action = HIVE_TO_HASS_HVAC_ACTION.get(
self.device["status"]["action"]
]
)
self._attr_current_temperature = self.device["status"][
"current_temperature"
]
Expand All @@ -154,5 +154,6 @@ async def async_update(self) -> None:
self._attr_max_temp = self.device["max_temp"]
if self.device["status"]["boost"] == "ON":
self._attr_preset_mode = PRESET_BOOST
self._attr_hvac_mode = HVACMode.HEAT
else:
self._attr_preset_mode = PRESET_NONE
2 changes: 1 addition & 1 deletion homeassistant/components/holiday/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/holiday",
"iot_class": "local_polling",
"requirements": ["holidays==0.52", "babel==2.15.0"]
"requirements": ["holidays==0.53", "babel==2.15.0"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/idasen_desk/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"documentation": "https://www.home-assistant.io/integrations/idasen_desk",
"iot_class": "local_push",
"quality_scale": "silver",
"requirements": ["idasen-ha==2.6.1"]
"requirements": ["idasen-ha==2.6.2"]
}
50 changes: 24 additions & 26 deletions homeassistant/components/ista_ecotrend/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from pyecotrend_ista import KeycloakError, LoginError, PyEcotrendIsta, ServerError

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EMAIL
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
Expand All @@ -21,6 +22,8 @@
class IstaCoordinator(DataUpdateCoordinator[dict[str, Any]]):
"""Ista EcoTrend data update coordinator."""

config_entry: ConfigEntry

def __init__(self, hass: HomeAssistant, ista: PyEcotrendIsta) -> None:
"""Initialize ista EcoTrend data update coordinator."""
super().__init__(
Expand All @@ -35,11 +38,14 @@ def __init__(self, hass: HomeAssistant, ista: PyEcotrendIsta) -> None:
async def _async_update_data(self):
"""Fetch ista EcoTrend data."""

if not self.details:
self.details = await self.async_get_details()

try:
await self.hass.async_add_executor_job(self.ista.login)

if not self.details:
self.details = await self.async_get_details()

return await self.hass.async_add_executor_job(self.get_consumption_data)

except ServerError as e:
raise UpdateFailed(
"Unable to connect and retrieve data from ista EcoTrend, try again later"
Expand All @@ -48,7 +54,9 @@ async def _async_update_data(self):
raise ConfigEntryAuthFailed(
translation_domain=DOMAIN,
translation_key="authentication_exception",
translation_placeholders={CONF_EMAIL: self.ista._email}, # noqa: SLF001
translation_placeholders={
CONF_EMAIL: self.config_entry.data[CONF_EMAIL]
},
) from e

def get_consumption_data(self) -> dict[str, Any]:
Expand All @@ -61,26 +69,16 @@ def get_consumption_data(self) -> dict[str, Any]:

async def async_get_details(self) -> dict[str, Any]:
"""Retrieve details of consumption units."""
try:
result = await self.hass.async_add_executor_job(
self.ista.get_consumption_unit_details

result = await self.hass.async_add_executor_job(
self.ista.get_consumption_unit_details
)

return {
consumption_unit: next(
details
for details in result["consumptionUnits"]
if details["id"] == consumption_unit
)
except ServerError as e:
raise UpdateFailed(
"Unable to connect and retrieve data from ista EcoTrend, try again later"
) from e
except (LoginError, KeycloakError) as e:
raise ConfigEntryAuthFailed(
translation_domain=DOMAIN,
translation_key="authentication_exception",
translation_placeholders={CONF_EMAIL: self.ista._email}, # noqa: SLF001
) from e
else:
return {
consumption_unit: next(
details
for details in result["consumptionUnits"]
if details["id"] == consumption_unit
)
for consumption_unit in self.ista.get_uuids()
}
for consumption_unit in self.ista.get_uuids()
}
6 changes: 5 additions & 1 deletion homeassistant/components/jellyfin/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ async def async_step_user(
)

return self.async_show_form(
step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors
step_id="user",
data_schema=self.add_suggested_values_to_schema(
STEP_USER_DATA_SCHEMA, user_input
),
errors=errors,
)

async def async_step_reauth(
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/knocki/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Any

from knocki import KnockiClient, KnockiConnectionError
from knocki import KnockiClient, KnockiConnectionError, KnockiInvalidAuthError
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
Expand Down Expand Up @@ -45,6 +45,8 @@ async def async_step_user(
raise
except KnockiConnectionError:
errors["base"] = "cannot_connect"
except KnockiInvalidAuthError:
errors["base"] = "invalid_auth"
except Exception: # noqa: BLE001
LOGGER.exception("Error logging into the Knocki API")
errors["base"] = "unknown"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/knocki/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"integration_type": "device",
"iot_class": "cloud_push",
"loggers": ["knocki"],
"requirements": ["knocki==0.2.0"]
"requirements": ["knocki==0.3.1"]
}
4 changes: 2 additions & 2 deletions homeassistant/components/lifx/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "lifx",
"name": "LIFX",
"codeowners": [],
"codeowners": ["@Djelibeybi"],
"config_flow": true,
"dependencies": ["network"],
"dhcp": [
Expand Down Expand Up @@ -48,7 +48,7 @@
"iot_class": "local_polling",
"loggers": ["aiolifx", "aiolifx_effects", "bitstring"],
"requirements": [
"aiolifx==1.0.2",
"aiolifx==1.0.5",
"aiolifx-effects==0.3.2",
"aiolifx-themes==0.4.15"
]
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/media_extractor/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "calculated",
"loggers": ["yt_dlp"],
"quality_scale": "internal",
"requirements": ["yt-dlp==2024.07.01"],
"requirements": ["yt-dlp==2024.07.16"],
"single_config_entry": true
}
5 changes: 5 additions & 0 deletions homeassistant/components/opentherm_gw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,8 @@ async def handle_report(status):
async_dispatcher_send(self.hass, self.update_signal, status)

self.gateway.subscribe(handle_report)

@property
def connected(self):
"""Report whether or not we are connected to the gateway."""
return self.gateway.connection.connected
7 changes: 2 additions & 5 deletions homeassistant/components/opentherm_gw/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class OpenThermBinarySensor(BinarySensorEntity):

_attr_should_poll = False
_attr_entity_registry_enabled_default = False
_attr_available = False

def __init__(self, gw_dev, var, source, device_class, friendly_name_format):
"""Initialize the binary sensor."""
Expand Down Expand Up @@ -85,14 +86,10 @@ async def async_will_remove_from_hass(self) -> None:
_LOGGER.debug("Removing OpenTherm Gateway binary sensor %s", self._attr_name)
self._unsub_updates()

@property
def available(self):
"""Return availability of the sensor."""
return self._attr_is_on is not None

@callback
def receive_report(self, status):
"""Handle status updates from the component."""
self._attr_available = self._gateway.connected
state = status[self._source].get(self._var)
self._attr_is_on = None if state is None else bool(state)
self.async_write_ha_state()
2 changes: 1 addition & 1 deletion homeassistant/components/opentherm_gw/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def async_will_remove_from_hass(self) -> None:
@callback
def receive_report(self, status):
"""Receive and handle a new report from the Gateway."""
self._attr_available = status != gw_vars.DEFAULT_STATUS
self._attr_available = self._gateway.connected
ch_active = status[gw_vars.BOILER].get(gw_vars.DATA_SLAVE_CH_ACTIVE)
flame_on = status[gw_vars.BOILER].get(gw_vars.DATA_SLAVE_FLAME_ON)
cooling_active = status[gw_vars.BOILER].get(gw_vars.DATA_SLAVE_COOLING_ACTIVE)
Expand Down
7 changes: 2 additions & 5 deletions homeassistant/components/opentherm_gw/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class OpenThermSensor(SensorEntity):

_attr_should_poll = False
_attr_entity_registry_enabled_default = False
_attr_available = False

def __init__(
self,
Expand Down Expand Up @@ -94,14 +95,10 @@ async def async_will_remove_from_hass(self) -> None:
_LOGGER.debug("Removing OpenTherm Gateway sensor %s", self._attr_name)
self._unsub_updates()

@property
def available(self):
"""Return availability of the sensor."""
return self._attr_native_value is not None

@callback
def receive_report(self, status):
"""Handle status updates from the component."""
self._attr_available = self._gateway.connected
value = status[self._source].get(self._var)
self._attr_native_value = value
self.async_write_ha_state()
2 changes: 1 addition & 1 deletion homeassistant/components/opower/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/opower",
"iot_class": "cloud_polling",
"loggers": ["opower"],
"requirements": ["opower==0.4.7"]
"requirements": ["opower==0.5.2"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/pyload/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PyLoadData:
speed: float
download: bool
reconnect: bool
captcha: bool
captcha: bool | None = None
free_space: int


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/pyload/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"loggers": ["pyloadapi"],
"quality_scale": "platinum",
"requirements": ["PyLoadAPI==1.2.0"]
"requirements": ["PyLoadAPI==1.3.2"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/rainforest_raven/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async def _get_device(self) -> RAVEnSerialDevice:
await device.synchronize()
self._device_info = await device.get_device_info()
except:
await device.close()
await device.abort()
raise

self._raven_device = device
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/rainforest_raven/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": ["usb"],
"documentation": "https://www.home-assistant.io/integrations/rainforest_raven",
"iot_class": "local_polling",
"requirements": ["aioraven==0.6.0"],
"requirements": ["aioraven==0.7.0"],
"usb": [
{
"vid": "0403",
Expand Down
10 changes: 9 additions & 1 deletion homeassistant/components/recorder/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,15 @@ def _process_state_changed_event_into_session(

def _handle_database_error(self, err: Exception) -> bool:
"""Handle a database error that may result in moving away the corrupt db."""
if isinstance(err.__cause__, sqlite3.DatabaseError):
if (
(cause := err.__cause__)
and isinstance(cause, sqlite3.DatabaseError)
and (cause_str := str(cause))
# Make sure we do not move away a database when its only locked
# externally by another process. sqlite does not give us a named
# exception for this so we have to check the error message.
and ("malformed" in cause_str or "not a database" in cause_str)
):
_LOGGER.exception(
"Unrecoverable sqlite3 database corruption detected: %s", err
)
Expand Down
Loading

0 comments on commit 267dfac

Please sign in to comment.