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 .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ homeassistant.components.aladdin_connect.*
homeassistant.components.alarm_control_panel.*
homeassistant.components.alert.*
homeassistant.components.alexa.*
homeassistant.components.alexa_devices.*
homeassistant.components.alpha_vantage.*
homeassistant.components.amazon_devices.*
homeassistant.components.amazon_polly.*
homeassistant.components.amberelectric.*
homeassistant.components.ambient_network.*
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS

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

31 changes: 0 additions & 31 deletions homeassistant/backports/functools.py

This file was deleted.

2 changes: 1 addition & 1 deletion homeassistant/brands/amazon.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Amazon",
"integrations": [
"alexa",
"amazon_devices",
"alexa_devices",
"amazon_polly",
"aws",
"aws_s3",
Expand Down
15 changes: 15 additions & 0 deletions homeassistant/components/airthings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,71 +37,83 @@
key="radonShortTermAvg",
native_unit_of_measurement="Bq/m³",
translation_key="radon",
suggested_display_precision=0,
),
"temp": SensorEntityDescription(
key="temp",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=1,
),
"humidity": SensorEntityDescription(
key="humidity",
device_class=SensorDeviceClass.HUMIDITY,
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"pressure": SensorEntityDescription(
key="pressure",
device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
native_unit_of_measurement=UnitOfPressure.MBAR,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=1,
),
"sla": SensorEntityDescription(
key="sla",
device_class=SensorDeviceClass.SOUND_PRESSURE,
native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"battery": SensorEntityDescription(
key="battery",
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"co2": SensorEntityDescription(
key="co2",
device_class=SensorDeviceClass.CO2,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"voc": SensorEntityDescription(
key="voc",
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"light": SensorEntityDescription(
key="light",
native_unit_of_measurement=PERCENTAGE,
translation_key="light",
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"lux": SensorEntityDescription(
key="lux",
device_class=SensorDeviceClass.ILLUMINANCE,
native_unit_of_measurement=LIGHT_LUX,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"virusRisk": SensorEntityDescription(
key="virusRisk",
translation_key="virus_risk",
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"mold": SensorEntityDescription(
key="mold",
translation_key="mold",
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"rssi": SensorEntityDescription(
key="rssi",
Expand All @@ -110,18 +122,21 @@
entity_registry_enabled_default=False,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"pm1": SensorEntityDescription(
key="pm1",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
device_class=SensorDeviceClass.PM1,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
"pm25": SensorEntityDescription(
key="pm25",
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
device_class=SensorDeviceClass.PM25,
state_class=SensorStateClass.MEASUREMENT,
suggested_display_precision=0,
),
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Amazon Devices integration."""
"""Alexa Devices integration."""

from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
Expand All @@ -13,7 +13,7 @@


async def async_setup_entry(hass: HomeAssistant, entry: AmazonConfigEntry) -> bool:
"""Set up Amazon Devices platform."""
"""Set up Alexa Devices platform."""

coordinator = AmazonDevicesCoordinator(hass, entry)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@dataclass(frozen=True, kw_only=True)
class AmazonBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Amazon Devices binary sensor entity description."""
"""Alexa Devices binary sensor entity description."""

is_on_fn: Callable[[AmazonDevice], bool]

Expand All @@ -52,7 +52,7 @@ async def async_setup_entry(
entry: AmazonConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up Amazon Devices binary sensors based on a config entry."""
"""Set up Alexa Devices binary sensors based on a config entry."""

coordinator = entry.runtime_data

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Config flow for Amazon Devices integration."""
"""Config flow for Alexa Devices integration."""

from __future__ import annotations

Expand All @@ -17,7 +17,7 @@


class AmazonDevicesConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Amazon Devices."""
"""Handle a config flow for Alexa Devices."""

async def async_step_user(
self, user_input: dict[str, Any] | None = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Amazon Devices constants."""
"""Alexa Devices constants."""

import logging

_LOGGER = logging.getLogger(__package__)

DOMAIN = "amazon_devices"
DOMAIN = "alexa_devices"
CONF_LOGIN_DATA = "login_data"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Support for Amazon Devices."""
"""Support for Alexa Devices."""

from datetime import timedelta

Expand All @@ -23,7 +23,7 @@


class AmazonDevicesCoordinator(DataUpdateCoordinator[dict[str, AmazonDevice]]):
"""Base coordinator for Amazon Devices."""
"""Base coordinator for Alexa Devices."""

config_entry: AmazonConfigEntry

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Diagnostics support for Amazon Devices integration."""
"""Diagnostics support for Alexa Devices integration."""

from __future__ import annotations

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Defines a base Amazon Devices entity."""
"""Defines a base Alexa Devices entity."""

from aioamazondevices.api import AmazonDevice
from aioamazondevices.const import SPEAKER_GROUP_MODEL
Expand All @@ -12,7 +12,7 @@


class AmazonEntity(CoordinatorEntity[AmazonDevicesCoordinator]):
"""Defines a base Amazon Devices entity."""
"""Defines a base Alexa Devices entity."""

_attr_has_entity_name = True

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"domain": "amazon_devices",
"name": "Amazon Devices",
"domain": "alexa_devices",
"name": "Alexa Devices",
"codeowners": ["@chemelli74"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/amazon_devices",
"documentation": "https://www.home-assistant.io/integrations/alexa_devices",
"integration_type": "hub",
"iot_class": "cloud_polling",
"loggers": ["aioamazondevices"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@dataclass(frozen=True, kw_only=True)
class AmazonNotifyEntityDescription(NotifyEntityDescription):
"""Amazon Devices notify entity description."""
"""Alexa Devices notify entity description."""

method: Callable[[AmazonEchoApi, AmazonDevice, str], Awaitable[None]]
subkey: str
Expand Down Expand Up @@ -49,7 +49,7 @@ async def async_setup_entry(
entry: AmazonConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up Amazon Devices notification entity based on a config entry."""
"""Set up Alexa Devices notification entity based on a config entry."""

coordinator = entry.runtime_data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"step": {
"user": {
"data": {
"country": "[%key:component::amazon_devices::common::data_country%]",
"country": "[%key:component::alexa_devices::common::data_country%]",
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]",
"code": "[%key:component::amazon_devices::common::data_description_code%]"
"code": "[%key:component::alexa_devices::common::data_description_code%]"
},
"data_description": {
"country": "[%key:component::amazon_devices::common::data_description_country%]",
"username": "[%key:component::amazon_devices::common::data_description_username%]",
"password": "[%key:component::amazon_devices::common::data_description_password%]",
"code": "[%key:component::amazon_devices::common::data_description_code%]"
"country": "[%key:component::alexa_devices::common::data_description_country%]",
"username": "[%key:component::alexa_devices::common::data_description_username%]",
"password": "[%key:component::alexa_devices::common::data_description_password%]",
"code": "[%key:component::alexa_devices::common::data_description_code%]"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@dataclass(frozen=True, kw_only=True)
class AmazonSwitchEntityDescription(SwitchEntityDescription):
"""Amazon Devices switch entity description."""
"""Alexa Devices switch entity description."""

is_on_fn: Callable[[AmazonDevice], bool]
subkey: str
Expand All @@ -43,7 +43,7 @@ async def async_setup_entry(
entry: AmazonConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up Amazon Devices switches based on a config entry."""
"""Set up Alexa Devices switches based on a config entry."""

coordinator = entry.runtime_data

Expand Down
27 changes: 4 additions & 23 deletions homeassistant/components/command_line/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from homeassistant.components.notify import BaseNotificationService
from homeassistant.const import CONF_COMMAND
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import TemplateError
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util.process import kill_subprocess

from .const import CONF_COMMAND_TIMEOUT, LOGGER
from .utils import render_template_args

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,28 +44,10 @@ def __init__(self, command: str, timeout: int) -> None:

def send_message(self, message: str = "", **kwargs: Any) -> None:
"""Send a message to a command line."""
command = self.command
if " " not in command:
prog = command
args = None
args_compiled = None
else:
prog, args = command.split(" ", 1)
args_compiled = Template(args, self.hass)
if not (command := render_template_args(self.hass, self.command)):
return

rendered_args = None
if args_compiled:
args_to_render = {"arguments": args}
try:
rendered_args = args_compiled.async_render(args_to_render)
except TemplateError as ex:
LOGGER.exception("Error rendering command template: %s", ex)
return

if rendered_args != args:
command = f"{prog} {rendered_args}"

LOGGER.debug("Running command: %s, with message: %s", command, message)
LOGGER.debug("Running with message: %s", message)

with subprocess.Popen( # noqa: S602 # shell by design
command,
Expand Down
Loading
Loading