Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6f680f3
Portainer fix offline endpoint (#154101)
erwindouna Oct 10, 2025
1e192aa
`sharkiq` dependency bump to 1.4.2 (#153931)
Freebien Oct 10, 2025
eb04dda
Use Entity Description in Shelly BLU TRV button (#154118)
thecode Oct 10, 2025
54d3037
Add ConfigFlow to Prowl integration (#133771)
mgust Oct 10, 2025
951978e
Include unit class in `units_changed` statistics issue (#154069)
emontnemery Oct 10, 2025
1a744a2
Fix HA hardware configuration message for Thread without HAOS (#153933)
TheJulianJES Oct 10, 2025
ee67619
Add mg/m³ as a valid UOM for sensor/number Carbon Monoxide device cla…
emontnemery Oct 10, 2025
3fce815
Add reauthentication to Nintendo Switch Parental controls integration…
pantherale0 Oct 10, 2025
ad3cada
Bump propcache to 0.4.1 (#154033)
bdraco Oct 10, 2025
4707fd2
Update quality scale for Telegram bot (#154122)
hanwg Oct 10, 2025
0205a63
Filter out invalid Renault vehicles (#154070)
epenet Oct 10, 2025
16d4c6c
Add Spotless series features to Home Connect integration (#153016)
Diegorro98 Oct 10, 2025
17e997e
Add module-level statistics to SolarEdge (#152581)
tronikos Oct 10, 2025
084d029
Add Reolink survaillance rule switch entities (#154132)
starkillerOG Oct 10, 2025
07f3e00
Fix for multiple Lyrion Music Server on a single Home Assistant serve…
peteS-UK Oct 10, 2025
cdec29f
Add MQTT select subentry support (#153637)
jbouwh Oct 10, 2025
d1dd5ee
use a consistent python version for `uv` (#154022)
jkt628 Oct 10, 2025
3d2d227
Update frontend to 20251001.2 (#154143)
bramkragten Oct 10, 2025
1f19e40
Adjust OTBR config entry name for ZBT-2 (#153940)
TheJulianJES Oct 10, 2025
e887d5e
Fix delay_on and auto_off with multiple triggers (#153839)
Petro31 Oct 10, 2025
b25622f
Use SI constants in CO unit converter (#153187)
epenet Oct 10, 2025
c92107b
Inherit `MatterEntityDescription` in Matter entities (#154083)
jvmahon Oct 10, 2025
8e79c38
Bump deebot-client to 15.1.0 (#154154)
edenhaus Oct 10, 2025
4b828d4
IOmeter bump version v0.2.0 (#154150)
jukrebs Oct 10, 2025
42dea92
Add time platform to nintendo_parental integration (#153866)
pantherale0 Oct 10, 2025
36be6b6
Add configured number to Satel Integra subentry titles (#154155)
Tommatheussen Oct 10, 2025
6878724
Update xknx to 3.9.1 (#154146)
farmio Oct 10, 2025
c28e105
Pooldose update api (#153497)
lmaertin Oct 10, 2025
9a4280d
Add attachments support to OpenRouter AI task (#154161)
sairon Oct 10, 2025
0da0194
Remove deprecated extra attributes from fritzbox climate (#154152)
flabbamann Oct 10, 2025
1001da0
Fix Shelly RPC cover update when the device is not initialized (#154159)
thecode Oct 10, 2025
f49299b
Add edit message media feature for Telegram bot (#151034)
hanwg Oct 10, 2025
517124d
Anthropic web search support (#153753)
Shulyaka Oct 10, 2025
c7321a3
Add device_tracker platform to Volvo integration (#153437)
thomasddn Oct 10, 2025
217894e
Update knx-frontend to 2025.10.9.185845 (#154103)
farmio Oct 10, 2025
73383e6
Add reconfigure flow in Google Assistant SDK (#153802)
tronikos Oct 10, 2025
cb3829d
Add buttons to Volvo integration (#153272)
thomasddn Oct 10, 2025
d3a8f31
Add Speech-to-Text (stt) to elevenlabs (#147838)
ehendrix23 Oct 10, 2025
c9d9730
Change domain and name of Nintendo Switch parental controls integrati…
emontnemery Oct 10, 2025
d40eeee
Remove deprecated ConfigSource from core (#154112)
gjohansson-ST Oct 10, 2025
bc6accf
Add missing entity category and icons for smlight integration (#154131)
piitaya Oct 10, 2025
c370c86
Use custom string for Oral-B no-devices-found message (#154183)
abmantis Oct 10, 2025
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
12 changes: 6 additions & 6 deletions CODEOWNERS

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

3 changes: 2 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

USER vscode

RUN uv python install 3.13.2
ENV UV_PYTHON=3.13.2
RUN uv python install

ENV VIRTUAL_ENV="/home/vscode/.local/ha-venv"
RUN uv venv $VIRTUAL_ENV
Expand Down
104 changes: 103 additions & 1 deletion homeassistant/components/anthropic/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

from collections.abc import Mapping
from functools import partial
import json
import logging
from typing import Any, cast

import anthropic
import voluptuous as vol
from voluptuous_openapi import convert

from homeassistant.components.zone import ENTITY_ID_HOME
from homeassistant.config_entries import (
ConfigEntry,
ConfigEntryState,
Expand All @@ -18,7 +21,13 @@
ConfigSubentryFlow,
SubentryFlowResult,
)
from homeassistant.const import CONF_API_KEY, CONF_LLM_HASS_API, CONF_NAME
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
CONF_API_KEY,
CONF_LLM_HASS_API,
CONF_NAME,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import llm
from homeassistant.helpers.selector import (
Expand All @@ -37,12 +46,23 @@
CONF_RECOMMENDED,
CONF_TEMPERATURE,
CONF_THINKING_BUDGET,
CONF_WEB_SEARCH,
CONF_WEB_SEARCH_CITY,
CONF_WEB_SEARCH_COUNTRY,
CONF_WEB_SEARCH_MAX_USES,
CONF_WEB_SEARCH_REGION,
CONF_WEB_SEARCH_TIMEZONE,
CONF_WEB_SEARCH_USER_LOCATION,
DEFAULT_CONVERSATION_NAME,
DOMAIN,
RECOMMENDED_CHAT_MODEL,
RECOMMENDED_MAX_TOKENS,
RECOMMENDED_TEMPERATURE,
RECOMMENDED_THINKING_BUDGET,
RECOMMENDED_WEB_SEARCH,
RECOMMENDED_WEB_SEARCH_MAX_USES,
RECOMMENDED_WEB_SEARCH_USER_LOCATION,
WEB_SEARCH_UNSUPPORTED_MODELS,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -168,6 +188,14 @@ async def async_step_set_options(
CONF_THINKING_BUDGET, RECOMMENDED_THINKING_BUDGET
) >= user_input.get(CONF_MAX_TOKENS, RECOMMENDED_MAX_TOKENS):
errors[CONF_THINKING_BUDGET] = "thinking_budget_too_large"
if user_input.get(CONF_WEB_SEARCH, RECOMMENDED_WEB_SEARCH):
model = user_input.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL)
if model.startswith(tuple(WEB_SEARCH_UNSUPPORTED_MODELS)):
errors[CONF_WEB_SEARCH] = "web_search_unsupported_model"
elif user_input.get(
CONF_WEB_SEARCH_USER_LOCATION, RECOMMENDED_WEB_SEARCH_USER_LOCATION
):
user_input.update(await self._get_location_data())

if not errors:
if self._is_new:
Expand Down Expand Up @@ -215,6 +243,68 @@ async def async_step_set_options(
errors=errors or None,
)

async def _get_location_data(self) -> dict[str, str]:
"""Get approximate location data of the user."""
location_data: dict[str, str] = {}
zone_home = self.hass.states.get(ENTITY_ID_HOME)
if zone_home is not None:
client = await self.hass.async_add_executor_job(
partial(
anthropic.AsyncAnthropic,
api_key=self._get_entry().data[CONF_API_KEY],
)
)
location_schema = vol.Schema(
{
vol.Optional(
CONF_WEB_SEARCH_CITY,
description="Free text input for the city, e.g. `San Francisco`",
): str,
vol.Optional(
CONF_WEB_SEARCH_REGION,
description="Free text input for the region, e.g. `California`",
): str,
}
)
response = await client.messages.create(
model=RECOMMENDED_CHAT_MODEL,
messages=[
{
"role": "user",
"content": "Where are the following coordinates located: "
f"({zone_home.attributes[ATTR_LATITUDE]},"
f" {zone_home.attributes[ATTR_LONGITUDE]})? Please respond "
"only with a JSON object using the following schema:\n"
f"{convert(location_schema)}",
},
{
"role": "assistant",
"content": "{", # hints the model to skip any preamble
},
],
max_tokens=RECOMMENDED_MAX_TOKENS,
)
_LOGGER.debug("Model response: %s", response.content)
location_data = location_schema(
json.loads(
"{"
+ "".join(
block.text
for block in response.content
if isinstance(block, anthropic.types.TextBlock)
)
)
or {}
)

if self.hass.config.country:
location_data[CONF_WEB_SEARCH_COUNTRY] = self.hass.config.country
location_data[CONF_WEB_SEARCH_TIMEZONE] = self.hass.config.time_zone

_LOGGER.debug("Location data: %s", location_data)

return location_data

async_step_user = async_step_set_options
async_step_reconfigure = async_step_set_options

Expand Down Expand Up @@ -273,6 +363,18 @@ def anthropic_config_option_schema(
CONF_THINKING_BUDGET,
default=RECOMMENDED_THINKING_BUDGET,
): int,
vol.Optional(
CONF_WEB_SEARCH,
default=RECOMMENDED_WEB_SEARCH,
): bool,
vol.Optional(
CONF_WEB_SEARCH_MAX_USES,
default=RECOMMENDED_WEB_SEARCH_MAX_USES,
): int,
vol.Optional(
CONF_WEB_SEARCH_USER_LOCATION,
default=RECOMMENDED_WEB_SEARCH_USER_LOCATION,
): bool,
}
)
return schema
17 changes: 17 additions & 0 deletions homeassistant/components/anthropic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,26 @@
CONF_THINKING_BUDGET = "thinking_budget"
RECOMMENDED_THINKING_BUDGET = 0
MIN_THINKING_BUDGET = 1024
CONF_WEB_SEARCH = "web_search"
RECOMMENDED_WEB_SEARCH = False
CONF_WEB_SEARCH_USER_LOCATION = "user_location"
RECOMMENDED_WEB_SEARCH_USER_LOCATION = False
CONF_WEB_SEARCH_MAX_USES = "web_search_max_uses"
RECOMMENDED_WEB_SEARCH_MAX_USES = 5
CONF_WEB_SEARCH_CITY = "city"
CONF_WEB_SEARCH_REGION = "region"
CONF_WEB_SEARCH_COUNTRY = "country"
CONF_WEB_SEARCH_TIMEZONE = "timezone"

NON_THINKING_MODELS = [
"claude-3-5", # Both sonnet and haiku
"claude-3-opus",
"claude-3-haiku",
]

WEB_SEARCH_UNSUPPORTED_MODELS = [
"claude-3-haiku",
"claude-3-opus",
"claude-3-5-sonnet-20240620",
"claude-3-5-sonnet-20241022",
]
Loading
Loading