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
File renamed without changes.
2 changes: 1 addition & 1 deletion CLAUDE.md
12 changes: 11 additions & 1 deletion homeassistant/components/acaia/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ADDRESS
from homeassistant.core import HomeAssistant
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator

from .const import CONF_IS_NEW_STYLE_SCALE

SCAN_INTERVAL = timedelta(seconds=15)
UPDATE_DEBOUNCE_TIME = 0.2

_LOGGER = logging.getLogger(__name__)

Expand All @@ -38,11 +40,19 @@ def __init__(self, hass: HomeAssistant, entry: AcaiaConfigEntry) -> None:
config_entry=entry,
)

debouncer = Debouncer(
hass=hass,
logger=_LOGGER,
cooldown=UPDATE_DEBOUNCE_TIME,
immediate=True,
function=self.async_update_listeners,
)

self._scale = AcaiaScale(
address_or_ble_device=entry.data[CONF_ADDRESS],
name=entry.title,
is_new_style_scale=entry.data[CONF_IS_NEW_STYLE_SCALE],
notify_callback=self.async_update_listeners,
notify_callback=debouncer.async_schedule_call,
scanner=async_get_scanner(hass),
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/airos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/airos",
"iot_class": "local_polling",
"quality_scale": "bronze",
"requirements": ["airos==0.5.4"]
"requirements": ["airos==0.5.5"]
}
24 changes: 20 additions & 4 deletions homeassistant/components/airthings_ble/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from airthings_ble import AirthingsBluetoothDeviceData, AirthingsDevice
from bleak import BleakError
from habluetooth import BluetoothServiceInfoBleak
import voluptuous as vol

from homeassistant.components import bluetooth
Expand Down Expand Up @@ -44,7 +45,7 @@ def get_name(device: AirthingsDevice) -> str:

name = device.friendly_name()
if identifier := device.identifier:
name += f" ({identifier})"
name += f" ({device.model.value}{identifier})"
return name


Expand Down Expand Up @@ -117,6 +118,12 @@ async def async_step_bluetooth_confirm(
) -> ConfigFlowResult:
"""Confirm discovery."""
if user_input is not None:
if (
self._discovered_device is not None
and self._discovered_device.device.firmware.need_firmware_upgrade
):
return self.async_abort(reason="firmware_upgrade_required")

return self.async_create_entry(
title=self.context["title_placeholders"]["name"], data={}
)
Expand All @@ -137,6 +144,9 @@ async def async_step_user(
self._abort_if_unique_id_configured()
discovery = self._discovered_devices[address]

if discovery.device.firmware.need_firmware_upgrade:
return self.async_abort(reason="firmware_upgrade_required")

self.context["title_placeholders"] = {
"name": discovery.name,
}
Expand All @@ -146,21 +156,27 @@ async def async_step_user(
return self.async_create_entry(title=discovery.name, data={})

current_addresses = self._async_current_ids(include_ignore=False)
devices: list[BluetoothServiceInfoBleak] = []
for discovery_info in async_discovered_service_info(self.hass):
address = discovery_info.address
if address in current_addresses or address in self._discovered_devices:
continue

if MFCT_ID not in discovery_info.manufacturer_data:
continue

if not any(uuid in SERVICE_UUIDS for uuid in discovery_info.service_uuids):
continue
devices.append(discovery_info)

for discovery_info in devices:
address = discovery_info.address
try:
device = await self._get_device_data(discovery_info)
except AirthingsDeviceUpdateError:
return self.async_abort(reason="cannot_connect")
_LOGGER.error(
"Error connecting to and getting data from %s",
discovery_info.address,
)
continue
except Exception:
_LOGGER.exception("Unknown error occurred")
return self.async_abort(reason="unknown")
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/airthings_ble/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"firmware_upgrade_required": "Your device requires a firmware upgrade. Please use the Airthings app (Android/iOS) to upgrade it.",
"unknown": "[%key:common::config_flow::error::unknown%]"
}
},
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/alexa_devices/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class AmazonBinarySensorEntityDescription(BinarySensorEntityDescription):
),
is_supported=lambda device, key: device.sensors.get(key) is not None,
is_available_fn=lambda device, key: (
device.online and device.sensors[key].error is False
device.online
and (sensor := device.sensors.get(key)) is not None
and sensor.error is False
),
),
)
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/alexa_devices/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ class AmazonSensorEntityDescription(SensorEntityDescription):

native_unit_of_measurement_fn: Callable[[AmazonDevice, str], str] | None = None
is_available_fn: Callable[[AmazonDevice, str], bool] = lambda device, key: (
device.online and device.sensors[key].error is False
device.online
and (sensor := device.sensors.get(key)) is not None
and sensor.error is False
)


SENSORS: Final = (
AmazonSensorEntityDescription(
key="temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement_fn=lambda device, _key: (
native_unit_of_measurement_fn=lambda device, key: (
UnitOfTemperature.CELSIUS
if device.sensors[_key].scale == "CELSIUS"
if key in device.sensors and device.sensors[key].scale == "CELSIUS"
else UnitOfTemperature.FAHRENHEIT
),
state_class=SensorStateClass.MEASUREMENT,
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/alexa_devices/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class AmazonSwitchEntityDescription(SwitchEntityDescription):

is_on_fn: Callable[[AmazonDevice], bool]
is_available_fn: Callable[[AmazonDevice, str], bool] = lambda device, key: (
device.online and device.sensors[key].error is False
device.online
and (sensor := device.sensors.get(key)) is not None
and sensor.error is False
)
method: str

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ def __init__(
"""Initialize the agent."""
self.entry = entry
self.subentry = subentry
self.default_model = default_model
self._attr_name = subentry.title
self._genai_client = entry.runtime_data
self._attr_unique_id = subentry.subentry_id
Expand Down Expand Up @@ -489,7 +490,7 @@ async def _async_handle_chat_log(
tools = tools or []
tools.append(Tool(google_search=GoogleSearch()))

model_name = options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL)
model_name = options.get(CONF_CHAT_MODEL, self.default_model)
# Avoid INVALID_ARGUMENT Developer instruction is not enabled for <model>
supports_system_instruction = (
"gemma" not in model_name
Expand Down Expand Up @@ -620,7 +621,7 @@ async def _async_handle_chat_log(
def create_generate_content_config(self) -> GenerateContentConfig:
"""Create the GenerateContentConfig for the LLM."""
options = self.subentry.data
model = options.get(CONF_CHAT_MODEL, RECOMMENDED_CHAT_MODEL)
model = options.get(CONF_CHAT_MODEL, self.default_model)
thinking_config: ThinkingConfig | None = None
if model.startswith("models/gemini-2.5") and not model.endswith(
("tts", "image", "image-preview")
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homekit_controller/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
"iot_class": "local_push",
"loggers": ["aiohomekit", "commentjson"],
"requirements": ["aiohomekit==3.2.19"],
"requirements": ["aiohomekit==3.2.20"],
"zeroconf": ["_hap._tcp.local.", "_hap._udp.local."]
}
11 changes: 9 additions & 2 deletions homeassistant/components/lamarzocco/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from datetime import datetime
from typing import cast

from pylamarzocco.const import BackFlushStatus, ModelName, WidgetType
from pylamarzocco.const import BackFlushStatus, MachineState, ModelName, WidgetType
from pylamarzocco.models import (
BackFlush,
BaseWidgetOutput,
Expand Down Expand Up @@ -97,7 +97,14 @@ class LaMarzoccoSensorEntityDescription(
).brewing_start_time
),
entity_category=EntityCategory.DIAGNOSTIC,
available_fn=(lambda coordinator: not coordinator.websocket_terminated),
available_fn=(
lambda coordinator: not coordinator.websocket_terminated
and cast(
MachineStatus,
coordinator.device.dashboard.config[WidgetType.CM_MACHINE_STATUS],
).status
is MachineState.BREWING
),
),
LaMarzoccoSensorEntityDescription(
key="steam_boiler_ready_time",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ntfy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "cloud_push",
"loggers": ["aionfty"],
"quality_scale": "platinum",
"requirements": ["aiontfy==0.6.0"]
"requirements": ["aiontfy==0.6.1"]
}
4 changes: 2 additions & 2 deletions homeassistant/components/ntfy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class NtfySensor(StrEnum):
device_class=SensorDeviceClass.DATA_SIZE,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.MEBIBYTES,
suggested_display_precision=0,
suggested_display_precision=2,
),
NtfySensorEntityDescription(
key=NtfySensor.ATTACHMENT_TOTAL_SIZE_REMAINING,
Expand All @@ -172,7 +172,7 @@ class NtfySensor(StrEnum):
device_class=SensorDeviceClass.DATA_SIZE,
native_unit_of_measurement=UnitOfInformation.BYTES,
suggested_unit_of_measurement=UnitOfInformation.MEBIBYTES,
suggested_display_precision=0,
suggested_display_precision=2,
entity_registry_enabled_default=False,
),
NtfySensorEntityDescription(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def __init__(
),
"presencezone_state": RpcBinarySensorDescription(
key="presencezone",
sub_key="state",
sub_key="value",
name="Occupancy",
device_class=BinarySensorDeviceClass.OCCUPANCY,
entity_class=RpcPresenceBinarySensor,
Expand Down
10 changes: 1 addition & 9 deletions homeassistant/components/shelly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,7 @@ class BLEScannerMode(StrEnum):

CONF_GEN = "gen"

VIRTUAL_COMPONENTS = (
"boolean",
"button",
"enum",
"input",
"number",
"presencezone",
"text",
)
VIRTUAL_COMPONENTS = ("boolean", "button", "enum", "input", "number", "text")
VIRTUAL_COMPONENTS_MAP = {
"binary_sensor": {"types": ["boolean"], "modes": ["label"]},
"button": {"types": ["button"], "modes": ["button"]},
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def get_rpc_channel_name(device: RpcDevice, key: str) -> str | None:
if key in device.config and key != "em:0":
# workaround for Pro 3EM, we don't want to get name for em:0
if component_name := device.config[key].get("name"):
if component in (*VIRTUAL_COMPONENTS, "script"):
if component in (*VIRTUAL_COMPONENTS, "presencezone", "script"):
return cast(str, component_name)

return cast(str, component_name) if instances == 1 else None
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/upcloud/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/upcloud",
"iot_class": "cloud_polling",
"requirements": ["upcloud-api==2.8.0"]
"requirements": ["upcloud-api==2.9.0"]
}
Loading
Loading