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
2 changes: 1 addition & 1 deletion homeassistant/components/adguard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{vol.Optional(CONF_FORCE, default=False): cv.boolean}
)

PLATFORMS = [Platform.SENSOR, Platform.SWITCH]
PLATFORMS = [Platform.SENSOR, Platform.SWITCH, Platform.UPDATE]
type AdGuardConfigEntry = ConfigEntry[AdGuardData]


Expand Down
71 changes: 71 additions & 0 deletions homeassistant/components/adguard/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""AdGuard Home Update platform."""

from __future__ import annotations

from datetime import timedelta
from typing import Any

from adguardhome import AdGuardHomeError

from homeassistant.components.update import UpdateEntity, UpdateEntityFeature
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback

from . import AdGuardConfigEntry, AdGuardData
from .const import DOMAIN
from .entity import AdGuardHomeEntity

SCAN_INTERVAL = timedelta(seconds=300)
PARALLEL_UPDATES = 1


async def async_setup_entry(
hass: HomeAssistant,
entry: AdGuardConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up AdGuard Home update entity based on a config entry."""
data = entry.runtime_data

if (await data.client.update.update_available()).disabled:
return

async_add_entities([AdGuardHomeUpdate(data, entry)], True)


class AdGuardHomeUpdate(AdGuardHomeEntity, UpdateEntity):
"""Defines an AdGuard Home update."""

_attr_supported_features = UpdateEntityFeature.INSTALL
_attr_name = None

def __init__(
self,
data: AdGuardData,
entry: AdGuardConfigEntry,
) -> None:
"""Initialize AdGuard Home update."""
super().__init__(data, entry)

self._attr_unique_id = "_".join(
[DOMAIN, self.adguard.host, str(self.adguard.port), "update"]
)

async def _adguard_update(self) -> None:
"""Update AdGuard Home entity."""
value = await self.adguard.update.update_available()
self._attr_installed_version = self.data.version
self._attr_latest_version = value.new_version
self._attr_release_summary = value.announcement
self._attr_release_url = value.announcement_url

async def async_install(
self, version: str | None, backup: bool, **kwargs: Any
) -> None:
"""Install latest update."""
try:
await self.adguard.update.begin_update()
except AdGuardHomeError as err:
raise HomeAssistantError(f"Failed to install update: {err}") from err
self.hass.config_entries.async_schedule_reload(self._entry.entry_id)
4 changes: 2 additions & 2 deletions homeassistant/components/anthropic/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ async def _transform_stream( # noqa: C901 - This is complex, but better to have
type="tool_use",
id=response.content_block.id,
name=response.content_block.name,
input="",
input={},
)
current_tool_args = ""
if response.content_block.name == output_tool:
Expand Down Expand Up @@ -459,7 +459,7 @@ async def _transform_stream( # noqa: C901 - This is complex, but better to have
type="server_tool_use",
id=response.content_block.id,
name=response.content_block.name,
input="",
input={},
)
current_tool_args = ""
elif isinstance(response.content_block, WebSearchToolResultBlock):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/anthropic/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"documentation": "https://www.home-assistant.io/integrations/anthropic",
"integration_type": "service",
"iot_class": "cloud_polling",
"requirements": ["anthropic==0.69.0"]
"requirements": ["anthropic==0.73.0"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bluetooth-adapters==2.1.0",
"bluetooth-auto-recovery==1.5.3",
"bluetooth-data-tools==1.28.4",
"dbus-fast==2.45.1",
"dbus-fast==3.0.0",
"habluetooth==5.7.0"
]
}
3 changes: 2 additions & 1 deletion homeassistant/components/mqtt/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4237,7 +4237,8 @@ async def async_step_entity(
return self.async_show_form(
step_id="entity",
data_schema=data_schema,
description_placeholders={
description_placeholders=TRANSLATION_DESCRIPTION_PLACEHOLDERS
| {
"mqtt_device": device_name,
"entity_name_label": entity_name_label,
"platform_label": platform_label,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"documentation": "https://www.home-assistant.io/integrations/nest",
"iot_class": "cloud_push",
"loggers": ["google_nest_sdm"],
"requirements": ["google-nest-sdm==7.1.4"]
"requirements": ["google-nest-sdm==9.0.1"]
}
1 change: 1 addition & 0 deletions homeassistant/components/plugwise/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PlugwiseSelectEntityDescription(SelectEntityDescription):
PlugwiseSelectEntityDescription(
key=SELECT_SCHEDULE,
translation_key=SELECT_SCHEDULE,
entity_category=EntityCategory.CONFIG,
options_key="available_schedules",
),
PlugwiseSelectEntityDescription(
Expand Down
9 changes: 3 additions & 6 deletions homeassistant/components/plugwise/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,25 @@ class PlugwiseSensorEntityDescription(SensorEntityDescription):
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseSensorEntityDescription(
key="setpoint_high",
translation_key="cooling_setpoint",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseSensorEntityDescription(
key="setpoint_low",
translation_key="heating_setpoint",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
),
PlugwiseSensorEntityDescription(
key="temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
PlugwiseSensorEntityDescription(
Expand All @@ -94,6 +90,7 @@ class PlugwiseSensorEntityDescription(SensorEntityDescription):
translation_key="outdoor_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
PlugwiseSensorEntityDescription(
Expand Down Expand Up @@ -352,8 +349,8 @@ class PlugwiseSensorEntityDescription(SensorEntityDescription):
key="illuminance",
native_unit_of_measurement=LIGHT_LUX,
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
PlugwiseSensorEntityDescription(
key="modulation_level",
Expand All @@ -365,8 +362,8 @@ class PlugwiseSensorEntityDescription(SensorEntityDescription):
PlugwiseSensorEntityDescription(
key="valve_position",
translation_key="valve_position",
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
PlugwiseSensorEntityDescription(
Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/reolink/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,13 @@ async def async_init(self) -> None:
enable_onvif = None
enable_rtmp = None

if not self._api.rtsp_enabled and not self._api.baichuan_only:
if not self._api.rtsp_enabled and self._api.supported(None, "RTSP"):
_LOGGER.debug(
"RTSP is disabled on %s, trying to enable it", self._api.nvr_name
)
enable_rtsp = True

if (
not self._api.onvif_enabled
and onvif_supported
and not self._api.baichuan_only
):
if not self._api.onvif_enabled and onvif_supported:
_LOGGER.debug(
"ONVIF is disabled on %s, trying to enable it", self._api.nvr_name
)
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/rest_command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import aiohttp
from aiohttp import hdrs
import voluptuous as vol
from yarl import URL

from homeassistant.const import (
CONF_AUTHENTICATION,
Expand Down Expand Up @@ -51,6 +52,7 @@

CONF_CONTENT_TYPE = "content_type"
CONF_INSECURE_CIPHER = "insecure_cipher"
CONF_SKIP_URL_ENCODING = "skip_url_encoding"

COMMAND_SCHEMA = vol.Schema(
{
Expand All @@ -69,6 +71,7 @@
vol.Optional(CONF_CONTENT_TYPE): cv.string,
vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean,
vol.Optional(CONF_INSECURE_CIPHER, default=False): cv.boolean,
vol.Optional(CONF_SKIP_URL_ENCODING, default=False): cv.boolean,
}
)

Expand Down Expand Up @@ -113,6 +116,7 @@ def async_register_rest_command(name: str, command_config: dict[str, Any]) -> No
method = command_config[CONF_METHOD]

template_url = command_config[CONF_URL]
skip_url_encoding = command_config[CONF_SKIP_URL_ENCODING]

auth = None
digest_middleware = None
Expand Down Expand Up @@ -179,7 +183,7 @@ async def async_service_handler(service: ServiceCall) -> ServiceResponse:
request_kwargs["middlewares"] = (digest_middleware,)

async with getattr(websession, method)(
request_url,
URL(request_url, encoded=skip_url_encoding),
**request_kwargs,
) as response:
if response.status < HTTPStatus.BAD_REQUEST:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ certifi>=2021.5.30
ciso8601==2.3.3
cronsim==2.7
cryptography==46.0.2
dbus-fast==2.45.1
dbus-fast==3.0.0
file-read-backwards==2.0.0
fnv-hash-fast==1.6.0
go2rtc-client==0.2.1
Expand Down
6 changes: 3 additions & 3 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions tests/components/adguard/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
"""Tests for the AdGuard Home integration."""

from homeassistant.const import CONTENT_TYPE_JSON
from homeassistant.core import HomeAssistant

from tests.common import MockConfigEntry
from tests.test_util.aiohttp import AiohttpClientMocker


async def setup_integration(
hass: HomeAssistant,
config_entry: MockConfigEntry,
aioclient_mock: AiohttpClientMocker,
) -> None:
"""Fixture for setting up the component."""
config_entry.add_to_hass(hass)

aioclient_mock.get(
"https://127.0.0.1:3000/control/status",
json={"version": "v0.107.50"},
headers={"Content-Type": CONTENT_TYPE_JSON},
)

await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
32 changes: 32 additions & 0 deletions tests/components/adguard/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Common fixtures for the adguard tests."""

import pytest

from homeassistant.components.adguard import DOMAIN
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)

from tests.common import MockConfigEntry


@pytest.fixture
def mock_config_entry() -> MockConfigEntry:
"""Mock a config entry."""
return MockConfigEntry(
domain=DOMAIN,
data={
CONF_HOST: "127.0.0.1",
CONF_PORT: 3000,
CONF_USERNAME: "user",
CONF_PASSWORD: "pass",
CONF_SSL: True,
CONF_VERIFY_SSL: True,
},
title="AdGuard Home",
)
Loading
Loading