Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
11564e3
Fix Z-Wave device class endpoint discovery (#142171)
MartinHjelmare Jun 20, 2025
d16ec81
Migrate justnimbus to use runtime_data (#147170)
epenet Jun 20, 2025
0a5d13f
fix and improve cover tests for homee (#147164)
Taraman17 Jun 20, 2025
73bed96
remove unwanted attribute in homee sensor tests (#147158)
Taraman17 Jun 20, 2025
2e21493
Bump hass-nabucasa from 0.102.0 to 0.103.0 (#147186)
klejejs Jun 20, 2025
9737005
Move kmtronic coordinator to separate module (#147182)
epenet Jun 20, 2025
e23cac8
Simplify remove listener in kodi (#147183)
epenet Jun 20, 2025
d0e77eb
Migrate keymitt_ble to use runtime_data (#147179)
epenet Jun 20, 2025
e315cb9
Migrate kostal_plenticore to use runtime_data (#147188)
epenet Jun 20, 2025
8f661fc
Migrate kegtron to use runtime_data (#147177)
epenet Jun 20, 2025
32314db
Simplify update_listener in kmtronic (#147184)
epenet Jun 20, 2025
0534339
Simplify update_listener in keenetic_ndms2 (#147173)
epenet Jun 20, 2025
8c1e43c
Bump pypck to 0.8.9 (#147174)
alengwenus Jun 20, 2025
fde36d5
Simplify update_listener in konnected (#147172)
epenet Jun 20, 2025
84e9422
Move juicenet coordinator to separate module (#147168)
epenet Jun 20, 2025
88683a3
Add support of taking a camera snapshot via go2rtc (#145205)
edenhaus Jun 20, 2025
2859e7d
Migrate kodi to use runtime_data (#147191)
epenet Jun 20, 2025
96e0d1f
Fix Charge Cable binary sensor in Teslemetry (#147136)
Bre77 Jun 20, 2025
3c91c78
Use PEP 695 TypeVar syntax for ecovacs (#147153)
cdce8p Jun 20, 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
4 changes: 4 additions & 0 deletions homeassistant/components/camera/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ async def _async_get_stream_image(
height: int | None = None,
wait_for_next_keyframe: bool = False,
) -> bytes | None:
if (provider := camera._webrtc_provider) and ( # noqa: SLF001
image := await provider.async_get_image(camera, width=width, height=height)
) is not None:
return image
if not camera.stream and CameraEntityFeature.STREAM in camera.supported_features:
camera.stream = await camera.async_create_stream()
if camera.stream:
Expand Down
9 changes: 9 additions & 0 deletions homeassistant/components/camera/webrtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ def async_close_session(self, session_id: str) -> None:
"""Close the session."""
return ## This is an optional method so we need a default here.

async def async_get_image(
self,
camera: Camera,
width: int | None = None,
height: int | None = None,
) -> bytes | None:
"""Get an image from the camera."""
return None


@callback
def async_register_webrtc_provider(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/cloud/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"integration_type": "system",
"iot_class": "cloud_push",
"loggers": ["acme", "hass_nabucasa", "snitun"],
"requirements": ["hass-nabucasa==0.102.0"],
"requirements": ["hass-nabucasa==0.103.0"],
"single_config_entry": true
}
9 changes: 4 additions & 5 deletions homeassistant/components/ecovacs/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from collections.abc import Callable
from dataclasses import dataclass
from typing import Generic

from deebot_client.capabilities import CapabilityEvent
from deebot_client.events.base import Event
from deebot_client.events.water_info import MopAttachedEvent

from homeassistant.components.binary_sensor import (
Expand All @@ -16,15 +16,14 @@
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback

from . import EcovacsConfigEntry
from .entity import EcovacsCapabilityEntityDescription, EcovacsDescriptionEntity, EventT
from .entity import EcovacsCapabilityEntityDescription, EcovacsDescriptionEntity
from .util import get_supported_entities


@dataclass(kw_only=True, frozen=True)
class EcovacsBinarySensorEntityDescription(
class EcovacsBinarySensorEntityDescription[EventT: Event](
BinarySensorEntityDescription,
EcovacsCapabilityEntityDescription,
Generic[EventT],
):
"""Class describing Deebot binary sensor entity."""

Expand Down Expand Up @@ -55,7 +54,7 @@ async def async_setup_entry(
)


class EcovacsBinarySensor(
class EcovacsBinarySensor[EventT: Event](
EcovacsDescriptionEntity[CapabilityEvent[EventT]],
BinarySensorEntity,
):
Expand Down
20 changes: 8 additions & 12 deletions homeassistant/components/ecovacs/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from collections.abc import Callable, Coroutine
from dataclasses import dataclass
from typing import Any, Generic, TypeVar
from typing import Any

from deebot_client.capabilities import Capabilities
from deebot_client.device import Device
Expand All @@ -18,11 +18,8 @@

from .const import DOMAIN

CapabilityEntity = TypeVar("CapabilityEntity")
EventT = TypeVar("EventT", bound=Event)


class EcovacsEntity(Entity, Generic[CapabilityEntity]):
class EcovacsEntity[CapabilityEntityT](Entity):
"""Ecovacs entity."""

_attr_should_poll = False
Expand All @@ -32,7 +29,7 @@ class EcovacsEntity(Entity, Generic[CapabilityEntity]):
def __init__(
self,
device: Device,
capability: CapabilityEntity,
capability: CapabilityEntityT,
**kwargs: Any,
) -> None:
"""Initialize entity."""
Expand Down Expand Up @@ -80,7 +77,7 @@ async def on_available(event: AvailabilityEvent) -> None:

self._subscribe(AvailabilityEvent, on_available)

def _subscribe(
def _subscribe[EventT: Event](
self,
event_type: type[EventT],
callback: Callable[[EventT], Coroutine[Any, Any, None]],
Expand All @@ -98,13 +95,13 @@ async def async_update(self) -> None:
self._device.events.request_refresh(event_type)


class EcovacsDescriptionEntity(EcovacsEntity[CapabilityEntity]):
class EcovacsDescriptionEntity[CapabilityEntityT](EcovacsEntity[CapabilityEntityT]):
"""Ecovacs entity."""

def __init__(
self,
device: Device,
capability: CapabilityEntity,
capability: CapabilityEntityT,
entity_description: EntityDescription,
**kwargs: Any,
) -> None:
Expand All @@ -114,13 +111,12 @@ def __init__(


@dataclass(kw_only=True, frozen=True)
class EcovacsCapabilityEntityDescription(
class EcovacsCapabilityEntityDescription[CapabilityEntityT](
EntityDescription,
Generic[CapabilityEntity],
):
"""Ecovacs entity description."""

capability_fn: Callable[[Capabilities], CapabilityEntity | None]
capability_fn: Callable[[Capabilities], CapabilityEntityT | None]


class EcovacsLegacyEntity(Entity):
Expand Down
8 changes: 3 additions & 5 deletions homeassistant/components/ecovacs/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from collections.abc import Callable
from dataclasses import dataclass
from typing import Generic

from deebot_client.capabilities import CapabilitySet
from deebot_client.events import CleanCountEvent, CutDirectionEvent, VolumeEvent
from deebot_client.events.base import Event

from homeassistant.components.number import (
NumberEntity,
Expand All @@ -23,16 +23,14 @@
EcovacsCapabilityEntityDescription,
EcovacsDescriptionEntity,
EcovacsEntity,
EventT,
)
from .util import get_supported_entities


@dataclass(kw_only=True, frozen=True)
class EcovacsNumberEntityDescription(
class EcovacsNumberEntityDescription[EventT: Event](
NumberEntityDescription,
EcovacsCapabilityEntityDescription,
Generic[EventT],
):
"""Ecovacs number entity description."""

Expand Down Expand Up @@ -94,7 +92,7 @@ async def async_setup_entry(
async_add_entities(entities)


class EcovacsNumberEntity(
class EcovacsNumberEntity[EventT: Event](
EcovacsDescriptionEntity[CapabilitySet[EventT, [int]]],
NumberEntity,
):
Expand Down
10 changes: 5 additions & 5 deletions homeassistant/components/ecovacs/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from collections.abc import Callable
from dataclasses import dataclass
from typing import Any, Generic
from typing import Any

from deebot_client.capabilities import CapabilitySetTypes
from deebot_client.device import Device
from deebot_client.events import WorkModeEvent
from deebot_client.events.base import Event
from deebot_client.events.water_info import WaterAmountEvent

from homeassistant.components.select import SelectEntity, SelectEntityDescription
Expand All @@ -15,15 +16,14 @@
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback

from . import EcovacsConfigEntry
from .entity import EcovacsCapabilityEntityDescription, EcovacsDescriptionEntity, EventT
from .entity import EcovacsCapabilityEntityDescription, EcovacsDescriptionEntity
from .util import get_name_key, get_supported_entities


@dataclass(kw_only=True, frozen=True)
class EcovacsSelectEntityDescription(
class EcovacsSelectEntityDescription[EventT: Event](
SelectEntityDescription,
EcovacsCapabilityEntityDescription,
Generic[EventT],
):
"""Ecovacs select entity description."""

Expand Down Expand Up @@ -66,7 +66,7 @@ async def async_setup_entry(
async_add_entities(entities)


class EcovacsSelectEntity(
class EcovacsSelectEntity[EventT: Event](
EcovacsDescriptionEntity[CapabilitySetTypes[EventT, [str], str]],
SelectEntity,
):
Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/ecovacs/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from collections.abc import Callable
from dataclasses import dataclass
from typing import Any, Generic
from typing import Any

from deebot_client.capabilities import CapabilityEvent, CapabilityLifeSpan, DeviceType
from deebot_client.device import Device
Expand Down Expand Up @@ -46,16 +46,14 @@
EcovacsDescriptionEntity,
EcovacsEntity,
EcovacsLegacyEntity,
EventT,
)
from .util import get_name_key, get_options, get_supported_entities


@dataclass(kw_only=True, frozen=True)
class EcovacsSensorEntityDescription(
class EcovacsSensorEntityDescription[EventT: Event](
EcovacsCapabilityEntityDescription,
SensorEntityDescription,
Generic[EventT],
):
"""Ecovacs sensor entity description."""

Expand Down
Loading
Loading