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/alexa_devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: AmazonConfigEntry) ->
)

# Convert country in domain
country = entry.data[CONF_COUNTRY]
country = entry.data[CONF_COUNTRY].lower()
domain = COUNTRY_DOMAINS.get(country, country)

# Add site to login data
Expand Down
18 changes: 9 additions & 9 deletions homeassistant/components/alexa_devices/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
DOMAIN = "alexa_devices"
CONF_LOGIN_DATA = "login_data"

DEFAULT_DOMAIN = {"domain": "com"}
DEFAULT_DOMAIN = "com"
COUNTRY_DOMAINS = {
"ar": DEFAULT_DOMAIN,
"at": DEFAULT_DOMAIN,
"au": {"domain": "com.au"},
"be": {"domain": "com.be"},
"au": "com.au",
"be": "com.be",
"br": DEFAULT_DOMAIN,
"gb": {"domain": "co.uk"},
"gb": "co.uk",
"il": DEFAULT_DOMAIN,
"jp": {"domain": "co.jp"},
"mx": {"domain": "com.mx"},
"jp": "co.jp",
"mx": "com.mx",
"no": DEFAULT_DOMAIN,
"nz": {"domain": "com.au"},
"nz": "com.au",
"pl": DEFAULT_DOMAIN,
"tr": {"domain": "com.tr"},
"tr": "com.tr",
"us": DEFAULT_DOMAIN,
"za": {"domain": "co.za"},
"za": "co.za",
}
3 changes: 3 additions & 0 deletions homeassistant/components/alexa_devices/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import LIGHT_LUX, UnitOfTemperature
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -41,11 +42,13 @@ class AmazonSensorEntityDescription(SensorEntityDescription):
if device.sensors[_key].scale == "CELSIUS"
else UnitOfTemperature.FAHRENHEIT
),
state_class=SensorStateClass.MEASUREMENT,
),
AmazonSensorEntityDescription(
key="illuminance",
device_class=SensorDeviceClass.ILLUMINANCE,
native_unit_of_measurement=LIGHT_LUX,
state_class=SensorStateClass.MEASUREMENT,
),
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/apcupsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from .coordinator import APCUPSdConfigEntry, APCUPSdCoordinator

PLATFORMS: Final = (Platform.BINARY_SENSOR, Platform.SENSOR)
PLATFORMS: Final = [Platform.BINARY_SENSOR, Platform.SENSOR]


async def async_setup_entry(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bayesian/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
},
"numeric_state": {
"title": "[%key:component::bayesian::config_subentries::observation::step::state::title%]",
"description": "[%key:component::bayesian::config_subentries::observation::step::state::description%]",
"description": "[%key:component::bayesian::config_subentries::observation::step::numeric_state::description%]",
"data": {
"name": "[%key:common::config_flow::data::name%]",
"entity_id": "[%key:component::bayesian::config_subentries::observation::step::state::data::entity_id%]",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/fritz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"documentation": "https://www.home-assistant.io/integrations/fritz",
"iot_class": "local_polling",
"loggers": ["fritzconnection"],
"requirements": ["fritzconnection[qr]==1.14.0", "xmltodict==0.13.0"],
"requirements": ["fritzconnection[qr]==1.15.0", "xmltodict==0.13.0"],
"ssdp": [
{
"st": "urn:schemas-upnp-org:device:fritzbox:1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["fritzconnection"],
"requirements": ["fritzconnection[qr]==1.14.0"]
"requirements": ["fritzconnection[qr]==1.15.0"]
}
15 changes: 13 additions & 2 deletions homeassistant/components/mastodon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

from __future__ import annotations

from mastodon.Mastodon import Account, Instance, InstanceV2, Mastodon, MastodonError
from mastodon.Mastodon import (
Account,
Instance,
InstanceV2,
Mastodon,
MastodonError,
MastodonNotFoundError,
)

from homeassistant.const import (
CONF_ACCESS_TOKEN,
Expand Down Expand Up @@ -105,7 +112,11 @@ def setup_mastodon(
entry.data[CONF_ACCESS_TOKEN],
)

instance = client.instance()
try:
instance = client.instance_v2()
except MastodonNotFoundError:
instance = client.instance_v1()

account = client.account_verify_credentials()

return client, instance, account
9 changes: 7 additions & 2 deletions homeassistant/components/mastodon/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from mastodon.Mastodon import (
Account,
Instance,
InstanceV2,
MastodonNetworkError,
MastodonNotFoundError,
MastodonUnauthorizedError,
)
import voluptuous as vol
Expand Down Expand Up @@ -61,7 +63,7 @@ def check_connection(
client_secret: str,
access_token: str,
) -> tuple[
Instance | None,
InstanceV2 | Instance | None,
Account | None,
dict[str, str],
]:
Expand All @@ -73,7 +75,10 @@ def check_connection(
client_secret,
access_token,
)
instance = client.instance()
try:
instance = client.instance_v2()
except MastodonNotFoundError:
instance = client.instance_v1()
account = client.account_verify_credentials()

except MastodonNetworkError:
Expand Down
11 changes: 8 additions & 3 deletions homeassistant/components/mastodon/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Any

from mastodon.Mastodon import Account, Instance
from mastodon.Mastodon import Account, Instance, InstanceV2, MastodonNotFoundError

from homeassistant.core import HomeAssistant

Expand All @@ -27,11 +27,16 @@ async def async_get_config_entry_diagnostics(
}


def get_diagnostics(config_entry: MastodonConfigEntry) -> tuple[Instance, Account]:
def get_diagnostics(
config_entry: MastodonConfigEntry,
) -> tuple[InstanceV2 | Instance, Account]:
"""Get mastodon diagnostics."""
client = config_entry.runtime_data.client

instance = client.instance()
try:
instance = client.instance_v2()
except MastodonNotFoundError:
instance = client.instance_v1()
account = client.account_verify_credentials()

return instance, account
7 changes: 7 additions & 0 deletions homeassistant/components/matter/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def async_discover_entities(
):
continue

# check product_id
if (
schema.product_id is not None
and device_info.productID not in schema.product_id
):
continue

# check product_name
if (
schema.product_name is not None
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/matter/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class MatterDiscoverySchema:
# [optional] the endpoint's vendor_id must match ANY of these values
vendor_id: tuple[int, ...] | None = None

# [optional] the endpoint's product_id must match ANY of these values
product_id: tuple[int, ...] | None = None

# [optional] the endpoint's product_name must match ANY of these values
product_name: tuple[str, ...] | None = None

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/matter/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,6 @@ def _update_from_device(self) -> None:
clusters.BooleanStateConfiguration.Attributes.CurrentSensitivityLevel,
),
vendor_id=(4447,),
product_name=("Aqara Door and Window Sensor P2",),
product_id=(8194,),
),
]
2 changes: 1 addition & 1 deletion homeassistant/components/onvif/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(
BinarySensorDeviceClass, entry.original_device_class
)
self._attr_entity_category = entry.entity_category
self._attr_name = entry.name
self._attr_name = entry.name or entry.original_name
else:
event = device.events.get_uid(uid)
assert event
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/onvif/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
SensorDeviceClass, entry.original_device_class
)
self._attr_entity_category = entry.entity_category
self._attr_name = entry.name
self._attr_name = entry.name or entry.original_name
self._attr_native_unit_of_measurement = entry.unit_of_measurement
else:
event = device.events.get_uid(uid)
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/reolink/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ async def async_setup_entry(
ReolinkChimeNumberEntity(reolink_data, chime, entity_description)
for entity_description in CHIME_NUMBER_ENTITIES
for chime in api.chime_list
for chime in api.chime_list
if chime.channel is not None
)
async_add_entities(entities)
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/reolink/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ async def async_setup_entry(
ReolinkChimeSelectEntity(reolink_data, chime, entity_description)
for entity_description in CHIME_SELECT_ENTITIES
for chime in reolink_data.host.api.chime_list
if entity_description.supported(chime)
if entity_description.supported(chime) and chime.channel is not None
)
async_add_entities(entities)
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

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

2 changes: 1 addition & 1 deletion requirements_test_all.txt

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

1 change: 0 additions & 1 deletion tests/components/alexa_devices/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Alexa Devices tests const."""

TEST_CODE = "023123"
TEST_COUNTRY = "IT"
TEST_PASSWORD = "fake_password"
TEST_SERIAL_NUMBER = "echo_test_serial_number"
TEST_USERNAME = "[email protected]"
Expand Down
5 changes: 4 additions & 1 deletion tests/components/alexa_devices/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
Expand Down Expand Up @@ -42,6 +44,7 @@
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Echo Test Temperature',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
Expand Down
9 changes: 3 additions & 6 deletions tests/components/alexa_devices/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from homeassistant.helpers import device_registry as dr

from . import setup_integration
from .const import TEST_COUNTRY, TEST_PASSWORD, TEST_SERIAL_NUMBER, TEST_USERNAME
from .const import TEST_PASSWORD, TEST_SERIAL_NUMBER, TEST_USERNAME

from tests.common import MockConfigEntry

Expand Down Expand Up @@ -42,7 +42,7 @@ async def test_migrate_entry(
domain=DOMAIN,
title="Amazon Test Account",
data={
CONF_COUNTRY: TEST_COUNTRY,
CONF_COUNTRY: "US", # country should be in COUNTRY_DOMAINS exceptions
CONF_USERNAME: TEST_USERNAME,
CONF_PASSWORD: TEST_PASSWORD,
CONF_LOGIN_DATA: {"session": "test-session"},
Expand All @@ -58,7 +58,4 @@ async def test_migrate_entry(
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert config_entry.state is ConfigEntryState.LOADED
assert config_entry.minor_version == 2
assert (
config_entry.data[CONF_LOGIN_DATA]["site"]
== f"https://www.amazon.{TEST_COUNTRY}"
)
assert config_entry.data[CONF_LOGIN_DATA]["site"] == "https://www.amazon.com"
37 changes: 0 additions & 37 deletions tests/components/apcupsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@

from collections import OrderedDict
from typing import Final
from unittest.mock import patch

from homeassistant.components.apcupsd.const import DOMAIN
from homeassistant.components.apcupsd.coordinator import APCUPSdData
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant

from tests.common import MockConfigEntry

CONF_DATA: Final = {CONF_HOST: "test", CONF_PORT: 1234}

Expand Down Expand Up @@ -79,33 +72,3 @@
("END APC", "1970-01-01 00:00:00 0000"),
]
)


async def async_init_integration(
hass: HomeAssistant,
*,
host: str = "test",
status: dict[str, str] | None = None,
entry_id: str = "mocked-config-entry-id",
) -> MockConfigEntry:
"""Set up the APC UPS Daemon integration in HomeAssistant."""
if status is None:
status = MOCK_STATUS

entry = MockConfigEntry(
entry_id=entry_id,
version=1,
domain=DOMAIN,
title="APCUPSd",
data=CONF_DATA | {CONF_HOST: host},
unique_id=APCUPSdData(status).serial_no,
source=SOURCE_USER,
)

entry.add_to_hass(hass)

with patch("aioapcaccess.request_status", return_value=status):
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()

return entry
Loading
Loading