This commit is contained in:
Home Assistant Version Control
2026-09-13 20:31:15 +00:00
parent 8228943800
commit d7a0a08372
42 changed files with 694 additions and 25 deletions
+22 -7
View File
@@ -11,11 +11,23 @@ from __future__ import annotations
from datetime import timedelta
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_MILLION,
PERCENTAGE,
)
from homeassistant.const import PERCENTAGE
try:
# UnitOfDensity/UnitOfRatio were added in HA 2026.7.0. Below that (this
# integration's floor is 2025.2.0), fall back to the equivalent
# CONCENTRATION_* constants -- deprecated starting in HA 2026.8 (removed
# in 2027.8) but still present as aliases for the same values, and the
# only ones that exist pre-2026.7.
from homeassistant.const import UnitOfDensity, UnitOfRatio
_MICROGRAMS_PER_CUBIC_METER = UnitOfDensity.MICROGRAMS_PER_CUBIC_METER
_PARTS_PER_MILLION = UnitOfRatio.PARTS_PER_MILLION
except ImportError:
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER as _MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_MILLION as _PARTS_PER_MILLION,
)
PROJECT_URL = "https://github.com/alandtse/alexa_media_player/"
ISSUE_URL = f"{PROJECT_URL}issues"
@@ -78,6 +90,8 @@ SERVICE_RESTORE_VOLUME = "restore_volume"
SERVICE_GET_HISTORY_RECORDS = "get_history_records"
SERVICE_FORCE_LOGOUT = "force_logout"
SERVICE_ENABLE_NETWORK_DISCOVERY = "enable_network_discovery"
SERVICE_AMAZON_KIDS_ENABLE = "amazon_kids_enable"
SERVICE_AMAZON_KIDS_DISABLE = "amazon_kids_disable"
# Backoff durations for the last-called probe worker
LAST_CALLED_429_BACKOFF_INITIAL_S = 30.0
@@ -147,6 +161,7 @@ ATTR_MESSAGE = "message"
ATTR_EMAIL = "email"
ATTR_ENTITY_ID = "entity_id"
ATTR_NUM_ENTRIES = "entries"
ATTR_CHILD = "child"
COMMON_BUCKET_COUNTS = (
"accounts",
"devices",
@@ -213,8 +228,8 @@ AUTH_PROXY_NAME = "auth:alexamedia:proxy"
ALEXA_UNIT_CONVERSION = {
"Alexa.Unit.Percent": PERCENTAGE,
"Alexa.Unit.PartsPerMillion": CONCENTRATION_PARTS_PER_MILLION,
"Alexa.Unit.Density.MicroGramsPerCubicMeter": CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
"Alexa.Unit.PartsPerMillion": _PARTS_PER_MILLION,
"Alexa.Unit.Density.MicroGramsPerCubicMeter": _MICROGRAMS_PER_CUBIC_METER,
}
ALEXA_ICON_CONVERSION = {