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/autarco/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/autarco",
"iot_class": "cloud_polling",
"requirements": ["autarco==3.1.0"]
"requirements": ["autarco==3.2.0"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/calendar/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class CalendarEventListener:
def __init__(
self,
hass: HomeAssistant,
job: HassJob[..., Coroutine[Any, Any, None]],
job: HassJob[..., Coroutine[Any, Any, None] | Any],
trigger_data: dict[str, Any],
fetcher: QueuedEventFetcher,
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/conversation/chat_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ async def async_provide_llm_data(
"""Set the LLM system prompt."""
llm_api: llm.APIInstance | None = None

if user_llm_hass_api is None:
if not user_llm_hass_api:
pass
elif isinstance(user_llm_hass_api, llm.API):
llm_api = await user_llm_hass_api.async_get_api_instance(llm_context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"pid": "4001",
"description": "*zbt-2*",
"known_devices": ["ZBT-2"]
},
{
"vid": "303A",
"pid": "831A",
"description": "*zbt-2*",
"known_devices": ["ZBT-2"]
}
]
}
2 changes: 1 addition & 1 deletion homeassistant/components/imgw_pib/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/imgw_pib",
"iot_class": "cloud_polling",
"quality_scale": "silver",
"quality_scale": "platinum",
"requirements": ["imgw_pib==1.5.6"]
}
10 changes: 5 additions & 5 deletions homeassistant/components/imgw_pib/quality_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ rules:
discovery:
status: exempt
comment: The integration is a cloud service and thus does not support discovery.
docs-data-update: todo
docs-examples: todo
docs-known-limitations: todo
docs-data-update: done
docs-examples: done
docs-known-limitations: done
docs-supported-devices:
status: exempt
comment: This is a service, which doesn't integrate with any devices.
docs-supported-functions: todo
docs-supported-functions: done
docs-troubleshooting:
status: exempt
comment: No known issues that could be resolved by the user.
docs-use-cases: todo
docs-use-cases: done
dynamic-devices:
status: exempt
comment: This integration has a fixed single service.
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/shelly/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class BLEScannerMode(StrEnum):

CONF_GEN = "gen"

VIRTUAL_COMPONENTS = ("boolean", "button", "enum", "input", "number", "text")
VIRTUAL_COMPONENTS = ("boolean", "button", "enum", "number", "text")
VIRTUAL_COMPONENTS_MAP = {
"binary_sensor": {"types": ["boolean"], "modes": ["label"]},
"button": {"types": ["button"], "modes": ["button"]},
Expand Down
13 changes: 13 additions & 0 deletions homeassistant/components/shelly/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@
"valve_status": {
"default": "mdi:valve"
},
"vial_name": {
"default": "mdi:scent"
},
"illuminance_level": {
"default": "mdi:brightness-5"
},
"vial_level": {
"default": "mdi:bottle-tonic-outline"
}
},
"switch": {
Expand All @@ -61,6 +67,13 @@
"off": "mdi:valve-closed",
"on": "mdi:valve-open"
}
},
"cury_slot": {
"default": "mdi:scent",
"state": {
"off": "mdi:scent-off",
"on": "mdi:scent"
}
}
}
}
Expand Down
49 changes: 49 additions & 0 deletions homeassistant/components/shelly/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class RpcNumberDescription(RpcEntityDescription, NumberEntityDescription):
min_fn: Callable[[dict], float] | None = None
step_fn: Callable[[dict], float] | None = None
mode_fn: Callable[[dict], NumberMode] | None = None
slot: str | None = None
method: str


Expand Down Expand Up @@ -121,6 +122,22 @@ async def async_set_native_value(self, value: float) -> None:
await method(self._id, value)


class RpcCuryIntensityNumber(RpcNumber):
"""Represent a RPC Cury Intensity entity."""

@rpc_call
async def async_set_native_value(self, value: float) -> None:
"""Change the value."""
method = getattr(self.coordinator.device, self.entity_description.method)

if TYPE_CHECKING:
assert method is not None

await method(
self._id, slot=self.entity_description.slot, intensity=round(value)
)


class RpcBluTrvNumber(RpcNumber):
"""Represent a RPC BluTrv number."""

Expand Down Expand Up @@ -274,6 +291,38 @@ async def async_set_native_value(self, value: float) -> None:
is True,
entity_class=RpcBluTrvNumber,
),
"left_slot_intensity": RpcNumberDescription(
key="cury",
sub_key="slots",
name="Left slot intensity",
value=lambda status, _: status["left"]["intensity"],
native_min_value=0,
native_max_value=100,
native_step=1,
mode=NumberMode.SLIDER,
native_unit_of_measurement=PERCENTAGE,
method="cury_set",
slot="left",
available=lambda status: (left := status["left"]) is not None
and left.get("vial", {}).get("level", -1) != -1,
entity_class=RpcCuryIntensityNumber,
),
"right_slot_intensity": RpcNumberDescription(
key="cury",
sub_key="slots",
name="Right slot intensity",
value=lambda status, _: status["right"]["intensity"],
native_min_value=0,
native_max_value=100,
native_step=1,
mode=NumberMode.SLIDER,
native_unit_of_measurement=PERCENTAGE,
method="cury_set",
slot="right",
available=lambda status: (right := status["right"]) is not None
and right.get("vial", {}).get("level", -1) != -1,
entity_class=RpcCuryIntensityNumber,
),
}


Expand Down
44 changes: 44 additions & 0 deletions homeassistant/components/shelly/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,50 @@ def __init__(
state_class=SensorStateClass.MEASUREMENT,
role="phase_info",
),
"cury_left_level": RpcSensorDescription(
key="cury",
sub_key="slots",
name="Left slot level",
translation_key="vial_level",
value=lambda status, _: status["left"]["vial"]["level"],
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
available=lambda status: (left := status["left"]) is not None
and left.get("vial", {}).get("level", -1) != -1,
),
"cury_left_vial": RpcSensorDescription(
key="cury",
sub_key="slots",
name="Left slot vial",
translation_key="vial_name",
value=lambda status, _: status["left"]["vial"]["name"],
entity_category=EntityCategory.DIAGNOSTIC,
available=lambda status: (left := status["left"]) is not None
and left.get("vial", {}).get("level", -1) != -1,
),
"cury_right_level": RpcSensorDescription(
key="cury",
sub_key="slots",
name="Right slot level",
translation_key="vial_level",
value=lambda status, _: status["right"]["vial"]["level"],
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
available=lambda status: (right := status["right"]) is not None
and right.get("vial", {}).get("level", -1) != -1,
),
"cury_right_vial": RpcSensorDescription(
key="cury",
sub_key="slots",
name="Right slot vial",
translation_key="vial_name",
value=lambda status, _: status["right"]["vial"]["name"],
entity_category=EntityCategory.DIAGNOSTIC,
available=lambda status: (right := status["right"]) is not None
and right.get("vial", {}).get("level", -1) != -1,
),
}


Expand Down
26 changes: 26 additions & 0 deletions homeassistant/components/shelly/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,32 @@ class RpcSwitchDescription(RpcEntityDescription, SwitchEntityDescription):
entity_registry_enabled_default=False,
entity_category=EntityCategory.CONFIG,
),
"cury_left": RpcSwitchDescription(
key="cury",
sub_key="slots",
name="Left slot",
translation_key="cury_slot",
is_on=lambda status: bool(status["slots"]["left"]["on"]),
method_on="cury_set",
method_off="cury_set",
method_params_fn=lambda id, value: (id, "left", value),
entity_registry_enabled_default=True,
available=lambda status: (left := status["left"]) is not None
and left.get("vial", {}).get("level", -1) != -1,
),
"cury_right": RpcSwitchDescription(
key="cury",
sub_key="slots",
name="Right slot",
translation_key="cury_slot",
is_on=lambda status: bool(status["slots"]["right"]["on"]),
method_on="cury_set",
method_off="cury_set",
method_params_fn=lambda id, value: (id, "right", value),
entity_registry_enabled_default=True,
available=lambda status: (right := status["right"]) is not None
and right.get("vial", {}).get("level", -1) != -1,
),
}


Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/shelly/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,12 @@ 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, "presencezone", "script"):
if component in (*VIRTUAL_COMPONENTS, "input", "presencezone", "script"):
return cast(str, component_name)

return cast(str, component_name) if instances == 1 else None

if component in VIRTUAL_COMPONENTS:
if component in (*VIRTUAL_COMPONENTS, "input"):
return f"{component.title()} {component_id}"

return None
Expand Down
25 changes: 23 additions & 2 deletions homeassistant/components/zwave_js/device_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import asyncio
from typing import Any

import voluptuous as vol
Expand All @@ -20,7 +21,7 @@
CONF_PLATFORM,
CONF_TYPE,
)
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
from homeassistant.core import CALLBACK_TYPE, Context, HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import (
config_validation as cv,
Expand Down Expand Up @@ -454,8 +455,28 @@ async def async_attach_trigger(
zwave_js_config = await validate_value_updated_trigger_config(
hass, zwave_js_config
)

@callback
def run_action(
extra_trigger_payload: dict[str, Any],
description: str,
context: Context | None = None,
) -> asyncio.Task[Any]:
"""Run action with trigger variables."""

payload = {
"trigger": {
**trigger_info["trigger_data"],
CONF_PLATFORM: VALUE_UPDATED_PLATFORM_TYPE,
"description": description,
**extra_trigger_payload,
}
}

return hass.async_create_task(action(payload, context))

return await attach_value_updated_trigger(
hass, zwave_js_config[CONF_OPTIONS], action, trigger_info
hass, zwave_js_config[CONF_OPTIONS], run_action
)

raise HomeAssistantError(f"Unhandled trigger type {trigger_type}")
Expand Down
Loading
Loading