Added Alexa Music
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,261 @@
|
||||
"""
|
||||
Alexa Devices Alarm Control Panel using Guard Mode.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
from asyncio import sleep
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from alexapy import hide_email, hide_serial
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity
|
||||
from homeassistant.const import CONF_EMAIL, STATE_UNAVAILABLE
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .alexa_entity import parse_guard_state_from_coordinator
|
||||
from .alexa_media import AlexaMedia
|
||||
from .const import (
|
||||
CONF_EXCLUDE_DEVICES,
|
||||
CONF_INCLUDE_DEVICES,
|
||||
CONF_QUEUE_DELAY,
|
||||
DATA_ALEXAMEDIA,
|
||||
DEFAULT_QUEUE_DELAY,
|
||||
DOMAIN as ALEXA_DOMAIN,
|
||||
)
|
||||
from .helpers import _catch_login_errors, add_devices, safe_get
|
||||
|
||||
try:
|
||||
from homeassistant.components.alarm_control_panel import AlarmControlPanelState
|
||||
|
||||
STATE_ALARM_ARMED_AWAY = AlarmControlPanelState.ARMED_AWAY
|
||||
STATE_ALARM_DISARMED = AlarmControlPanelState.DISARMED
|
||||
except ImportError:
|
||||
from homeassistant.const import STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEPENDENCIES = [ALEXA_DOMAIN]
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, add_devices_callback, discovery_info=None
|
||||
) -> bool:
|
||||
"""Set up the Alexa alarm control panel platform."""
|
||||
devices: list[AlexaAlarmControlPanel] = []
|
||||
account = None
|
||||
if config:
|
||||
account = config.get(CONF_EMAIL)
|
||||
if account is None and discovery_info:
|
||||
account = safe_get(discovery_info, ["config", CONF_EMAIL])
|
||||
if account is None:
|
||||
raise ConfigEntryNotReady
|
||||
include_filter = config.get(CONF_INCLUDE_DEVICES, [])
|
||||
exclude_filter = config.get(CONF_EXCLUDE_DEVICES, [])
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
guard_media_players = {}
|
||||
for key, device in account_dict["devices"]["media_player"].items():
|
||||
if key not in account_dict["entities"]["media_player"]:
|
||||
_LOGGER.debug(
|
||||
"%s: Media player %s not loaded yet; delaying load",
|
||||
hide_email(account),
|
||||
hide_serial(key),
|
||||
)
|
||||
raise ConfigEntryNotReady
|
||||
if "GUARD_EARCON" in device["capabilities"]:
|
||||
guard_media_players[key] = account_dict["entities"]["media_player"][key]
|
||||
if "alarm_control_panel" not in (account_dict["entities"]):
|
||||
(
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"][
|
||||
"alarm_control_panel"
|
||||
]
|
||||
) = {}
|
||||
alexa_client: Optional[AlexaAlarmControlPanel] = None
|
||||
guard_entities = safe_get(account_dict, ["devices", "guard"], [])
|
||||
if guard_entities:
|
||||
alexa_client = AlexaAlarmControlPanel(
|
||||
account_dict["login_obj"],
|
||||
account_dict["coordinator"],
|
||||
guard_entities[0],
|
||||
guard_media_players,
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug("%s: No Alexa Guard entity found", hide_email(account))
|
||||
if not (alexa_client and alexa_client.unique_id):
|
||||
_LOGGER.debug(
|
||||
"%s: Skipping creation of uninitialized device: %s",
|
||||
hide_email(account),
|
||||
alexa_client,
|
||||
)
|
||||
elif alexa_client.unique_id not in (
|
||||
account_dict["entities"]["alarm_control_panel"]
|
||||
):
|
||||
devices.append(alexa_client)
|
||||
(
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"][
|
||||
"alarm_control_panel"
|
||||
][alexa_client.unique_id]
|
||||
) = alexa_client
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"%s: Skipping already added device: %s", hide_email(account), alexa_client
|
||||
)
|
||||
return await add_devices(
|
||||
hide_email(account),
|
||||
devices,
|
||||
add_devices_callback,
|
||||
include_filter,
|
||||
exclude_filter,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||
"""Set up the Alexa alarm control panel platform by config_entry."""
|
||||
return await async_setup_platform(
|
||||
hass, config_entry.data, async_add_devices, discovery_info=None
|
||||
)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
account = entry.data[CONF_EMAIL]
|
||||
_LOGGER.debug("Attempting to unload alarm control panel")
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
for device in account_dict["entities"]["alarm_control_panel"].values():
|
||||
_LOGGER.debug("Removing %s", device)
|
||||
await device.async_remove()
|
||||
return True
|
||||
|
||||
|
||||
class AlexaAlarmControlPanel(AlarmControlPanelEntity, AlexaMedia, CoordinatorEntity):
|
||||
"""Implementation of Alexa Media Player alarm control panel."""
|
||||
|
||||
def __init__(self, login, coordinator, guard_entity, media_players=None) -> None:
|
||||
"""Initialize the Alexa device."""
|
||||
AlexaMedia.__init__(self, None, login)
|
||||
CoordinatorEntity.__init__(self, coordinator)
|
||||
_LOGGER.debug("%s: Initiating alarm control panel", hide_email(login.email))
|
||||
# AlexaAPI requires a AlexaClient object, need to clean this up
|
||||
|
||||
# Guard info
|
||||
self._appliance_id = guard_entity["appliance_id"]
|
||||
self._guard_entity_id = guard_entity["id"]
|
||||
self._friendly_name = "Alexa Guard " + self._appliance_id[-5:]
|
||||
self._media_players = {} or media_players
|
||||
self._attrs: dict[str, str] = {}
|
||||
_LOGGER.debug(
|
||||
"%s: Guard Discovered %s: %s %s",
|
||||
self.account,
|
||||
self._friendly_name,
|
||||
hide_serial(self._appliance_id),
|
||||
hide_serial(self._guard_entity_id),
|
||||
)
|
||||
|
||||
@_catch_login_errors
|
||||
async def _async_alarm_set(
|
||||
self,
|
||||
command: str = "",
|
||||
code=None, # pylint: disable=unused-argument
|
||||
) -> None:
|
||||
"""Send command."""
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
if command not in (STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED):
|
||||
_LOGGER.error("Invalid command: %s", command)
|
||||
return
|
||||
command_map = {STATE_ALARM_ARMED_AWAY: "AWAY", STATE_ALARM_DISARMED: "HOME"}
|
||||
available_media_players = list(
|
||||
filter(lambda x: x.state != STATE_UNAVAILABLE, self._media_players.values())
|
||||
)
|
||||
if available_media_players:
|
||||
_LOGGER.debug("Sending guard command to: %s", available_media_players[0])
|
||||
available_media_players[0].check_login_changes()
|
||||
# Extract appliance ID safely to prevent IndexError if format is unexpected
|
||||
appliance_parts = self._appliance_id.split("_")
|
||||
appliance_id = (
|
||||
appliance_parts[2] if len(appliance_parts) > 2 else self._appliance_id
|
||||
)
|
||||
await available_media_players[0].alexa_api.set_guard_state(
|
||||
appliance_id,
|
||||
command_map[command],
|
||||
queue_delay=self.hass.data[DATA_ALEXAMEDIA]["accounts"][self.email][
|
||||
"options"
|
||||
].get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
|
||||
)
|
||||
await sleep(2) # delay
|
||||
else:
|
||||
_LOGGER.debug("Performing static guard command")
|
||||
await self.alexa_api.static_set_guard_state(
|
||||
self._login, self._guard_entity_id, command
|
||||
)
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
async def async_alarm_disarm(
|
||||
self,
|
||||
code=None, # pylint:disable=unused-argument
|
||||
) -> None:
|
||||
"""Send disarm command."""
|
||||
await self._async_alarm_set(STATE_ALARM_DISARMED)
|
||||
|
||||
async def async_alarm_arm_away(
|
||||
self,
|
||||
code=None, # pylint:disable=unused-argument
|
||||
) -> None:
|
||||
"""Send arm away command."""
|
||||
await self._async_alarm_set(STATE_ALARM_ARMED_AWAY)
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the unique ID."""
|
||||
return self._guard_entity_id
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the device."""
|
||||
return self._friendly_name
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the device."""
|
||||
_state = parse_guard_state_from_coordinator(
|
||||
self.coordinator, self._guard_entity_id
|
||||
)
|
||||
if _state == "ARMED_AWAY":
|
||||
return STATE_ALARM_ARMED_AWAY
|
||||
return STATE_ALARM_DISARMED
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Return the list of supported features."""
|
||||
# pylint: disable=import-outside-toplevel
|
||||
try:
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
except ImportError:
|
||||
return 0
|
||||
return AlarmControlPanelEntityFeature.ARM_AWAY
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return assumed state.
|
||||
|
||||
Returns
|
||||
bool: Whether the state is assumed
|
||||
|
||||
"""
|
||||
last_refresh_success = (
|
||||
self.coordinator.data and self._guard_entity_id in self.coordinator.data
|
||||
)
|
||||
return not last_refresh_success
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attrs
|
||||
@@ -0,0 +1,764 @@
|
||||
"""
|
||||
Alexa Devices Entities.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from typing import Any, Optional, TypedDict
|
||||
|
||||
from alexapy import AlexaAPI, AlexaLogin
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .helpers import safe_get
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# How long we keep "requested state" protected from stale coordinator values
|
||||
# when capabilityStates do not include a usable timeOfSample.
|
||||
_REQUESTED_STATE_TTL = timedelta(seconds=15)
|
||||
|
||||
|
||||
def has_capability(
|
||||
appliance: dict[str, Any], interface_name: str, property_name: str
|
||||
) -> bool:
|
||||
"""Determine if an appliance from the Alexa network details offers a particular interface with enough support that is worth adding to Home Assistant.
|
||||
|
||||
Args:
|
||||
appliance(dict[str, Any]): An appliance from a call to AlexaAPI.get_network_details
|
||||
interface_name(str): One of the interfaces documented by the Alexa Smart Home Skills API
|
||||
property_name(str): The property that matches the interface name.
|
||||
|
||||
"""
|
||||
for cap in appliance["capabilities"]:
|
||||
props = cap.get("properties")
|
||||
if (
|
||||
cap["interfaceName"] == interface_name
|
||||
and props
|
||||
and (props["retrievable"] or props["proactivelyReported"])
|
||||
):
|
||||
for prop in props["supported"]:
|
||||
if prop["name"] == property_name:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_hue_v1(appliance: dict[str, Any]) -> bool:
|
||||
"""Determine if an appliance is managed via the Philips Hue v1 Hub.
|
||||
|
||||
This check catches old Philips Hue bulbs and hubs, but critically, it also catches things pretending to be older
|
||||
Philips Hue bulbs and hubs. This includes things exposed by HA to Alexa using the emulated_hue integration.
|
||||
"""
|
||||
return appliance.get("manufacturerName") == "Royal Philips Electronics"
|
||||
|
||||
|
||||
def is_skill(appliance: dict[str, Any]) -> bool:
|
||||
namespace = safe_get(appliance, ["driverIdentity", "namespace"], "")
|
||||
return namespace and namespace == "SKILL"
|
||||
|
||||
|
||||
def is_known_ha_bridge(appliance: dict[str, Any] | None) -> bool:
|
||||
"""Test whether a bridge appliance is a known HA bridge to avoid creating loops."""
|
||||
|
||||
if appliance is None:
|
||||
return False
|
||||
|
||||
if appliance.get("manufacturerName") in ("t0bst4r", "Matterbridge"):
|
||||
return True
|
||||
|
||||
# Identify Matter bridge hubs regardless of manufacturerName
|
||||
if "HUB" in appliance.get("applianceTypes", []):
|
||||
driver_ns = safe_get(appliance, ["driverIdentity", "namespace"], "")
|
||||
driver_id = safe_get(appliance, ["driverIdentity", "identifier"], "")
|
||||
if driver_ns == "AAA" and driver_id == "SonarCloudService":
|
||||
interfaces = {
|
||||
cap.get("interfaceName") for cap in appliance.get("capabilities", [])
|
||||
}
|
||||
if (
|
||||
"Alexa.Matter.NodeOperationalCredentials.FabricManagement" in interfaces
|
||||
or "Alexa.Commissionable" in interfaces
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def is_local(appliance: dict[str, Any]) -> bool:
|
||||
"""Test whether locally connected.
|
||||
|
||||
This is mainly present to prevent loops with the official Alexa integration.
|
||||
There is probably a better way to prevent that, but this works.
|
||||
"""
|
||||
|
||||
if appliance.get("connectedVia"):
|
||||
# connectedVia is a flag that determines which Echo devices holds the connection. Its blank for
|
||||
# skill derived devices and includes an Echo name for zigbee and local devices.
|
||||
return True
|
||||
|
||||
# This catches the Echo/AVS devices. connectedVia isn't reliable in this case.
|
||||
# Only the first appears to get that set.
|
||||
if "ALEXA_VOICE_ENABLED" in appliance.get("applianceTypes", []):
|
||||
return not is_skill(appliance)
|
||||
|
||||
# Ledvance/Sengled bulbs connected via bluetooth are hard to detect as locally connected
|
||||
# Amazon devices are not local but bypassing the local check allows for control by the integration
|
||||
# There is probably a better way, but this works for now.
|
||||
manufacturerNames = ["Ledvance", "Sengled", "Amazon"]
|
||||
if appliance.get("manufacturerName") in manufacturerNames:
|
||||
return not is_skill(appliance)
|
||||
|
||||
# Zigbee devices are guaranteed to be local and have a particular pattern of id
|
||||
zigbee_pattern = re.compile(
|
||||
"AAA_SonarCloudService_([0-9A-F][0-9A-F]:){7}[0-9A-F][0-9A-F]", flags=re.I
|
||||
)
|
||||
return zigbee_pattern.fullmatch(appliance.get("applianceId", "")) is not None
|
||||
|
||||
|
||||
def is_alexa_guard(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance the guard alarm system of an echo."""
|
||||
return appliance["modelName"] == "REDROCK_GUARD_PANEL" and has_capability(
|
||||
appliance, "Alexa.SecurityPanelController", "armState"
|
||||
)
|
||||
|
||||
|
||||
def is_temperature_sensor(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance the temperature sensor of an Echo."""
|
||||
return (
|
||||
is_local(appliance)
|
||||
and has_capability(appliance, "Alexa.TemperatureSensor", "temperature")
|
||||
and appliance["friendlyDescription"] != "Amazon Indoor Air Quality Monitor"
|
||||
)
|
||||
|
||||
|
||||
# Checks if air quality sensor
|
||||
def is_air_quality_sensor(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance the Amazon Indoor Air Quality Monitor (AIAQM)."""
|
||||
return (
|
||||
appliance.get("friendlyDescription") == "Amazon Indoor Air Quality Monitor"
|
||||
and "AIR_QUALITY_MONITOR" in appliance.get("applianceTypes", [])
|
||||
and has_capability(appliance, "Alexa.RangeController", "rangeValue")
|
||||
)
|
||||
|
||||
|
||||
def is_light(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance a light controlled locally by an Echo."""
|
||||
return (
|
||||
is_local(appliance)
|
||||
and (
|
||||
"LIGHT" in appliance.get("applianceTypes", [])
|
||||
or (
|
||||
"SMARTPLUG" in appliance.get("applianceTypes", [])
|
||||
and appliance.get("customerDefinedDeviceType") == "LIGHT"
|
||||
)
|
||||
)
|
||||
and has_capability(appliance, "Alexa.PowerController", "powerState")
|
||||
)
|
||||
|
||||
|
||||
def is_contact_sensor(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance a contact sensor controlled locally by an Echo."""
|
||||
return (
|
||||
is_local(appliance)
|
||||
and "CONTACT_SENSOR" in appliance.get("applianceTypes", [])
|
||||
and has_capability(appliance, "Alexa.ContactSensor", "detectionState")
|
||||
)
|
||||
|
||||
|
||||
def is_switch(appliance: dict[str, Any]) -> bool:
|
||||
"""Is the given appliance a switch controlled locally by an Echo, which is not redeclared as a light."""
|
||||
return (
|
||||
is_local(appliance)
|
||||
and (
|
||||
"SMARTPLUG" in appliance.get("applianceTypes", [])
|
||||
or "SWITCH" in appliance.get("applianceTypes", [])
|
||||
)
|
||||
and appliance.get("customerDefinedDeviceType") != "LIGHT"
|
||||
and has_capability(appliance, "Alexa.PowerController", "powerState")
|
||||
)
|
||||
|
||||
|
||||
def get_friendliest_name(appliance: dict[str, Any]) -> str:
|
||||
"""Find the best friendly name. Alexa seems to store manual renames in aliases. Prefer that one."""
|
||||
aliases = appliance.get("aliases", [])
|
||||
for alias in aliases:
|
||||
friendly = alias.get("friendlyName")
|
||||
if friendly:
|
||||
return friendly
|
||||
return appliance["friendlyName"]
|
||||
|
||||
|
||||
def get_device_serial(appliance: dict[str, Any]) -> str | None:
|
||||
"""Find the device serial id if it is present."""
|
||||
alexa_device_id_list = appliance.get("alexaDeviceIdentifierList", [])
|
||||
for alexa_device_id in alexa_device_id_list:
|
||||
if isinstance(alexa_device_id, dict):
|
||||
return alexa_device_id.get("dmsDeviceSerialNumber")
|
||||
return None
|
||||
|
||||
|
||||
def get_device_bridge(
|
||||
appliance: dict[str, Any], appliances: dict[str, dict[str, Any]]
|
||||
) -> dict[str, Any] | None:
|
||||
"""Find the bridge device for an appliance connected through e.g. a Matter bridge."""
|
||||
|
||||
appliance_id = appliance.get("applianceId")
|
||||
if not isinstance(appliance_id, str) or "#" not in appliance_id:
|
||||
return None
|
||||
|
||||
# HA Matter Hub bridged endpoints are identified by applianceId prefixes
|
||||
# of the form AAA_SonarCloudService_<bridgeId>#<childId>.
|
||||
bridge_id, _sep, _child = appliance_id.partition("#")
|
||||
|
||||
if not bridge_id.startswith("AAA_SonarCloudService_"):
|
||||
return None
|
||||
|
||||
bridge = appliances.get(bridge_id)
|
||||
return bridge if isinstance(bridge, dict) else None
|
||||
|
||||
|
||||
AlexaEntityData = dict[str, list["AlexaCapabilityState"]]
|
||||
|
||||
|
||||
class AlexaEntity(TypedDict):
|
||||
"""Class for Alexaentity."""
|
||||
|
||||
id: str
|
||||
appliance_id: str
|
||||
name: str
|
||||
is_hue_v1: bool
|
||||
|
||||
|
||||
class AlexaLightEntity(AlexaEntity):
|
||||
"""Class for AlexaLightEntity."""
|
||||
|
||||
brightness: bool
|
||||
color: bool
|
||||
color_temperature: bool
|
||||
|
||||
|
||||
class AlexaTemperatureEntity(TypedDict, total=False):
|
||||
device_serial: str
|
||||
is_aiaqm: bool
|
||||
|
||||
|
||||
class AlexaAirQualityEntity(AlexaEntity):
|
||||
"""Class for AlexaAirQualityEntity."""
|
||||
|
||||
device_serial: str
|
||||
|
||||
|
||||
class AlexaAIAQMEntity(AlexaEntity):
|
||||
"""Entity-backed "device" representing an Amazon Indoor Air Quality Monitor."""
|
||||
|
||||
device_serial: str
|
||||
sensors: list[dict[str, str]]
|
||||
|
||||
|
||||
class AlexaBinaryEntity(AlexaEntity):
|
||||
"""Class for AlexaBinaryEntity."""
|
||||
|
||||
battery_level: bool
|
||||
|
||||
|
||||
class AlexaEntities(TypedDict):
|
||||
"""Class for Alexa Entities."""
|
||||
|
||||
light: list[AlexaLightEntity]
|
||||
guard: list[AlexaEntity]
|
||||
temperature: list[AlexaTemperatureEntity]
|
||||
air_quality: list[AlexaAirQualityEntity]
|
||||
aiaqm: list[AlexaAIAQMEntity]
|
||||
binary_sensor: list[AlexaBinaryEntity]
|
||||
smart_switch: list[AlexaEntity]
|
||||
|
||||
|
||||
class AlexaCapabilityState(TypedDict, total=False):
|
||||
"""Class for AlexaCapabilityState."""
|
||||
|
||||
name: str
|
||||
namespace: str
|
||||
value: int | float | str | dict[str, Any]
|
||||
instance: str
|
||||
timeOfSample: str
|
||||
uncertaintyInMilliseconds: int
|
||||
|
||||
|
||||
def parse_alexa_entities(
|
||||
network_details: list[dict[str, Any]] | None,
|
||||
debug: bool = False,
|
||||
) -> AlexaEntities:
|
||||
# pylint: disable=too-many-locals
|
||||
"""Turn the network details into a list of useful entities with the important details extracted."""
|
||||
temperature_sensors: list[AlexaTemperatureEntity] = []
|
||||
air_quality_sensors: list[AlexaAirQualityEntity] = []
|
||||
aiaqm_entities: list[AlexaAIAQMEntity] = []
|
||||
contact_sensors: list[AlexaBinaryEntity] = []
|
||||
switches: list[AlexaEntity] = []
|
||||
guards: list[AlexaEntity] = []
|
||||
lights: list[AlexaLightEntity] = []
|
||||
|
||||
function_name = "parse_alexa_entities()"
|
||||
|
||||
if not network_details:
|
||||
return {
|
||||
"light": lights,
|
||||
"guard": guards,
|
||||
"temperature": temperature_sensors,
|
||||
"air_quality": air_quality_sensors,
|
||||
"aiaqm": aiaqm_entities,
|
||||
"binary_sensor": contact_sensors,
|
||||
"smart_switch": switches,
|
||||
}
|
||||
|
||||
network_dict: dict[str, dict[str, Any]] = {}
|
||||
if debug:
|
||||
_LOGGER.debug("Processing network_details")
|
||||
|
||||
# Build an applianceId → appliance map first so bridged devices
|
||||
# can resolve their bridge regardless of list ordering.
|
||||
for appliance in network_details:
|
||||
appliance_id = appliance.get("applianceId")
|
||||
if appliance_id:
|
||||
network_dict[appliance_id] = appliance
|
||||
|
||||
for appliance in network_details:
|
||||
device_bridge = get_device_bridge(appliance, network_dict)
|
||||
|
||||
bridge_label = (
|
||||
device_bridge.get("friendlyName") or device_bridge.get("manufacturerName")
|
||||
if device_bridge
|
||||
else None
|
||||
)
|
||||
|
||||
appliance_id = str(appliance.get("applianceId", ""))
|
||||
|
||||
# Only log a bridge check when:
|
||||
# - we found a bridge, OR
|
||||
# - ADV debug is enabled AND the appliance looks like a bridge candidate
|
||||
if bridge_label is not None or (debug and "#" in appliance_id):
|
||||
_LOGGER.debug(
|
||||
"%s: Checking device bridge: %s",
|
||||
appliance.get("friendlyName"),
|
||||
bridge_label or "<none>",
|
||||
)
|
||||
|
||||
# ADV-only: only log resolution for cases where it might apply
|
||||
if debug and "#" in appliance_id:
|
||||
bridge_id = device_bridge.get("applianceId") if device_bridge else None
|
||||
_LOGGER.debug(
|
||||
"[%s] [ADV] Matter bridge resolution: appliance=%s → bridge=%s (connectedVia=%s, bridge=%s)",
|
||||
function_name,
|
||||
appliance_id,
|
||||
bridge_id,
|
||||
appliance.get("connectedVia"),
|
||||
bridge_label,
|
||||
)
|
||||
|
||||
if is_known_ha_bridge(device_bridge):
|
||||
if debug:
|
||||
_LOGGER.debug(
|
||||
'[%s] [ADV] Skipping bridged Matter device "%s" (%s) via known bridge: %s (%s)',
|
||||
function_name,
|
||||
appliance.get("friendlyName"),
|
||||
appliance.get("applianceId"),
|
||||
bridge_label,
|
||||
device_bridge.get("applianceId") if device_bridge else None,
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
'Skipping bridged Matter device "%s" via known bridge "%s"',
|
||||
appliance.get("friendlyName"),
|
||||
bridge_label or "<unknown>",
|
||||
)
|
||||
continue
|
||||
|
||||
processed_appliance: AlexaEntity = {
|
||||
"id": appliance["entityId"],
|
||||
"appliance_id": appliance["applianceId"],
|
||||
"name": get_friendliest_name(appliance),
|
||||
"is_hue_v1": is_hue_v1(appliance),
|
||||
}
|
||||
|
||||
if is_alexa_guard(appliance):
|
||||
_LOGGER.debug("Added Alexa Guard: %s", processed_appliance["name"])
|
||||
guards.append(processed_appliance)
|
||||
|
||||
elif is_temperature_sensor(appliance):
|
||||
if debug:
|
||||
_LOGGER.debug(
|
||||
"Added temperature sensor: %s", processed_appliance["name"]
|
||||
)
|
||||
serial = get_device_serial(appliance)
|
||||
temp_entity: AlexaTemperatureEntity = {
|
||||
**processed_appliance,
|
||||
"device_serial": serial if serial else appliance["entityId"],
|
||||
}
|
||||
temperature_sensors.append(temp_entity)
|
||||
|
||||
elif is_air_quality_sensor(appliance):
|
||||
if debug:
|
||||
_LOGGER.debug("Added AIAQM sensor: %s", processed_appliance["name"])
|
||||
|
||||
serial = get_device_serial(appliance)
|
||||
device_serial = serial if serial else appliance["entityId"]
|
||||
|
||||
# Build a list of sub-sensors we can read via AlexaAPI.get_entity_state.
|
||||
# AIAQM metrics are exposed via Alexa.RangeController(rangeValue) with an
|
||||
# instance per metric. Some accounts/devices use numeric instances, so
|
||||
# we derive the sensor type from the friendlyName assetId/text.
|
||||
sensors: list[dict[str, str]] = []
|
||||
for cap in appliance.get("capabilities", []):
|
||||
if cap.get("interfaceName") != "Alexa.RangeController":
|
||||
continue
|
||||
|
||||
# Must support numeric rangeValue to be a sensor.
|
||||
supported = safe_get(cap, ["properties", "supported"], [])
|
||||
if not isinstance(supported, list) or not any(
|
||||
isinstance(p, dict) and p.get("name") == "rangeValue"
|
||||
for p in supported
|
||||
):
|
||||
continue
|
||||
|
||||
instance = cap.get("instance")
|
||||
if instance is None or instance == "":
|
||||
continue
|
||||
if not isinstance(instance, str):
|
||||
if isinstance(instance, (int, float)):
|
||||
instance = str(instance)
|
||||
else:
|
||||
continue
|
||||
|
||||
unit = safe_get(cap, ["configuration", "unitOfMeasure"], "") or ""
|
||||
|
||||
resources = (
|
||||
cap.get("resources", {})
|
||||
if isinstance(cap.get("resources"), dict)
|
||||
else {}
|
||||
)
|
||||
friendly = (
|
||||
resources.get("friendlyNames", [])
|
||||
if isinstance(resources.get("friendlyNames"), list)
|
||||
else []
|
||||
)
|
||||
|
||||
sensor_type: str | None = None
|
||||
for entry in friendly:
|
||||
if not isinstance(entry, dict):
|
||||
continue
|
||||
value_obj = entry.get("value")
|
||||
asset_id = None
|
||||
if isinstance(value_obj, dict):
|
||||
asset_id = value_obj.get("assetId")
|
||||
else:
|
||||
asset_id = entry.get("assetId")
|
||||
|
||||
# Only treat Alexa.AirQuality assetIds as real AIAQM sensors.
|
||||
# Text-only friendlyNames (e.g. @type "text") must be ignored to avoid
|
||||
# creating extra sensors such as PM10.
|
||||
if isinstance(asset_id, str) and asset_id.startswith(
|
||||
"Alexa.AirQuality."
|
||||
):
|
||||
sensor_type = asset_id
|
||||
break
|
||||
|
||||
if not sensor_type:
|
||||
continue
|
||||
sensors.append(
|
||||
{
|
||||
"sensorType": str(sensor_type),
|
||||
"instance": instance,
|
||||
"unit": str(unit),
|
||||
}
|
||||
)
|
||||
|
||||
# Always register the AIAQM device (even if no sub-sensors are exposed).
|
||||
aiaqm_entity: AlexaAIAQMEntity = {
|
||||
**processed_appliance,
|
||||
"device_serial": device_serial,
|
||||
"sensors": sensors,
|
||||
}
|
||||
aiaqm_entities.append(aiaqm_entity)
|
||||
|
||||
# Backwards compatibility: also expose as air_quality for existing paths.
|
||||
aq_entity: AlexaAirQualityEntity = {
|
||||
**processed_appliance,
|
||||
"device_serial": device_serial,
|
||||
}
|
||||
air_quality_sensors.append(aq_entity)
|
||||
|
||||
# AIAQM also has temperature; ensure it gets created and grouped with AIAQM.
|
||||
temp_entity: AlexaTemperatureEntity = {
|
||||
**processed_appliance,
|
||||
"device_serial": device_serial,
|
||||
"is_aiaqm": True,
|
||||
}
|
||||
temperature_sensors.append(temp_entity)
|
||||
elif is_switch(appliance):
|
||||
if debug:
|
||||
_LOGGER.debug("Added switch: %s", processed_appliance["name"])
|
||||
switches.append(processed_appliance)
|
||||
|
||||
elif is_light(appliance):
|
||||
if debug:
|
||||
_LOGGER.debug("Added light %s", processed_appliance["name"])
|
||||
processed_appliance["brightness"] = has_capability(
|
||||
appliance, "Alexa.BrightnessController", "brightness"
|
||||
)
|
||||
processed_appliance["color"] = has_capability(
|
||||
appliance, "Alexa.ColorController", "color"
|
||||
)
|
||||
processed_appliance["color_temperature"] = has_capability(
|
||||
appliance,
|
||||
"Alexa.ColorTemperatureController",
|
||||
"colorTemperatureInKelvin",
|
||||
)
|
||||
light_entity: AlexaLightEntity = {
|
||||
**processed_appliance,
|
||||
"brightness": processed_appliance["brightness"],
|
||||
"color": processed_appliance["color"],
|
||||
"color_temperature": processed_appliance["color_temperature"],
|
||||
}
|
||||
lights.append(light_entity)
|
||||
|
||||
elif is_contact_sensor(appliance):
|
||||
if debug:
|
||||
_LOGGER.debug("Added contact sensor: %s", processed_appliance["name"])
|
||||
processed_appliance["battery_level"] = has_capability(
|
||||
appliance, "Alexa.BatteryLevelSensor", "batteryLevel"
|
||||
)
|
||||
binary_entity: AlexaBinaryEntity = {
|
||||
**processed_appliance,
|
||||
"battery_level": processed_appliance["battery_level"],
|
||||
}
|
||||
contact_sensors.append(binary_entity)
|
||||
|
||||
else:
|
||||
if debug:
|
||||
_LOGGER.debug("Unsupported entity: %s", processed_appliance["name"])
|
||||
|
||||
return {
|
||||
"light": lights,
|
||||
"guard": guards,
|
||||
"temperature": temperature_sensors,
|
||||
"air_quality": air_quality_sensors,
|
||||
"aiaqm": aiaqm_entities,
|
||||
"binary_sensor": contact_sensors,
|
||||
"smart_switch": switches,
|
||||
}
|
||||
|
||||
|
||||
async def get_entity_data(
|
||||
login_obj: AlexaLogin, entity_ids: list[str]
|
||||
) -> AlexaEntityData:
|
||||
"""Get and process the entity data into a more usable format."""
|
||||
|
||||
entities = {}
|
||||
if entity_ids:
|
||||
raw = await AlexaAPI.get_entity_state(login_obj, entity_ids=entity_ids)
|
||||
device_states = raw.get("deviceStates", []) if isinstance(raw, dict) else None
|
||||
if device_states:
|
||||
for device_state in device_states:
|
||||
entity_id = safe_get(device_state, ["entity", "entityId"])
|
||||
if entity_id:
|
||||
entities[entity_id] = []
|
||||
cap_states = device_state.get("capabilityStates", [])
|
||||
for cap_state in cap_states:
|
||||
entities[entity_id].append(json.loads(cap_state))
|
||||
return entities
|
||||
|
||||
|
||||
def parse_temperature_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator,
|
||||
entity_id: str,
|
||||
debug: bool = False,
|
||||
) -> dict[str, Any] | None:
|
||||
"""Get the temperature of an entity from the coordinator data."""
|
||||
temperature = parse_value_from_coordinator(
|
||||
coordinator,
|
||||
entity_id,
|
||||
"Alexa.TemperatureSensor",
|
||||
"temperature",
|
||||
debug=debug,
|
||||
)
|
||||
if debug:
|
||||
_LOGGER.debug("parse_temperature_from_coordinator: %s", temperature)
|
||||
return temperature
|
||||
|
||||
|
||||
def parse_air_quality_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator,
|
||||
entity_id: str,
|
||||
instance_id: str,
|
||||
debug: bool = False,
|
||||
) -> int | float | str | None:
|
||||
"""Get the air quality of an entity from the coordinator data."""
|
||||
value = parse_value_from_coordinator(
|
||||
coordinator,
|
||||
entity_id,
|
||||
"Alexa.RangeController",
|
||||
"rangeValue",
|
||||
instance=instance_id,
|
||||
debug=debug,
|
||||
)
|
||||
return value
|
||||
|
||||
|
||||
def parse_brightness_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str, since: datetime | None
|
||||
) -> int | None:
|
||||
"""Get the brightness in the range 0-100."""
|
||||
return parse_value_from_coordinator(
|
||||
coordinator,
|
||||
entity_id,
|
||||
"Alexa.BrightnessController",
|
||||
"brightness",
|
||||
since=since,
|
||||
)
|
||||
|
||||
|
||||
def parse_color_temp_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str, since: datetime | None
|
||||
) -> int | None:
|
||||
"""Get the color temperature in kelvin."""
|
||||
return parse_value_from_coordinator(
|
||||
coordinator,
|
||||
entity_id,
|
||||
"Alexa.ColorTemperatureController",
|
||||
"colorTemperatureInKelvin",
|
||||
since=since,
|
||||
)
|
||||
|
||||
|
||||
def parse_color_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str, since: datetime | None
|
||||
) -> tuple[float, float, float] | None:
|
||||
"""Get the color as a tuple of (hue, saturation, brightness)."""
|
||||
value = parse_value_from_coordinator(
|
||||
coordinator, entity_id, "Alexa.ColorController", "color", since
|
||||
)
|
||||
if value is not None:
|
||||
hue = value.get("hue", 0)
|
||||
saturation = value.get("saturation", 0)
|
||||
return hue, saturation, 1
|
||||
return None
|
||||
|
||||
|
||||
def parse_power_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str, since: datetime | None
|
||||
) -> str | None:
|
||||
"""Get the power state of the entity."""
|
||||
return parse_value_from_coordinator(
|
||||
coordinator,
|
||||
entity_id,
|
||||
"Alexa.PowerController",
|
||||
"powerState",
|
||||
since=since,
|
||||
)
|
||||
|
||||
|
||||
def parse_guard_state_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str
|
||||
) -> str | None:
|
||||
"""Get the guard state from the coordinator data."""
|
||||
return parse_value_from_coordinator(
|
||||
coordinator, entity_id, "Alexa.SecurityPanelController", "armState"
|
||||
)
|
||||
|
||||
|
||||
def parse_detection_state_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator, entity_id: str
|
||||
) -> bool | None:
|
||||
"""Get the detection state from the coordinator data."""
|
||||
return parse_value_from_coordinator(
|
||||
coordinator, entity_id, "Alexa.ContactSensor", "detectionState"
|
||||
)
|
||||
|
||||
|
||||
def parse_value_from_coordinator(
|
||||
coordinator: DataUpdateCoordinator,
|
||||
entity_id: str,
|
||||
namespace: str,
|
||||
name: str,
|
||||
since: datetime | None = None,
|
||||
instance: str | None = None,
|
||||
*,
|
||||
debug: bool = False,
|
||||
) -> Any:
|
||||
"""Parse out values from coordinator for Alexa Entities."""
|
||||
if coordinator.data and entity_id in coordinator.data:
|
||||
found_match = False
|
||||
for cap_state in coordinator.data[entity_id]:
|
||||
cap_instance = cap_state.get("instance")
|
||||
instance_match = instance is None or (
|
||||
cap_instance is not None and str(cap_instance) == str(instance)
|
||||
)
|
||||
if (
|
||||
cap_state.get("namespace") == namespace
|
||||
and cap_state.get("name") == name
|
||||
and instance_match
|
||||
):
|
||||
found_match = True
|
||||
if is_cap_state_still_acceptable(cap_state, since):
|
||||
return cap_state.get("value")
|
||||
if debug:
|
||||
_LOGGER.debug(
|
||||
"Coordinator data for %s (%s/%s instance=%s) is too old; checking other matches.",
|
||||
entity_id,
|
||||
namespace,
|
||||
name,
|
||||
instance,
|
||||
)
|
||||
# Keep searching in case a newer matching cap_state exists later.
|
||||
continue
|
||||
if debug and found_match:
|
||||
_LOGGER.debug(
|
||||
"No acceptable coordinator data found for %s (%s/%s instance=%s).",
|
||||
entity_id,
|
||||
namespace,
|
||||
name,
|
||||
instance,
|
||||
)
|
||||
else:
|
||||
if debug:
|
||||
_LOGGER.debug(
|
||||
"Coordinator has no data yet for %s, %s, %s, %s",
|
||||
entity_id,
|
||||
namespace,
|
||||
name,
|
||||
instance,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def is_cap_state_still_acceptable(
|
||||
cap_state: dict[str, Any], since: datetime | None
|
||||
) -> bool:
|
||||
"""Determine if a particular capability state is still usable given its age."""
|
||||
if since is None:
|
||||
return True
|
||||
|
||||
# Don't protect requested state forever; after TTL fall back to coordinator
|
||||
# even if timeOfSample is missing/unparsable.
|
||||
if datetime.now(timezone.utc) - since > _REQUESTED_STATE_TTL:
|
||||
return True
|
||||
|
||||
formatted_time_of_sample = cap_state.get("timeOfSample")
|
||||
if not formatted_time_of_sample:
|
||||
# If we can't prove the sample is newer than the requested state,
|
||||
# do not allow it to override optimistic/requested values.
|
||||
return False
|
||||
|
||||
try:
|
||||
time_of_sample = datetime.fromisoformat(formatted_time_of_sample)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
return time_of_sample >= since
|
||||
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
Alexa Devices Base Class.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from alexapy import AlexaAPI, hide_email
|
||||
|
||||
from .const import DATA_ALEXAMEDIA
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AlexaMedia:
|
||||
"""Implementation of Alexa Media Base object."""
|
||||
|
||||
def __init__(self, device, login) -> None:
|
||||
"""Initialize the Alexa device."""
|
||||
|
||||
# Class info
|
||||
self._login = login
|
||||
self.alexa_api = AlexaAPI(device, login)
|
||||
self.email = login.email
|
||||
self.account = hide_email(login.email)
|
||||
|
||||
def check_login_changes(self):
|
||||
"""Update Login object if it has changed."""
|
||||
# _LOGGER.debug("Checking if Login object has changed")
|
||||
try:
|
||||
login = self.hass.data[DATA_ALEXAMEDIA]["accounts"][self.email]["login_obj"]
|
||||
except (AttributeError, KeyError):
|
||||
return
|
||||
# _LOGGER.debug("Login object %s closed status: %s", login, login.session.closed)
|
||||
# _LOGGER.debug(
|
||||
# "Alexaapi %s closed status: %s",
|
||||
# self.alexa_api,
|
||||
# self.alexa_api._session.closed,
|
||||
# )
|
||||
if self.alexa_api.update_login(login):
|
||||
_LOGGER.debug("Login object has changed; updating")
|
||||
self._login = login
|
||||
self.email = login.email
|
||||
self.account = hide_email(login.email)
|
||||
@@ -0,0 +1,128 @@
|
||||
"""
|
||||
Alexa Devices Sensors.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from alexapy import hide_serial
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import (
|
||||
CONF_EMAIL,
|
||||
CONF_EXCLUDE_DEVICES,
|
||||
CONF_INCLUDE_DEVICES,
|
||||
DATA_ALEXAMEDIA,
|
||||
hide_email,
|
||||
)
|
||||
from .alexa_entity import parse_detection_state_from_coordinator
|
||||
from .const import CONF_EXTENDED_ENTITY_DISCOVERY
|
||||
from .helpers import add_devices, safe_get
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
"""Set up the Alexa sensor platform."""
|
||||
devices: list[BinarySensorEntity] = []
|
||||
account = None
|
||||
if config:
|
||||
account = config.get(CONF_EMAIL)
|
||||
if account is None and discovery_info:
|
||||
account = safe_get(discovery_info, ["config", CONF_EMAIL])
|
||||
if account is None:
|
||||
raise ConfigEntryNotReady
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
include_filter = config.get(CONF_INCLUDE_DEVICES, [])
|
||||
exclude_filter = config.get(CONF_EXCLUDE_DEVICES, [])
|
||||
coordinator = account_dict["coordinator"]
|
||||
binary_entities = safe_get(account_dict, ["devices", "binary_sensor"], [])
|
||||
if binary_entities and account_dict["options"].get(CONF_EXTENDED_ENTITY_DISCOVERY):
|
||||
for binary_entity in binary_entities:
|
||||
_LOGGER.debug(
|
||||
"Creating entity %s for a binary_sensor with name %s",
|
||||
hide_serial(binary_entity["id"]),
|
||||
binary_entity["name"],
|
||||
)
|
||||
contact_sensor = AlexaContact(coordinator, binary_entity)
|
||||
account_dict["entities"]["binary_sensor"].append(contact_sensor)
|
||||
devices.append(contact_sensor)
|
||||
|
||||
return await add_devices(
|
||||
hide_email(account),
|
||||
devices,
|
||||
add_devices_callback,
|
||||
include_filter,
|
||||
exclude_filter,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||
"""Set up the Alexa sensor platform by config_entry."""
|
||||
return await async_setup_platform(
|
||||
hass, config_entry.data, async_add_devices, discovery_info=None
|
||||
)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
account = entry.data[CONF_EMAIL]
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
_LOGGER.debug("Attempting to unload binary sensors")
|
||||
for binary_sensor in account_dict["entities"]["binary_sensor"]:
|
||||
await binary_sensor.async_remove()
|
||||
return True
|
||||
|
||||
|
||||
class AlexaContact(CoordinatorEntity, BinarySensorEntity):
|
||||
"""A contact sensor controlled by an Echo."""
|
||||
|
||||
_attr_device_class = BinarySensorDeviceClass.DOOR
|
||||
|
||||
def __init__(self, coordinator: CoordinatorEntity, details: dict):
|
||||
"""Initialize alexa contact sensor.
|
||||
|
||||
Args
|
||||
coordinator (CoordinatorEntity): Coordinator
|
||||
details (dict): Details dictionary
|
||||
|
||||
"""
|
||||
super().__init__(coordinator)
|
||||
self.alexa_entity_id = details["id"]
|
||||
self._name = details["name"]
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return name."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return unique id."""
|
||||
return self.alexa_entity_id
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return whether on."""
|
||||
detection = parse_detection_state_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id
|
||||
)
|
||||
|
||||
return detection == "DETECTED" if detection is not None else None
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return assumed state."""
|
||||
last_refresh_success = (
|
||||
self.coordinator.data and self.alexa_entity_id in self.coordinator.data
|
||||
)
|
||||
return not last_refresh_success
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,419 @@
|
||||
"""
|
||||
Support to interface with Alexa Devices.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
PERCENTAGE,
|
||||
)
|
||||
|
||||
PROJECT_URL = "https://github.com/alandtse/alexa_media_player/"
|
||||
ISSUE_URL = f"{PROJECT_URL}issues"
|
||||
NOTIFY_URL = f"{PROJECT_URL}wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service"
|
||||
|
||||
DOMAIN = "alexa_media"
|
||||
DATA_ALEXAMEDIA = "alexa_media"
|
||||
|
||||
PLAY_SCAN_INTERVAL = 20
|
||||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
MIN_TIME_BETWEEN_SCANS = SCAN_INTERVAL
|
||||
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(seconds=1)
|
||||
|
||||
ALEXA_COMPONENTS = [
|
||||
"media_player",
|
||||
]
|
||||
DEPENDENT_ALEXA_COMPONENTS = [
|
||||
"notify",
|
||||
"switch",
|
||||
"sensor",
|
||||
"alarm_control_panel",
|
||||
"light",
|
||||
"binary_sensor",
|
||||
]
|
||||
|
||||
HTTP_COOKIE_HEADER = "# HTTP Cookie File"
|
||||
CONF_ACCOUNTS = "accounts"
|
||||
CONF_DEBUG = "debug"
|
||||
CONF_HASS_URL = "hass_url"
|
||||
CONF_INCLUDE_DEVICES = "include_devices"
|
||||
CONF_EXCLUDE_DEVICES = "exclude_devices"
|
||||
CONF_QUEUE_DELAY = "queue_delay"
|
||||
CONF_PUBLIC_URL = "public_url"
|
||||
CONF_EXTENDED_ENTITY_DISCOVERY = "extended_entity_discovery"
|
||||
CONF_SECURITYCODE = "securitycode"
|
||||
CONF_OTPSECRET = "otp_secret"
|
||||
CONF_PROXY = "proxy"
|
||||
CONF_PROXY_WARNING = "proxy_warning"
|
||||
CONF_SCAN_INTERVAL = (
|
||||
"scan_interval" # local definition; HA's CONF_SCAN_INTERVAL is deprecated
|
||||
)
|
||||
CONF_TOTP_REGISTER = "registered"
|
||||
CONF_OAUTH = "oauth"
|
||||
DATA_LISTENER = "listener"
|
||||
|
||||
EXCEPTION_TEMPLATE = "An exception of type {0} occurred. Arguments:\n{1!r}"
|
||||
|
||||
DEFAULT_DEBUG = False
|
||||
DEFAULT_EXTENDED_ENTITY_DISCOVERY = False
|
||||
DEFAULT_HASS_URL = "http://homeassistant.local:8123"
|
||||
DEFAULT_PUBLIC_URL = ""
|
||||
DEFAULT_QUEUE_DELAY = 1.5
|
||||
DEFAULT_SCAN_INTERVAL = 60
|
||||
|
||||
EPOCH_MS_THRESHOLD = 10_000_000_000
|
||||
|
||||
# Service name constants used by services.py SERVICE_DEFS
|
||||
SERVICE_UPDATE_LAST_CALLED = "update_last_called"
|
||||
SERVICE_RESTORE_VOLUME = "restore_volume"
|
||||
SERVICE_GET_HISTORY_RECORDS = "get_history_records"
|
||||
SERVICE_FORCE_LOGOUT = "force_logout"
|
||||
SERVICE_ENABLE_NETWORK_DISCOVERY = "enable_network_discovery"
|
||||
|
||||
# Backoff durations for the last-called probe worker
|
||||
LAST_CALLED_429_BACKOFF_INITIAL_S = 30.0
|
||||
LAST_CALLED_429_BACKOFF_MAX_S = 15 * 60.0
|
||||
LAST_CALLED_CONN_BACKOFF_S = 10.0
|
||||
LAST_CALLED_LOGIN_BACKOFF_S = 30.0
|
||||
|
||||
# Tuning constants for the per-account last-called probe worker
|
||||
LAST_CALLED_DEBOUNCE_S = 3.5 # coalesce bursty pushes, but stay snappy
|
||||
LAST_CALLED_RETRY_DELAY_S = 4.0 # wider retry cadence for delayed routine history
|
||||
LAST_CALLED_RETRY_LIMIT = 2 # total attempts = 1 + retries (3 attempts)
|
||||
LAST_CALLED_STALE_FUDGE_MS = 5_000 # allow some clock/ordering jitter
|
||||
LAST_CALLED_SUCCESS_PACE_S = 4.0 # post-success pacing to avoid hammering
|
||||
LAST_CALLED_LOOKBACK_MS = 60_000
|
||||
LAST_CALLED_ITEMS = 10
|
||||
LAST_CALLED_COALESCE_WINDOW_MS = 2000
|
||||
|
||||
# Tuning constants for notification retries
|
||||
NOTIFICATION_COOLDOWN = 60
|
||||
NOTIFY_REFRESH_BACKOFF = 15.0
|
||||
NOTIFY_REFRESH_MAX_RETRIES = 3
|
||||
|
||||
# push-health magic numbers
|
||||
HTTP2_ERROR_THRESHOLD = 5
|
||||
LAST_PUSH_INACTIVITY_SECONDS = 600.0
|
||||
LAST_PING_MAX_AGE_SECONDS = 900.0
|
||||
|
||||
RECURRING_PATTERN = {
|
||||
None: "Never Repeat",
|
||||
"P1D": "Every day",
|
||||
"P1M": "Every month",
|
||||
"XXXX-WE": "Weekends",
|
||||
"XXXX-WD": "Weekdays",
|
||||
"XXXX-WXX-1": "Every Monday",
|
||||
"XXXX-WXX-2": "Every Tuesday",
|
||||
"XXXX-WXX-3": "Every Wednesday",
|
||||
"XXXX-WXX-4": "Every Thursday",
|
||||
"XXXX-WXX-5": "Every Friday",
|
||||
"XXXX-WXX-6": "Every Saturday",
|
||||
"XXXX-WXX-7": "Every Sunday",
|
||||
}
|
||||
|
||||
RECURRING_DAY = {
|
||||
"MO": 1,
|
||||
"TU": 2,
|
||||
"WE": 3,
|
||||
"TH": 4,
|
||||
"FR": 5,
|
||||
"SA": 6,
|
||||
"SU": 7,
|
||||
}
|
||||
RECURRING_PATTERN_ISO_SET = {
|
||||
None: {},
|
||||
"P1D": {1, 2, 3, 4, 5, 6, 7},
|
||||
"XXXX-WE": {6, 7},
|
||||
"XXXX-WD": {1, 2, 3, 4, 5},
|
||||
"XXXX-WXX-1": {1},
|
||||
"XXXX-WXX-2": {2},
|
||||
"XXXX-WXX-3": {3},
|
||||
"XXXX-WXX-4": {4},
|
||||
"XXXX-WXX-5": {5},
|
||||
"XXXX-WXX-6": {6},
|
||||
"XXXX-WXX-7": {7},
|
||||
}
|
||||
|
||||
ATTR_MESSAGE = "message"
|
||||
ATTR_EMAIL = "email"
|
||||
ATTR_ENTITY_ID = "entity_id"
|
||||
ATTR_NUM_ENTRIES = "entries"
|
||||
COMMON_BUCKET_COUNTS = (
|
||||
"accounts",
|
||||
"devices",
|
||||
"media_players",
|
||||
"players",
|
||||
"notifications",
|
||||
"entities",
|
||||
)
|
||||
COMMON_DIAGNOSTIC_BUCKETS = (
|
||||
"account",
|
||||
"accounts",
|
||||
"login",
|
||||
"logins",
|
||||
"session",
|
||||
"sessions",
|
||||
)
|
||||
COMMON_DIAGNOSTIC_NAMES = (
|
||||
"name",
|
||||
"deviceName",
|
||||
"accountName",
|
||||
"friendlyName",
|
||||
"title",
|
||||
)
|
||||
DEVICE_PLAYER_BUCKETS = ("devices", "media_players", "players")
|
||||
TO_REDACT: set[str] = {
|
||||
"email",
|
||||
"password",
|
||||
"access_token",
|
||||
"refresh_token",
|
||||
"token",
|
||||
"csrf",
|
||||
"cookie",
|
||||
"cookies",
|
||||
"session",
|
||||
"sessionid",
|
||||
"macDms",
|
||||
"mac_dms",
|
||||
"otp_secret",
|
||||
"authorization_code",
|
||||
"securitycode",
|
||||
"code_verifier",
|
||||
"adp_token",
|
||||
"device_private_key",
|
||||
"customerId",
|
||||
}
|
||||
STREAMING_ERROR_MESSAGE = (
|
||||
"Sorry, direct music streaming isn't supported. "
|
||||
"This limitation is set by Amazon, and not by Alexa-Media-Player, Music-Assistant, nor Home-Assistant."
|
||||
)
|
||||
PUBLIC_URL_ERROR_MESSAGE = (
|
||||
"To send TTS, please set the public URL in integration configuration."
|
||||
)
|
||||
STARTUP_MESSAGE = """
|
||||
{name} Version Info
|
||||
{DOMAIN}: v{version}
|
||||
alexapy API: v{alexapy_version}
|
||||
If you have any issues with this custom component, you need to open an issue here: {ISSUE_URL}
|
||||
"""
|
||||
|
||||
AUTH_CALLBACK_PATH = "/auth/alexamedia/callback"
|
||||
AUTH_CALLBACK_NAME = "auth:alexamedia:callback"
|
||||
AUTH_PROXY_PATH = "/auth/alexamedia/proxy"
|
||||
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_ICON_CONVERSION = {
|
||||
"Alexa.AirQuality.CarbonMonoxide": "mdi:molecule-co",
|
||||
"Alexa.AirQuality.Humidity": "mdi:water-percent",
|
||||
"Alexa.AirQuality.IndoorAirQuality": "mdi:numeric",
|
||||
"Alexa.AirQuality.ParticulateMatter": "mdi:blur",
|
||||
"Alexa.AirQuality.VolatileOrganicCompounds": "mdi:air-filter",
|
||||
}
|
||||
ALEXA_ICON_DEFAULT = "mdi:molecule"
|
||||
|
||||
# Device class mapping for air quality sensors
|
||||
# Maps Alexa sensor types to Home Assistant SensorDeviceClass
|
||||
ALEXA_AIR_QUALITY_DEVICE_CLASS = {
|
||||
"Alexa.AirQuality.ParticulateMatter": "pm25",
|
||||
"Alexa.AirQuality.CarbonMonoxide": "carbon_monoxide",
|
||||
"Alexa.AirQuality.IndoorAirQuality": "aqi",
|
||||
"Alexa.AirQuality.VolatileOrganicCompounds": "aqi",
|
||||
"Alexa.AirQuality.Humidity": "humidity",
|
||||
}
|
||||
|
||||
UPLOAD_PATH = "www/alexa_tts"
|
||||
|
||||
# Note: Some of these are likely wrong
|
||||
MODEL_IDS = {
|
||||
"A10A33FOX2NUBK": "Echo Spot (Gen1)",
|
||||
"A10L5JEZTKKCZ8": "Vobot Bunny",
|
||||
"A11QM4H9HGV71H": "Echo Show 5 (Gen3)",
|
||||
"A12GXV8XMS007S": "Fire TV (Gen1)",
|
||||
"A12IZU8NMHSY5U": "Generic Device",
|
||||
"A132LT22WVG6X5": "Samsung Soundbar Q700A",
|
||||
"A13B2WB920IZ7X": "Samsung HW-Q70T Soundbar",
|
||||
"A13W6HQIHKEN3Z": "Echo Auto",
|
||||
"A14ZH95E6SE9Z1": "Bose Home Speaker 300",
|
||||
"A15996VY63BQ2D": "Echo Show 8 (Gen2)",
|
||||
"A15ERDAKK5HQQG": "Sonos",
|
||||
"A15QWUTQ6FSMYX": "Echo Buds (Gen2)",
|
||||
"A16MZVIFVHX6P6": "Generic Echo",
|
||||
"A17LGWINFBUTZZ": "Anker Roav Viva",
|
||||
"A18BI6KPKDOEI4": "Ecobee4",
|
||||
"A18O6U1UQFJ0XK": "Echo Plus (Gen2)",
|
||||
"A18TCD9FP10WJ9": "Orbi Voice",
|
||||
"A18X8OBWBCSLD8": "Samsung Soundbar",
|
||||
"A195TXHV1M5D4A": "Echo Auto",
|
||||
"A1C66CX2XD756O": "Fire Tablet HD",
|
||||
"A1D54LQEG0OXJ2": "Denon Home 250",
|
||||
"A1EIANJ7PNB0Q7": "Echo Show 15 (Gen1)",
|
||||
"A1ENT81UXFMNNO": "Unknown",
|
||||
"A1ETW4IXK2PYBP": "Talk to Alexa",
|
||||
"A1F1F76XIW4DHQ": "Unknown TV",
|
||||
"A1F8D55J0FWDTN": "Fire TV (Toshiba)",
|
||||
"A1H0CMF1XM0ZP4": "Bose SoundTouch 30",
|
||||
"A1J16TEDOYCZTN": "Fire Tablet",
|
||||
"A1JJ0KFC4ZPNJ3": "Echo Input",
|
||||
"A1L4KDRIILU6N9": "Sony Speaker",
|
||||
"A1LOQ8ZHF4G510": "Samsung Soundbar Q990B",
|
||||
"A1M0A9L9HDBID3": "One-Link Safe and Sound",
|
||||
"A1MKGHX5VQBDWX": "Denon Home 150",
|
||||
"A1MUORL8FP149X": "Unknown",
|
||||
"A1N9SW0I0LUX5Y": "Ford/Lincoln Alexa App",
|
||||
"A1NL4BVLQ4L3N3": "Echo Show (Gen1)",
|
||||
"A1NQ0LXWBGVQS9": "2021 Samsung QLED TV",
|
||||
"A1P31Q3MOWSHOD": "Zolo Halo Speaker",
|
||||
"A1P7E7V3FCZKU6": "Fire TV (Gen3)",
|
||||
"A1Q69AKRWLJC0F": "TV",
|
||||
"A1Q7QCGNMXAKYW": "Generic Tablet",
|
||||
"A1QKZ9D0IJY332": "Samsung TV 2020-U",
|
||||
"A1RABVCI4QCIKC": "Echo Dot (Gen3)",
|
||||
"A1RTAM01W29CUP": "Windows App",
|
||||
"A1SCI5MODUBAT1": "Pioneer DMH-W466NEX",
|
||||
"A1TD5Z1R8IWBHA": "Tablet",
|
||||
"A1VGB7MHSIEYFK": "Fire TV Cube Gen3",
|
||||
"A1W2YILXTG9HA7": "Nextbase 522GW Dashcam",
|
||||
"A1W46V57KES4B5": "Cable TV box Brazil",
|
||||
"A1WZKXFLI43K86": "Fire TV Stick MAX",
|
||||
"A1XWJRHALS1REP": "Echo Show 5 (Gen2)",
|
||||
"A1Z88NGR2BK6A2": "Echo Show 8 (Gen1)",
|
||||
"A25EC4GIHFOCSG": "Unrecognized Media Player",
|
||||
"A25OJWHZA1MWNB": "2021 Samsung QLED TV",
|
||||
"A265XOI9586NML": "Fire TV Stick",
|
||||
"A27VEYGQBW3YR5": "Echo Link",
|
||||
"A2A3XFQ1AVYLHZ": "SONY WF-1000XM5",
|
||||
"A2BRQDVMSZD13S": "SURE Universal Remote",
|
||||
"A2C8J6UHV0KFCV": "Alexa Gear",
|
||||
"A2DS1Q2TPDJ48U": "Echo Dot Clock (Gen5)",
|
||||
"A2E0SNTXJVT7WK": "Fire TV (Gen2)",
|
||||
"A2E5N6DMWCW8MZ": "Brilliant Smart Switch",
|
||||
"A2EZ3TS0L1S2KV": "Sonos Beam",
|
||||
"A2GFL5ZMWNE0PX": "Fire TV (Gen3)",
|
||||
"A2H4LV5GIZ1JFT": "Echo Dot Clock (Gen4)",
|
||||
"A2HZENIFNYTXZD": "Facebook Portal",
|
||||
"A2I0SCCU3561Y8": "Samsung Soundbar Q800A",
|
||||
"A2IS7199CJBT71": "TV",
|
||||
"A2IVLV5VM2W81": "Alexa Mobile Voice iOS",
|
||||
"A2J0R2SD7G9LPA": "Lenovo SmartTab M10",
|
||||
"A2JKHJ0PX4J3L3": "Fire TV Cube (Gen2)",
|
||||
"A2LH725P8DQR2A": "Fabriq Riff",
|
||||
"A2LLN0UXRW4N50": "Echo Show 11 (Gen1)",
|
||||
"A2LWARUGJLBYEW": "Fire TV Stick (Gen2)",
|
||||
"A2M35JJZWCQOMZ": "Echo Plus (Gen1)",
|
||||
"A2M4YX06LWP8WI": "Fire Tablet",
|
||||
"A2N49KXGVA18AR": "Fire Tablet HD 10 Plus",
|
||||
"A2OSP3UA4VC85F": "Sonos",
|
||||
"A2R2GLZH1DFYQO": "Zolo Halo Speaker",
|
||||
"A2RU4B77X9R9NZ": "Echo Link Amp",
|
||||
"A2TF17PFR55MTB": "Alexa Mobile Voice Android",
|
||||
"A2TTLILJHVNI9X": "LG TV",
|
||||
"A2U21SRK4QGSE1": "Echo Dot (Gen4)",
|
||||
"A2UONLFQW0PADH": "Echo Show 8 (Gen3)",
|
||||
"A2V9UEGZ82H4KZ": "Fire Tablet HD 10",
|
||||
"A2VAXZ7UNGY4ZH": "Wyze Headphones",
|
||||
"A2WFDCBDEXOXR8": "Bose Soundbar 700",
|
||||
"A2WJ2CM9ARLMRH": "Rivian Electric Vehicle",
|
||||
"A2WN1FJ2HG09UN": "Ultimate Alexa App",
|
||||
"A2X8WT9JELC577": "Ecobee5",
|
||||
"A2XPGY5LRKB9BE": "Fitbit Versa 2",
|
||||
"A2Y04QPFCANLPQ": "Bose QuietComfort 35 II",
|
||||
"A303PJF6ISQ7IC": "Echo Auto",
|
||||
"A30YDR2MK8HMRV": "Echo (Gen3)",
|
||||
"A31DTMEEVDDOIV": "Fire TV Stick Lite",
|
||||
"A324YMIUSWQDGE": "Samsung 8K TV",
|
||||
"A32DDESGESSHZA": "Echo Dot (Gen3)",
|
||||
"A32DOYMUN6DTXA": "Echo Dot (Gen3)",
|
||||
"A339L426Y220I4": "Teufel Radio",
|
||||
"A347G2JC8I4HC7": "Roav Car Charger Pro",
|
||||
"A37CFAHI1O0CXT": "Logitech Blast",
|
||||
"A37M7RU8Z6ZFB": "Garmin Speak",
|
||||
"A37SHHQ3NUL7B5": "Bose Home Speaker 500",
|
||||
"A38949IHXHRQ5P": "Echo Tap",
|
||||
"A38BPK7OW001EX": "Raspberry Alexa",
|
||||
"A38EHHIB10L47V": "Fire Tablet HD 8",
|
||||
"A39BU42XNMN516": "Generic Device",
|
||||
"A3B50IC5QPZPWP": "Polk Command Bar",
|
||||
"A3B5K1G3EITBIF": "Facebook Portal",
|
||||
"A3BRT6REMPQWA8": "Bose Home Speaker 450",
|
||||
"A3BW5ZVFHRCQPO": "BMW Alexa Integration",
|
||||
"A3C9PE6TNYLTCH": "Speaker Group",
|
||||
"A3CY98NH016S5F": "Facebook Portal Mini",
|
||||
"A3D4YURNTARP5K": "Facebook Portal TV",
|
||||
"A3EH2E0YZ30OD6": "Echo Spot (Gen2)",
|
||||
"A3EVMLQTU6WL1W": "Fire TV Stick 4K Max (Gen1)",
|
||||
"A3F1S88NTZZXS9": "Dash Wand",
|
||||
"A3FX4UWTP28V1P": "Echo (Gen3)",
|
||||
"A3GFRGUNIGG1I5": "Samsung TV QN50Q60CAGXZD",
|
||||
"A3HF4YRA2L7XGC": "Fire TV Cube",
|
||||
"A3IYPH06PH1HRA": "Echo Frames",
|
||||
"A3K69RS3EIMXPI": "Hisense Smart TV",
|
||||
"A3KULB3NQN7Z1F": "Unknown TV",
|
||||
"A3L0T0VL9A921N": "Fire Tablet HD 8",
|
||||
"A3NPD82ABCPIDP": "Sonos Beam",
|
||||
"A3QPPX1R9W5RJV": "Fabriq Chorus",
|
||||
"A3QS1XP2U6UJX9": "SONY WF-1000XM4",
|
||||
"A3R9S4ZZECZ6YL": "Fire Tablet HD 10",
|
||||
"A3RBAYBE7VM004": "Echo Studio",
|
||||
"A3RCTOK2V0A4ZG": "LG TV",
|
||||
"A3RMGO6LYLH7YN": "Echo Dot (Gen4)",
|
||||
"A3S5BH2HU6VAYF": "Echo Dot (Gen2)",
|
||||
"A3SSG6GR8UU7SN": "Echo Sub",
|
||||
"A3SSWQ04XYPXBH": "Generic Tablet",
|
||||
"A3TCJ8RTT3NVI7": "Alexa Listens",
|
||||
"A3VRME03NAXFUB": "Echo Flex",
|
||||
"A4ZP7ZC4PI6TO": "Echo Show 5 (Gen1)",
|
||||
"A4ZXE0RM7LQ7A": "Echo Dot (Gen5)",
|
||||
"A52ARKF0HM2T4": "Facebook Portal+",
|
||||
"A6SIQKETF3L2E": "Unknown Device",
|
||||
"A7WXQPH584YP": "Echo (Gen2)",
|
||||
"A81PNL0A63P93": "Home Remote",
|
||||
"A8DM4FYR6D3HT": "TV",
|
||||
"AA1IN44SS3X6O": "Ecobee Thermostat Premium",
|
||||
"AB72C64C86AW2": "Echo (Gen1)",
|
||||
"ABJ2EHL7HQT4L": "Unknown Amplifier",
|
||||
"ADVBD696BHNV5": "Fire TV Stick (Gen1)",
|
||||
"AE7X7Z227NFNS": "HiMirror Mini",
|
||||
"AF473ZSOIRKFJ": "Onkyo VC-PX30",
|
||||
"AFF50AL5E3DIU": "Fire TV (Insignia)",
|
||||
"AFF5OAL5E3DIU": "Fire TV",
|
||||
"AGHZIK8D6X7QR": "Fire TV",
|
||||
"AHJYKVA63YCAQ": "Sonos",
|
||||
"AIPK7MM90V7TB": "Echo Show 10 (Gen3)",
|
||||
"AKKLQD9FZWWQS": "Jabra Elite",
|
||||
"AKNO1N0KSFN8L": "Echo Dot (Gen1)",
|
||||
"AKO51L5QAQKL2": "Alexa Jams",
|
||||
"AKPGW064GI9HE": "Fire TV Stick 4K (Gen3)",
|
||||
"ALCIV0P5M8TZ0": "Samsung Soundbar S800B",
|
||||
"ALT9P69K6LORD": "Echo Auto",
|
||||
"AMCZ48H33RCDF": "Samsung HW-Q910B 9.1.2 ch Soundbar",
|
||||
"AN630UQPG2CA4": "Fire TV (Toshiba)",
|
||||
"AO6HHP9UE6EOF": "Unknown Media Device",
|
||||
"AP1F6KUH00XPV": "Stereo/Subwoofer Pair",
|
||||
"AP4RS91ZQ0OOI": "Fire TV (Toshiba)",
|
||||
"APHEAY6LX7T13": "Samsung Smart Refrigerator",
|
||||
"AQCGW9PSYWRF": "TV",
|
||||
"AR6X0XNIME80V": "Unknown TV",
|
||||
"ASQZWP4GPYUT7": "Echo Pop",
|
||||
"ATNLRCEBX3W4P": "Generic Tablet",
|
||||
"AUPUQSVCVHXP0": "Ecobee Switch+",
|
||||
"AVD3HM0HOJAAL": "Sonos",
|
||||
"AVE5HX13UR5NO": "Logitech Zero Touch",
|
||||
"AVN2TMX8MU2YM": "Bose Home Speaker 500",
|
||||
"AVU7CPPF2ZRAS": "Fire Tablet HD 8",
|
||||
"AWZZ5CVHX2CD": "Echo Show (Gen2)",
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
"""Optimized DataUpdateCoordinator for Alexa Media Player.
|
||||
|
||||
Optimizations:
|
||||
- Debouncer for request coalescing
|
||||
- Type-safe runtime data integration
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, Callable
|
||||
|
||||
from homeassistant.helpers.debounce import Debouncer
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import DOMAIN, SCAN_INTERVAL
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .runtime_data import AlexaRuntimeData
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Debounce cooldown in seconds - prevents API hammering during push bursts
|
||||
REQUEST_REFRESH_DEBOUNCE_COOLDOWN = 1.5
|
||||
|
||||
|
||||
class AlexaMediaCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Coordinator for Alexa Media Player.
|
||||
|
||||
Features:
|
||||
- Debounced refresh requests to avoid API hammering
|
||||
- Type-safe integration with runtime_data
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
runtime_data: AlexaRuntimeData | None,
|
||||
update_method: Callable,
|
||||
scan_interval: float | None = None,
|
||||
) -> None:
|
||||
"""Initialize the coordinator.
|
||||
|
||||
Args:
|
||||
hass: Home Assistant instance
|
||||
runtime_data: Runtime data for this config entry
|
||||
update_method: Async method to fetch data
|
||||
scan_interval: Polling interval in seconds (default: SCAN_INTERVAL)
|
||||
"""
|
||||
self.runtime_data = runtime_data
|
||||
self._scan_interval = scan_interval or SCAN_INTERVAL.total_seconds()
|
||||
|
||||
# Calculate update interval based on HTTP2 status
|
||||
http2_enabled = runtime_data.http2 is not None if runtime_data else False
|
||||
update_interval = timedelta(
|
||||
seconds=self._scan_interval * 10 if http2_enabled else self._scan_interval
|
||||
)
|
||||
|
||||
# Initialize debouncer for request coalescing
|
||||
# This prevents multiple rapid refresh requests from hammering the API
|
||||
debouncer = Debouncer(
|
||||
hass,
|
||||
_LOGGER,
|
||||
cooldown=REQUEST_REFRESH_DEBOUNCE_COOLDOWN,
|
||||
immediate=True,
|
||||
)
|
||||
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
name=DOMAIN,
|
||||
config_entry=(
|
||||
runtime_data.config_entry
|
||||
if runtime_data and runtime_data.config_entry
|
||||
else None
|
||||
),
|
||||
update_method=update_method,
|
||||
update_interval=update_interval,
|
||||
request_refresh_debouncer=debouncer,
|
||||
)
|
||||
|
||||
def set_http2_status(self, enabled: bool) -> None:
|
||||
"""Update polling interval based on HTTP2 connection status.
|
||||
|
||||
When HTTP2 is enabled, we can poll less frequently since we get push updates.
|
||||
"""
|
||||
new_interval = timedelta(
|
||||
seconds=self._scan_interval * 10 if enabled else self._scan_interval
|
||||
)
|
||||
if self.update_interval != new_interval:
|
||||
self.update_interval = new_interval
|
||||
_LOGGER.debug(
|
||||
"Updated polling interval: %s (HTTP2: %s)",
|
||||
new_interval,
|
||||
enabled,
|
||||
)
|
||||
@@ -0,0 +1,445 @@
|
||||
"""Diagnostics support for Alexa Media Player."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import fields, is_dataclass
|
||||
from datetime import datetime
|
||||
from itertools import islice
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.redact import async_redact_data
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import (
|
||||
COMMON_BUCKET_COUNTS,
|
||||
COMMON_DIAGNOSTIC_BUCKETS,
|
||||
COMMON_DIAGNOSTIC_NAMES,
|
||||
DEVICE_PLAYER_BUCKETS,
|
||||
DOMAIN,
|
||||
TO_REDACT,
|
||||
)
|
||||
|
||||
|
||||
# --------------------
|
||||
# Local Functions
|
||||
# --------------------
|
||||
def _safe_dt(val: Any) -> str | None:
|
||||
"""Serialize datetimes safely for JSON diagnostics."""
|
||||
if isinstance(val, datetime):
|
||||
return val.isoformat()
|
||||
return None
|
||||
|
||||
|
||||
def _maybe_len(val: Any) -> int | None:
|
||||
"""Return the length of common container types or None if not applicable."""
|
||||
if isinstance(val, (list, tuple, dict, set)):
|
||||
return len(val)
|
||||
return None
|
||||
|
||||
|
||||
def _maybe_keys(val: Any, limit: int = 50) -> list[str] | None:
|
||||
"""Return a sanitized sample of mapping keys for diagnostics.
|
||||
|
||||
If ``val`` is a mapping, return up to ``limit`` obfuscated keys to provide
|
||||
structural insight without exposing sensitive data. Email-like keys are
|
||||
redacted when possible; otherwise keys are shortened to a non-identifying
|
||||
form. Returns ``None`` if ``val`` is not a mapping or keys cannot be read.
|
||||
"""
|
||||
|
||||
if isinstance(val, Mapping):
|
||||
try:
|
||||
# Sample up to `limit` keys to keep diagnostics small.
|
||||
def _safe_key(k: Any) -> str:
|
||||
s = str(k)
|
||||
# Emails/titles/tokens sometimes appear as keys in AMP structures.
|
||||
if re.match(r"^[^@\s]+@[^@\s]+\.[^@\s]+$", s):
|
||||
try:
|
||||
from alexapy import ( # pylint: disable=import-outside-toplevel
|
||||
hide_email,
|
||||
)
|
||||
|
||||
return hide_email(s)
|
||||
except (ImportError, AttributeError, TypeError, ValueError):
|
||||
pass
|
||||
return _obfuscate_identifier(s)
|
||||
|
||||
return sorted(_safe_key(k) for k in islice(val.keys(), limit))
|
||||
except (TypeError, AttributeError):
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def _sample_names(val: Any, *, limit: int = 5) -> list[str] | None:
|
||||
"""Try to sample human-friendly names from a list/dict of device-like objects."""
|
||||
names: list[str] = []
|
||||
|
||||
def add_name(x: Any) -> None:
|
||||
if isinstance(x, Mapping):
|
||||
for key in COMMON_DIAGNOSTIC_NAMES:
|
||||
v = x.get(key)
|
||||
if isinstance(v, str) and v:
|
||||
names.append(v)
|
||||
return
|
||||
v = getattr(x, "name", None)
|
||||
if isinstance(v, str) and v:
|
||||
names.append(v)
|
||||
|
||||
if isinstance(val, Mapping):
|
||||
for v in islice(val.values(), limit * 2):
|
||||
add_name(v)
|
||||
if len(names) >= limit:
|
||||
break
|
||||
return names[:limit] if names else None
|
||||
|
||||
if isinstance(val, (list, tuple)):
|
||||
for v in val[: limit * 2]:
|
||||
add_name(v)
|
||||
if len(names) >= limit:
|
||||
break
|
||||
return names[:limit] if names else None
|
||||
|
||||
return None
|
||||
|
||||
|
||||
# --------------------
|
||||
# Coordinator discovery + summary
|
||||
# --------------------
|
||||
def _find_coordinators(obj: Any) -> list[DataUpdateCoordinator]:
|
||||
"""Recursively find DataUpdateCoordinator instances in an object tree."""
|
||||
found: list[DataUpdateCoordinator] = []
|
||||
visited: set[int] = set()
|
||||
|
||||
def walk(x: Any) -> None:
|
||||
obj_id = id(x)
|
||||
if obj_id in visited:
|
||||
return
|
||||
visited.add(obj_id)
|
||||
|
||||
if isinstance(x, DataUpdateCoordinator):
|
||||
found.append(x)
|
||||
return
|
||||
if is_dataclass(x):
|
||||
try:
|
||||
# Walk dataclass attributes directly; asdict() can lose/mangle objects.
|
||||
for f in fields(x):
|
||||
try:
|
||||
walk(getattr(x, f.name))
|
||||
except (AttributeError, TypeError, ValueError):
|
||||
# Skip fields that can't be read safely
|
||||
pass
|
||||
except (TypeError, ValueError):
|
||||
# Fallback: vars() can work for some dataclass/slots variations
|
||||
try:
|
||||
for v in vars(x).values():
|
||||
walk(v)
|
||||
except (AttributeError, TypeError, ValueError):
|
||||
# Ignore attributes that cannot be introspected via vars()
|
||||
pass
|
||||
return
|
||||
if isinstance(x, Mapping):
|
||||
for v in x.values():
|
||||
walk(v)
|
||||
return
|
||||
if isinstance(x, (list, tuple, set)):
|
||||
for v in x:
|
||||
walk(v)
|
||||
return
|
||||
# Ignore everything else.
|
||||
|
||||
walk(obj)
|
||||
return found
|
||||
|
||||
|
||||
def _summarize_coordinator_data(cdata: Any) -> dict:
|
||||
"""
|
||||
Allowlisted summary of coordinator.data.
|
||||
|
||||
Never dump raw coordinator data. Only return counts + small samples.
|
||||
Optimized for AMP: coordinator.data is often a mapping keyed by UUIDs.
|
||||
"""
|
||||
out: dict[str, Any] = {}
|
||||
|
||||
if isinstance(cdata, Mapping):
|
||||
out["data_key_count"] = len(cdata)
|
||||
|
||||
key_sample = list(islice(cdata.keys(), 10))
|
||||
|
||||
out["data_key_types_sample"] = [type(k).__name__ for k in key_sample]
|
||||
|
||||
sample_vals = [type(cdata.get(k)).__name__ for k in key_sample[:3]]
|
||||
if sample_vals:
|
||||
out["data_value_types_sample"] = sample_vals
|
||||
|
||||
# If coordinator.data sometimes contains named buckets (future-proof),
|
||||
# include just counts (but only if those keys actually exist).
|
||||
for key in COMMON_DIAGNOSTIC_BUCKETS:
|
||||
if key in cdata:
|
||||
out[f"{key}_count"] = _maybe_len(cdata.get(key))
|
||||
|
||||
# If AMP ever exposes last_called through coordinator.data, include only safe fields.
|
||||
last_called = cdata.get("last_called")
|
||||
if isinstance(last_called, Mapping):
|
||||
ts = last_called.get("timestamp")
|
||||
out["last_called"] = {
|
||||
"timestamp": _safe_dt(ts) or ts,
|
||||
"summary": last_called.get("summary"),
|
||||
}
|
||||
|
||||
# If there are device/player buckets, sample friendly names (no IDs).
|
||||
for key in DEVICE_PLAYER_BUCKETS:
|
||||
if key in cdata:
|
||||
sample = _sample_names(cdata.get(key))
|
||||
if sample:
|
||||
out[f"{key}_sample_names"] = sample
|
||||
break
|
||||
|
||||
return out
|
||||
|
||||
if isinstance(cdata, (list, tuple)):
|
||||
out["data_len"] = len(cdata)
|
||||
sample = _sample_names(cdata)
|
||||
if sample:
|
||||
out["sample_names"] = sample
|
||||
return out
|
||||
|
||||
if cdata is not None:
|
||||
out["data_type"] = type(cdata).__name__
|
||||
return out
|
||||
|
||||
|
||||
def _summarize_coordinator(coordinator: DataUpdateCoordinator) -> dict:
|
||||
"""Return a safe, compact view of a coordinator."""
|
||||
exc = getattr(coordinator, "last_exception", None)
|
||||
|
||||
data = {
|
||||
"name": getattr(coordinator, "name", None),
|
||||
"last_update_success": getattr(coordinator, "last_update_success", None),
|
||||
"has_exception": exc is not None,
|
||||
"last_exception_type": type(exc).__name__ if exc else None,
|
||||
"update_interval": (
|
||||
str(getattr(coordinator, "update_interval", None))
|
||||
if getattr(coordinator, "update_interval", None) is not None
|
||||
else None
|
||||
),
|
||||
"last_update": _safe_dt(getattr(coordinator, "last_update", None)),
|
||||
}
|
||||
|
||||
try:
|
||||
data["data_summary"] = _summarize_coordinator_data(
|
||||
getattr(coordinator, "data", None)
|
||||
)
|
||||
except (
|
||||
Exception
|
||||
) as exc: # noqa: BLE001 - intentionally broad; diagnostics must not crash
|
||||
data["data_summary_error"] = type(exc).__name__
|
||||
data["data_summary_error_present"] = True
|
||||
|
||||
return data
|
||||
|
||||
|
||||
# --------------------
|
||||
# AMP-specific (non-coordinator) runtime summaries
|
||||
# --------------------
|
||||
def _summarize_amp_entry_runtime(entry_runtime: Any) -> dict:
|
||||
"""
|
||||
Best-effort summary of hass.data[DOMAIN][entry_id] runtime.
|
||||
|
||||
AMP may not store anything here; keep robust.
|
||||
"""
|
||||
out: dict[str, Any] = {"present": entry_runtime is not None}
|
||||
|
||||
if isinstance(entry_runtime, Mapping):
|
||||
out["runtime_type"] = "mapping"
|
||||
out["runtime_keys"] = _maybe_keys(entry_runtime)
|
||||
# Common “bucket” counts if they happen to exist.
|
||||
for key in COMMON_BUCKET_COUNTS:
|
||||
if key in entry_runtime:
|
||||
out[f"{key}_count"] = _maybe_len(entry_runtime.get(key))
|
||||
# Small sample of names
|
||||
for key in DEVICE_PLAYER_BUCKETS:
|
||||
if key in entry_runtime:
|
||||
sample = _sample_names(entry_runtime.get(key))
|
||||
if sample:
|
||||
out[f"{key}_sample_names"] = sample
|
||||
break
|
||||
else:
|
||||
if entry_runtime is not None:
|
||||
out["runtime_type"] = type(entry_runtime).__name__
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def _obfuscate_identifier(val: Any) -> str:
|
||||
"""Return a shortened, non-identifying representation of a value.
|
||||
|
||||
Non-string, empty, or very short values are fully masked. Longer strings
|
||||
are reduced to a minimal prefix and suffix to aid debugging without
|
||||
exposing the original identifier.
|
||||
"""
|
||||
if not isinstance(val, str) or not val or len(val) <= 4:
|
||||
return "****"
|
||||
return f"{val[:2]}...{val[-2:]}"
|
||||
|
||||
|
||||
def _obfuscate_title_with_email(title: str | None, email: str | None) -> str | None:
|
||||
"""Obfuscate email in config entry title using the same mechanism as AMP logs."""
|
||||
if not title or not email:
|
||||
return title
|
||||
|
||||
try:
|
||||
# Lazy import to keep diagnostics import cheap
|
||||
from alexapy import hide_email # pylint: disable=import-outside-toplevel
|
||||
|
||||
redacted = hide_email(email)
|
||||
except (ImportError, AttributeError, TypeError, ValueError):
|
||||
redacted = _obfuscate_identifier(email)
|
||||
|
||||
return title.replace(email, redacted)
|
||||
|
||||
|
||||
def _get_safe_config_entry_title(config_entry: ConfigEntry) -> str | None:
|
||||
"""Get obfuscated config entry title."""
|
||||
email = config_entry.data.get("email")
|
||||
return _obfuscate_title_with_email(config_entry.title, email)
|
||||
|
||||
|
||||
def _summarize_amp_domain(domain_data: Any, config_entry: ConfigEntry) -> dict:
|
||||
"""
|
||||
Best-effort summary of hass.data[DOMAIN] for AMP.
|
||||
|
||||
AMP historically stores account/login state in custom structures, not always
|
||||
keyed by entry_id, and often not using DataUpdateCoordinator.
|
||||
"""
|
||||
out: dict[str, Any] = {}
|
||||
out["domain_data_present"] = domain_data is not None
|
||||
out["domain_data_type"] = (
|
||||
type(domain_data).__name__ if domain_data is not None else None
|
||||
)
|
||||
|
||||
if not isinstance(domain_data, Mapping):
|
||||
return out
|
||||
|
||||
out["domain_keys"] = _maybe_keys(domain_data)
|
||||
|
||||
# Try a few common/likely buckets without dumping contents.
|
||||
# NOTE: We deliberately avoid copying values; only report counts/types/samples.
|
||||
for key in COMMON_DIAGNOSTIC_BUCKETS:
|
||||
if key in domain_data:
|
||||
val = domain_data.get(key)
|
||||
out[f"{key}_type"] = type(val).__name__
|
||||
out[f"{key}_len"] = _maybe_len(val)
|
||||
sample = _sample_names(val)
|
||||
if sample:
|
||||
out[f"{key}_sample_names"] = sample
|
||||
|
||||
# Try to locate the specific account blob by email/title if present.
|
||||
# The config entry title often contains "email - url". We'll only use it to
|
||||
# match keys; we won't add the email to diagnostics (redaction will remove it).
|
||||
raw_title = config_entry.title or ""
|
||||
email = config_entry.data.get("email")
|
||||
out["entry_title_hint"] = _obfuscate_title_with_email(raw_title, email)
|
||||
# Some integrations store per-entry runtime keyed by entry_id *or* by title/email.
|
||||
# Report whether those keys exist.
|
||||
out["has_entry_id_key"] = config_entry.entry_id in domain_data
|
||||
out["has_title_key"] = raw_title in domain_data if raw_title else False
|
||||
|
||||
return out
|
||||
|
||||
|
||||
# --------------------
|
||||
# Diagnostics entry points
|
||||
# --------------------
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry
|
||||
) -> dict:
|
||||
"""Return diagnostics for a config entry."""
|
||||
domain_data = hass.data.get(DOMAIN)
|
||||
safe_title = _get_safe_config_entry_title(config_entry)
|
||||
|
||||
# AMP currently doesn't store runtime under entry_id.
|
||||
# This adds future-proofing for if and when it does.
|
||||
entry_runtime = None
|
||||
if isinstance(domain_data, Mapping):
|
||||
entry_runtime = domain_data.get(config_entry.entry_id)
|
||||
|
||||
# Coordinator discovery:
|
||||
# 1) Try under entry_runtime (best practice)
|
||||
# 2) If none found and domain_data is a mapping, try domain_data as a whole
|
||||
coordinators: list[DataUpdateCoordinator] = []
|
||||
searched: list[str] = []
|
||||
|
||||
if entry_runtime is not None:
|
||||
searched.append("hass.data[DOMAIN][entry_id]")
|
||||
coordinators = _find_coordinators(entry_runtime)
|
||||
|
||||
if not coordinators and isinstance(domain_data, Mapping):
|
||||
searched.append("hass.data[DOMAIN]")
|
||||
coordinators = _find_coordinators(domain_data)
|
||||
|
||||
coordinator_summaries = [_summarize_coordinator(c) for c in coordinators]
|
||||
|
||||
data: dict = {
|
||||
"entry": {
|
||||
"entry_id": config_entry.entry_id,
|
||||
"title": safe_title,
|
||||
"domain": config_entry.domain,
|
||||
"version": config_entry.version,
|
||||
"minor_version": config_entry.minor_version,
|
||||
},
|
||||
# Include config + options; sensitive values are redacted below.
|
||||
"data": dict(config_entry.data),
|
||||
"options": dict(config_entry.options),
|
||||
"account": {
|
||||
"searched_for_coordinators_in": searched,
|
||||
"coordinator_count": len(coordinator_summaries),
|
||||
"coordinators": coordinator_summaries,
|
||||
# AMP-specific summaries (useful when coordinator_count == 0)
|
||||
"amp_entry_runtime_summary": _summarize_amp_entry_runtime(entry_runtime),
|
||||
"amp_domain_summary": _summarize_amp_domain(domain_data, config_entry),
|
||||
},
|
||||
}
|
||||
|
||||
return async_redact_data(data, TO_REDACT)
|
||||
|
||||
|
||||
async def async_get_device_diagnostics(
|
||||
_hass: HomeAssistant, config_entry: ConfigEntry, device: dr.DeviceEntry
|
||||
) -> dict:
|
||||
"""Return diagnostics for a specific device."""
|
||||
safe_title = _get_safe_config_entry_title(config_entry)
|
||||
|
||||
try:
|
||||
# Lazy import to keep diagnostics import cheap
|
||||
from alexapy import hide_serial # pylint: disable=import-outside-toplevel
|
||||
|
||||
safe_serial = hide_serial(device.serial_number)
|
||||
except (ImportError, AttributeError, TypeError, ValueError):
|
||||
safe_serial = _obfuscate_identifier(device.serial_number)
|
||||
|
||||
data: dict = {
|
||||
"device": {
|
||||
"id": _obfuscate_identifier(device.id),
|
||||
"name": device.name,
|
||||
"name_by_user": device.name_by_user,
|
||||
"manufacturer": device.manufacturer,
|
||||
"model": device.model,
|
||||
"sw_version": device.sw_version,
|
||||
"serial_number": safe_serial,
|
||||
"identifiers": sorted(
|
||||
(domain, _obfuscate_identifier(value))
|
||||
for domain, value in device.identifiers
|
||||
),
|
||||
"via_device_id": _obfuscate_identifier(device.via_device_id),
|
||||
},
|
||||
"config_entry": {
|
||||
"entry_id": config_entry.entry_id,
|
||||
"title": safe_title,
|
||||
},
|
||||
}
|
||||
|
||||
return async_redact_data(data, TO_REDACT)
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Alexa Media Exceptions"""
|
||||
|
||||
|
||||
class EmptyDataException(Exception):
|
||||
"""Empty data exception"""
|
||||
|
||||
|
||||
class ForbiddenException(Exception):
|
||||
"""Forbidden exception"""
|
||||
|
||||
|
||||
class LoginForbiddenException(Exception):
|
||||
"""Login forbidden exception"""
|
||||
|
||||
|
||||
class LoginInvalidException(Exception):
|
||||
"""Invalid login exception"""
|
||||
|
||||
def __init__(self, attempts_remaining):
|
||||
self.attempts_remaining = attempts_remaining
|
||||
super().__init__(
|
||||
f"Invalid login credentials. {attempts_remaining} attempts remaining."
|
||||
)
|
||||
|
||||
|
||||
class TimeoutException(Exception):
|
||||
"""Timeout exception"""
|
||||
|
||||
def __init__(self, message=""):
|
||||
super().__init__(f"Timeout exception: {message}")
|
||||
|
||||
|
||||
class UnexpectedApiException(Exception):
|
||||
"""Unexpected API exception"""
|
||||
@@ -0,0 +1,585 @@
|
||||
"""
|
||||
Helper functions for Alexa Media Player.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import functools
|
||||
import hashlib
|
||||
import logging
|
||||
from typing import Any, Callable, Optional, TypeVar, overload
|
||||
|
||||
from alexapy import AlexapyLoginCloseRequested, AlexapyLoginError, hide_email
|
||||
from alexapy.alexalogin import AlexaLogin
|
||||
from dictor import dictor
|
||||
from homeassistant.const import CONF_EMAIL, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConditionErrorMessage
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.instance_id import async_get as async_get_instance_id
|
||||
import wrapt
|
||||
|
||||
from .const import DATA_ALEXAMEDIA, EXCEPTION_TEMPLATE
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
ArgType = TypeVar("ArgType")
|
||||
|
||||
|
||||
def _norm_filter_token(value: Any) -> str | None:
|
||||
"""Normalize a single filter token for reliable matching."""
|
||||
if value is None:
|
||||
return None
|
||||
s = str(value).strip()
|
||||
if not s:
|
||||
return None
|
||||
return s.casefold()
|
||||
|
||||
|
||||
def _coerce_filter(value: Any) -> set[str]:
|
||||
"""Coerce include/exclude filter input into a normalized set[str].
|
||||
|
||||
Accepts:
|
||||
- None / empty -> empty set
|
||||
- comma-separated str -> split on commas
|
||||
- list/set/tuple -> per-item normalization
|
||||
- anything else -> single token (best effort)
|
||||
"""
|
||||
if not value:
|
||||
return set()
|
||||
|
||||
# Legacy/back-compat: allow comma-separated string
|
||||
if isinstance(value, str):
|
||||
out = set()
|
||||
for part in value.split(","):
|
||||
token = _norm_filter_token(part)
|
||||
if token:
|
||||
out.add(token)
|
||||
return out
|
||||
|
||||
if isinstance(value, (list, set, tuple)):
|
||||
out = set()
|
||||
for v in value:
|
||||
token = _norm_filter_token(v)
|
||||
if token:
|
||||
out.add(token)
|
||||
return out
|
||||
|
||||
token = _norm_filter_token(value)
|
||||
return {token} if token else set()
|
||||
|
||||
|
||||
async def add_devices(
|
||||
account: str,
|
||||
devices: list[Entity],
|
||||
add_devices_callback: Callable[[list[Entity], bool], None],
|
||||
include_filter: str | list[str] | set[str] | tuple[str, ...] | None = None,
|
||||
exclude_filter: str | list[str] | set[str] | tuple[str, ...] | None = None,
|
||||
) -> bool:
|
||||
"""Add devices using add_devices_callback."""
|
||||
include_filter_set = _coerce_filter(include_filter)
|
||||
exclude_filter_set = _coerce_filter(exclude_filter)
|
||||
if include_filter_set:
|
||||
_LOGGER.debug(
|
||||
"%s: include_filter_set: %s",
|
||||
account,
|
||||
include_filter_set,
|
||||
)
|
||||
if exclude_filter_set:
|
||||
_LOGGER.debug(
|
||||
"%s: exclude_filter_set: %s",
|
||||
account,
|
||||
exclude_filter_set,
|
||||
)
|
||||
|
||||
def _device_name(dev: Entity) -> str | None:
|
||||
"""Best-effort name before entity_id is assigned.
|
||||
|
||||
For AMP switches, reconstruct the legacy "<device> <suffix> switch"
|
||||
name only if those attributes were explicitly set.
|
||||
"""
|
||||
|
||||
# First prefer explicitly set name attributes (works for tests + most entities)
|
||||
name = (
|
||||
getattr(dev, "name", None)
|
||||
or getattr(dev, "_attr_name", None)
|
||||
or getattr(dev, "_name", None)
|
||||
or getattr(dev, "_device_name", None)
|
||||
or getattr(dev, "_friendly_name", None)
|
||||
)
|
||||
if name:
|
||||
return name
|
||||
|
||||
# Only attempt switch reconstruction if attributes were explicitly defined
|
||||
# (avoids MagicMock auto-attribute trap in tests)
|
||||
dev_dict = getattr(dev, "__dict__", {})
|
||||
|
||||
client = dev_dict.get("_client")
|
||||
suffix = dev_dict.get("_unique_id_suffix")
|
||||
|
||||
if client and suffix:
|
||||
client_dict = getattr(client, "__dict__", {})
|
||||
base = (
|
||||
client_dict.get("name")
|
||||
or client_dict.get("_attr_name")
|
||||
or client_dict.get("_name")
|
||||
or client_dict.get("_device_name")
|
||||
)
|
||||
if base:
|
||||
return f"{base} {suffix} switch"
|
||||
|
||||
return None
|
||||
|
||||
def _device_label(dev: Entity) -> str:
|
||||
"""Return a compact, stable identifier for logging."""
|
||||
name = _device_name(dev)
|
||||
entity_id = getattr(dev, "entity_id", None) # often not set yet
|
||||
dev_type = type(dev).__name__
|
||||
|
||||
if name and entity_id:
|
||||
return f"{name} ({dev_type}, {entity_id})"
|
||||
if name:
|
||||
return f"{name} ({dev_type})"
|
||||
return f"<unnamed> ({dev_type})"
|
||||
|
||||
def _devices_preview(devs: list[Entity]) -> str:
|
||||
max_items = 8
|
||||
labels = [_device_label(d) for d in devs[:max_items]]
|
||||
suffix = f" …(+{len(devs) - max_items} more)" if len(devs) > max_items else ""
|
||||
return ", ".join(labels) + suffix
|
||||
|
||||
def _filter_devices(
|
||||
devs: list[Entity],
|
||||
include_set: set[str],
|
||||
exclude_set: set[str],
|
||||
) -> list[Entity]:
|
||||
selected: list[Entity] = []
|
||||
|
||||
include_mode = bool(include_set)
|
||||
if include_mode and exclude_set:
|
||||
_LOGGER.debug(
|
||||
"%s: include_devices set; ignoring exclude_devices per documented precedence",
|
||||
account,
|
||||
)
|
||||
|
||||
for dev in devs:
|
||||
dev_name = _norm_filter_token(_device_name(dev))
|
||||
|
||||
# INCLUDE MODE: only include explicitly listed names
|
||||
if include_mode:
|
||||
if dev_name and dev_name in include_set:
|
||||
selected.append(dev)
|
||||
else:
|
||||
if not dev_name:
|
||||
_LOGGER.debug(
|
||||
"%s: Not including device (no name yet): %s",
|
||||
account,
|
||||
_device_label(dev),
|
||||
)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"%s: Not including device: %s (match key=%r)",
|
||||
account,
|
||||
_device_label(dev),
|
||||
dev_name,
|
||||
)
|
||||
continue
|
||||
|
||||
# EXCLUDE MODE: exclude listed names
|
||||
if exclude_set and dev_name and dev_name in exclude_set:
|
||||
_LOGGER.debug(
|
||||
"%s: Excluding device: %s (match key=%r)",
|
||||
account,
|
||||
_device_label(dev),
|
||||
dev_name,
|
||||
)
|
||||
continue
|
||||
|
||||
selected.append(dev)
|
||||
|
||||
return selected
|
||||
|
||||
devices = _filter_devices(devices, include_filter_set, exclude_filter_set)
|
||||
if not devices:
|
||||
return True
|
||||
|
||||
_LOGGER.debug(
|
||||
"%s: Adding %d device(s): %s",
|
||||
account,
|
||||
len(devices),
|
||||
_devices_preview(devices),
|
||||
)
|
||||
|
||||
try:
|
||||
add_devices_callback(devices, False)
|
||||
except ConditionErrorMessage as exception_:
|
||||
message: str = exception_.message
|
||||
if message.startswith("Entity id already exists"):
|
||||
_LOGGER.debug("%s: Device already added: %s", account, message)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"%s: Unable to add %d device(s): %s",
|
||||
account,
|
||||
len(devices),
|
||||
message,
|
||||
)
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
_LOGGER.debug(
|
||||
"%s: Unable to add %d device(s): %s",
|
||||
account,
|
||||
len(devices),
|
||||
EXCEPTION_TEMPLATE.format(type(ex).__name__, ex.args),
|
||||
)
|
||||
else:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def retry_async(
|
||||
limit: int = 5, delay: float = 1, catch_exceptions: bool = True
|
||||
) -> Callable:
|
||||
"""Wrap function with retry logic.
|
||||
|
||||
The function will retry until true or the limit is reached. It will delay
|
||||
for the period of time specified exponentially increasing the delay.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
limit : int
|
||||
The max number of retries.
|
||||
delay : float
|
||||
The delay in seconds between retries.
|
||||
catch_exceptions : bool
|
||||
Whether exceptions should be caught and treated as failures or thrown.
|
||||
|
||||
Returns
|
||||
-------
|
||||
def
|
||||
Wrapped function.
|
||||
|
||||
"""
|
||||
|
||||
def wrap(func) -> Callable:
|
||||
@functools.wraps(func)
|
||||
async def wrapper(*args, **kwargs) -> Any:
|
||||
_LOGGER.debug(
|
||||
"%s.%s: Trying with limit %s delay %s catch_exceptions %s",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
limit,
|
||||
delay,
|
||||
catch_exceptions,
|
||||
)
|
||||
retries: int = 0
|
||||
result: bool = False
|
||||
next_try: int = 0
|
||||
while not result and retries < limit:
|
||||
if retries != 0:
|
||||
next_try = delay * 2**retries
|
||||
await asyncio.sleep(next_try)
|
||||
retries += 1
|
||||
try:
|
||||
result = await func(*args, **kwargs)
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
if not catch_exceptions:
|
||||
raise
|
||||
_LOGGER.debug(
|
||||
"%s.%s: failure caught due to exception: %s",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
EXCEPTION_TEMPLATE.format(type(ex).__name__, ex.args),
|
||||
)
|
||||
_LOGGER.debug(
|
||||
"%s.%s: Try: %s/%s after waiting %s seconds result: %s",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
retries,
|
||||
limit,
|
||||
next_try,
|
||||
result,
|
||||
)
|
||||
return result
|
||||
|
||||
return wrapper
|
||||
|
||||
return wrap
|
||||
|
||||
|
||||
@wrapt.decorator
|
||||
async def _catch_login_errors(func, instance, args, kwargs) -> Any:
|
||||
"""Detect AlexapyLoginError and attempt relogin."""
|
||||
|
||||
result = None
|
||||
if instance is None and args:
|
||||
instance = args[0]
|
||||
if hasattr(instance, "check_login_changes"):
|
||||
# _LOGGER.debug(
|
||||
# "%s checking for login changes", instance,
|
||||
# )
|
||||
instance.check_login_changes()
|
||||
try:
|
||||
result = await func(*args, **kwargs)
|
||||
except AlexapyLoginCloseRequested:
|
||||
_LOGGER.debug(
|
||||
"%s.%s: Ignoring attempt to access Alexa after HA shutdown",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
)
|
||||
return None
|
||||
except AlexapyLoginError as ex:
|
||||
login = None
|
||||
email = None
|
||||
all_args = list(args) + list(kwargs.values())
|
||||
# _LOGGER.debug("Func %s instance %s %s %s", func, instance, args, kwargs)
|
||||
if instance:
|
||||
if hasattr(instance, "_login"):
|
||||
login = instance._login # pylint: disable=protected-access
|
||||
hass = instance.hass
|
||||
else:
|
||||
for arg in all_args:
|
||||
_LOGGER.debug("Checking %s", arg)
|
||||
|
||||
if isinstance(arg, AlexaLogin):
|
||||
login = arg
|
||||
break
|
||||
if hasattr(arg, "_login"):
|
||||
login = instance._login
|
||||
hass = instance.hass
|
||||
break
|
||||
|
||||
if login:
|
||||
# Try to re-login
|
||||
email = login.email
|
||||
if await login.test_loggedin():
|
||||
_LOGGER.info(
|
||||
"%s.%s: Successful re-login after a login error for %s",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
hide_email(email),
|
||||
)
|
||||
return None
|
||||
_LOGGER.debug(
|
||||
"%s.%s: detected bad login for %s: %s",
|
||||
func.__module__[func.__module__.find(".") + 1 :],
|
||||
func.__name__,
|
||||
hide_email(email),
|
||||
EXCEPTION_TEMPLATE.format(type(ex).__name__, ex.args),
|
||||
)
|
||||
try:
|
||||
hass
|
||||
except NameError:
|
||||
hass = None
|
||||
report_relogin_required(hass, login, email)
|
||||
return None
|
||||
return result
|
||||
|
||||
|
||||
def report_relogin_required(hass, login, email) -> bool:
|
||||
"""Send message for relogin required."""
|
||||
if hass and login and email:
|
||||
if login.status:
|
||||
_LOGGER.debug(
|
||||
"Reporting need to relogin to %s with %s stats: %s",
|
||||
login.url,
|
||||
hide_email(email),
|
||||
login.stats,
|
||||
)
|
||||
hass.bus.async_fire(
|
||||
"alexa_media_relogin_required",
|
||||
event_data={
|
||||
"email": hide_email(email),
|
||||
"url": login.url,
|
||||
"stats": login.stats,
|
||||
},
|
||||
)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _existing_serials(hass, login_obj) -> list:
|
||||
"""Retrieve existing serial numbers for a given login object."""
|
||||
email: str = login_obj.email
|
||||
if (
|
||||
DATA_ALEXAMEDIA in hass.data
|
||||
and "accounts" in hass.data[DATA_ALEXAMEDIA]
|
||||
and email in hass.data[DATA_ALEXAMEDIA]["accounts"]
|
||||
):
|
||||
existing_serials = list(
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["entities"][
|
||||
"media_player"
|
||||
].keys()
|
||||
)
|
||||
device_data = (
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][email]
|
||||
.get("devices", {})
|
||||
.get("media_player", {})
|
||||
)
|
||||
for serial in existing_serials[:]:
|
||||
device = device_data.get(serial, {})
|
||||
if "appDeviceList" in device and device["appDeviceList"]:
|
||||
apps = [
|
||||
x["serialNumber"]
|
||||
for x in device["appDeviceList"]
|
||||
if "serialNumber" in x
|
||||
]
|
||||
existing_serials.extend(apps)
|
||||
else:
|
||||
_LOGGER.warning(
|
||||
"No accounts data found for %s. Skipping serials retrieval.", email
|
||||
)
|
||||
existing_serials = []
|
||||
return existing_serials
|
||||
|
||||
|
||||
async def calculate_uuid(hass, email: str, url: str) -> dict:
|
||||
"""Return uuid and index of email/url.
|
||||
|
||||
Args
|
||||
hass (bool): Hass entity
|
||||
url (str): url for account
|
||||
email (str): email for account
|
||||
|
||||
Returns
|
||||
dict: dictionary with uuid and index
|
||||
|
||||
"""
|
||||
result = {}
|
||||
return_index = 0
|
||||
if hass.config_entries.async_entries(DATA_ALEXAMEDIA):
|
||||
for index, entry in enumerate(
|
||||
hass.config_entries.async_entries(DATA_ALEXAMEDIA)
|
||||
):
|
||||
if entry.data.get(CONF_EMAIL) == email and entry.data.get(CONF_URL) == url:
|
||||
return_index = index
|
||||
break
|
||||
uuid = await async_get_instance_id(hass)
|
||||
result["uuid"] = hex(
|
||||
int(uuid, 16)
|
||||
# increment uuid for second accounts
|
||||
+ return_index
|
||||
# hash email/url in case HA uuid duplicated
|
||||
+ int(
|
||||
hashlib.sha256((email.lower() + url.lower()).encode()).hexdigest(),
|
||||
16, # nosec
|
||||
)
|
||||
)[-32:]
|
||||
result["index"] = return_index
|
||||
_LOGGER.debug("%s: Returning uuid %s", hide_email(email), result)
|
||||
return result
|
||||
|
||||
|
||||
def alarm_just_dismissed(
|
||||
alarm: dict[str, Any],
|
||||
previous_status: Optional[str],
|
||||
previous_version: Optional[str],
|
||||
) -> bool:
|
||||
"""Given the previous state of an alarm, determine if it has just been dismissed."""
|
||||
|
||||
if (
|
||||
previous_status not in ("SNOOZED", "ON")
|
||||
# The alarm had to be in a status that supported being dismissed
|
||||
or previous_version is None
|
||||
# The alarm was probably just created
|
||||
or not alarm
|
||||
# The alarm that was probably just deleted.
|
||||
or alarm.get("status") not in ("OFF", "ON")
|
||||
# A dismissed alarm is guaranteed to be turned off(one-off alarm) or left on(recurring alarm)
|
||||
or previous_version == alarm.get("version")
|
||||
# A dismissal always has a changed version.
|
||||
or int(alarm.get("version", "0")) > 1 + int(previous_version)
|
||||
):
|
||||
# This is an absurd thing to check, but it solves many, many edge cases.
|
||||
# Experimentally, when an alarm is dismissed, the version always increases by 1
|
||||
# When an alarm is edited either via app or voice, its version always increases by 2+
|
||||
return False
|
||||
|
||||
# It seems obvious that a check involving time should be necessary. It is not.
|
||||
# We know there was a change and that it wasn't an edit.
|
||||
# We also know the alarm's status rules out a snooze.
|
||||
# The only remaining possibility is that this alarm was just dismissed.
|
||||
return True
|
||||
|
||||
|
||||
def is_http2_enabled(hass: HomeAssistant | None, login_email: str) -> bool:
|
||||
"""Whether HTTP2 push is enabled for the current account session"""
|
||||
if hass:
|
||||
return bool(
|
||||
safe_get(
|
||||
hass.data,
|
||||
[DATA_ALEXAMEDIA, "accounts", login_email, "http2"],
|
||||
)
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
@overload
|
||||
def safe_get(
|
||||
data: Any,
|
||||
path_list: list[str | int] | None = None,
|
||||
checknone: bool = False,
|
||||
ignorecase: bool = False,
|
||||
pathsep: str = ".",
|
||||
search: Any = None,
|
||||
pretty: bool = False,
|
||||
rtype: str | None = None,
|
||||
) -> Any | None: ...
|
||||
|
||||
|
||||
@overload
|
||||
def safe_get(
|
||||
data: Any, path_list: list[str | int] | None, default: ArgType, *args, **kwargs
|
||||
) -> ArgType: ...
|
||||
|
||||
|
||||
def safe_get(
|
||||
data: Any, path_list: list[str | int] | None = None, *args, **kwargs
|
||||
) -> None | Any:
|
||||
"""Safely get nested value using path segments with optional type checking.
|
||||
|
||||
Args:
|
||||
data: Source data structure
|
||||
path_list: List of path segments (dots in segment names are auto-escaped)
|
||||
*args: Positional arguments passed to dictor (e.g., default value)
|
||||
**kwargs: Keyword arguments passed to dictor (checknone, ignorecase)
|
||||
|
||||
Returns:
|
||||
The value at the specified path, or None if:
|
||||
- The path doesn't exist and no default is provided
|
||||
or default if:
|
||||
- A default is provided and the path doesn't exist
|
||||
- A default is provided and the retrieved value's type doesn't match the default's type
|
||||
|
||||
Note:
|
||||
- Do not pass 'pathsep' in kwargs as the path is pre-built.
|
||||
- Type checking: When a default value is provided and a non-None value is retrieved,
|
||||
the result is validated against the default's type. If types don't match, default is returned.
|
||||
This prevents silent type errors from malformed data structures.
|
||||
|
||||
Examples:
|
||||
>>> safe_get({"a": {"b": "value"}}, ["a", "b"])
|
||||
'value'
|
||||
|
||||
>>> safe_get({"a": {"b": 123}}, ["a", "b"], "default")
|
||||
'default' # Type mismatch: int vs str
|
||||
|
||||
>>> safe_get({"a": {"b": "value"}}, ["a", "b"], "default")
|
||||
'value' # Type matches
|
||||
"""
|
||||
if not path_list:
|
||||
raise ValueError("path_list cannot be empty")
|
||||
|
||||
if "pathsep" in kwargs:
|
||||
kwargs.pop("pathsep") # Ignore pathsep since we build the path
|
||||
|
||||
escaped_segments = (str(seg).replace(".", "\\.") for seg in path_list)
|
||||
path = ".".join(escaped_segments)
|
||||
default = args[0] if args else (kwargs.get("default") if kwargs else None)
|
||||
result = dictor(data, path, *args, **kwargs)
|
||||
if default is not None and result is not None:
|
||||
if not isinstance(result, type(default)):
|
||||
result = default
|
||||
return result
|
||||
@@ -0,0 +1,530 @@
|
||||
"""
|
||||
Alexa Devices Lights.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
from math import sqrt
|
||||
from typing import Optional
|
||||
|
||||
from alexapy import AlexaAPI, hide_serial
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
ATTR_HS_COLOR,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
from homeassistant.util.color import (
|
||||
color_hs_to_RGB,
|
||||
color_hsb_to_RGB,
|
||||
color_name_to_rgb,
|
||||
color_RGB_to_hs,
|
||||
)
|
||||
|
||||
from . import (
|
||||
CONF_EMAIL,
|
||||
CONF_EXCLUDE_DEVICES,
|
||||
CONF_INCLUDE_DEVICES,
|
||||
DATA_ALEXAMEDIA,
|
||||
hide_email,
|
||||
)
|
||||
from .alexa_entity import (
|
||||
parse_brightness_from_coordinator,
|
||||
parse_color_from_coordinator,
|
||||
parse_color_temp_from_coordinator,
|
||||
parse_power_from_coordinator,
|
||||
)
|
||||
from .const import CONF_EXTENDED_ENTITY_DISCOVERY
|
||||
from .helpers import add_devices, safe_get
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
LOCAL_TIMEZONE = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
"""Set up the Alexa sensor platform."""
|
||||
devices: list[LightEntity] = []
|
||||
account = None
|
||||
if config:
|
||||
account = config.get(CONF_EMAIL)
|
||||
if account is None and discovery_info:
|
||||
account = safe_get(discovery_info, ["config", CONF_EMAIL])
|
||||
if account is None:
|
||||
raise ConfigEntryNotReady
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
include_filter = config.get(CONF_INCLUDE_DEVICES, [])
|
||||
exclude_filter = config.get(CONF_EXCLUDE_DEVICES, [])
|
||||
coordinator = account_dict["coordinator"]
|
||||
hue_emulated_enabled = "emulated_hue" in hass.config.as_dict().get(
|
||||
"components", set()
|
||||
)
|
||||
light_entities = safe_get(account_dict, ["devices", "light"], [])
|
||||
if light_entities and account_dict["options"].get(CONF_EXTENDED_ENTITY_DISCOVERY):
|
||||
for light_entity in light_entities:
|
||||
if not (light_entity["is_hue_v1"] and hue_emulated_enabled):
|
||||
_LOGGER.debug(
|
||||
"Creating entity %s for a light with name %s",
|
||||
hide_serial(light_entity["id"]),
|
||||
light_entity["name"],
|
||||
)
|
||||
light = AlexaLight(coordinator, account_dict["login_obj"], light_entity)
|
||||
account_dict["entities"]["light"].append(light)
|
||||
devices.append(light)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"Light '%s' has not been added because it may originate from emulated_hue",
|
||||
light_entity["name"],
|
||||
)
|
||||
|
||||
return await add_devices(
|
||||
hide_email(account),
|
||||
devices,
|
||||
add_devices_callback,
|
||||
include_filter,
|
||||
exclude_filter,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||
"""Set up the Alexa sensor platform by config_entry."""
|
||||
return await async_setup_platform(
|
||||
hass, config_entry.data, async_add_devices, discovery_info=None
|
||||
)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
account = entry.data[CONF_EMAIL]
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
_LOGGER.debug("Attempting to unload lights")
|
||||
for light in account_dict["entities"]["light"]:
|
||||
await light.async_remove()
|
||||
return True
|
||||
|
||||
|
||||
def color_modes(details) -> list:
|
||||
"""Return list of color modes."""
|
||||
if details["color"] and details["color_temperature"]:
|
||||
return [ColorMode.HS, ColorMode.COLOR_TEMP]
|
||||
if details["color"]:
|
||||
return [ColorMode.HS]
|
||||
if details["color_temperature"]:
|
||||
return [ColorMode.COLOR_TEMP]
|
||||
if details["brightness"]:
|
||||
return [ColorMode.BRIGHTNESS]
|
||||
return [ColorMode.ONOFF]
|
||||
|
||||
|
||||
class AlexaLight(CoordinatorEntity, LightEntity):
|
||||
"""A light controlled by an Echo."""
|
||||
|
||||
def __init__(self, coordinator, login, details):
|
||||
"""Initialize alexa light entity."""
|
||||
super().__init__(coordinator)
|
||||
self.alexa_entity_id = details["id"]
|
||||
self._name = details["name"]
|
||||
self._login = login
|
||||
self._attr_supported_color_modes = color_modes(details)
|
||||
self._attr_min_color_temp_kelvin = 2200
|
||||
self._attr_max_color_temp_kelvin = 6500
|
||||
|
||||
# Store the requested state from the last call to _set_state
|
||||
# This is so that no new network call is needed just to get values that are already known
|
||||
# This is useful because refreshing the full state can take a bit when many lights are in play.
|
||||
# Especially since Alexa actually polls the lights and that appears to be error-prone with some Zigbee lights.
|
||||
# That delay(1-5s in practice) causes the UI controls to jump all over the place after _set_state
|
||||
self._requested_state_at = None # When was state last set in UTC
|
||||
self._requested_power = None
|
||||
self._requested_ha_brightness = None
|
||||
self._requested_kelvin = None
|
||||
self._requested_hs = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return name."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return unique id."""
|
||||
return self.alexa_entity_id
|
||||
|
||||
@property
|
||||
def color_mode(self):
|
||||
"""Return color mode."""
|
||||
if (
|
||||
ColorMode.HS in self._attr_supported_color_modes
|
||||
and ColorMode.COLOR_TEMP in self._attr_supported_color_modes
|
||||
):
|
||||
hs_color = self.hs_color
|
||||
if hs_color is None or (hs_color[0] == 0 and hs_color[1] == 0):
|
||||
# (0,0) is white. When white, color temp is the better plan.
|
||||
return ColorMode.COLOR_TEMP
|
||||
return ColorMode.HS
|
||||
return self._attr_supported_color_modes[0]
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return whether on."""
|
||||
power = parse_power_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id, self._requested_state_at
|
||||
)
|
||||
if power is None:
|
||||
return self._requested_power if self._requested_power is not None else False
|
||||
return power == "ON"
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
"""Return brightness."""
|
||||
bright = parse_brightness_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id, self._requested_state_at
|
||||
)
|
||||
if bright is None:
|
||||
return self._requested_ha_brightness
|
||||
return alexa_brightness_to_ha(bright)
|
||||
|
||||
@property
|
||||
def color_temp_kelvin(self):
|
||||
"""Return color temperature."""
|
||||
kelvin = parse_color_temp_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id, self._requested_state_at
|
||||
)
|
||||
if kelvin is None:
|
||||
return self._requested_kelvin
|
||||
return kelvin_to_alexa(kelvin)[0]
|
||||
|
||||
@property
|
||||
def hs_color(self):
|
||||
"""Return hs color."""
|
||||
hsb = parse_color_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id, self._requested_state_at
|
||||
)
|
||||
if hsb is None:
|
||||
return self._requested_hs
|
||||
(
|
||||
adjusted_hs,
|
||||
color_name, # pylint:disable=unused-variable
|
||||
) = hsb_to_alexa_color(hsb)
|
||||
return adjusted_hs
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return whether state is assumed."""
|
||||
last_refresh_success = (
|
||||
self.coordinator.data and self.alexa_entity_id in self.coordinator.data
|
||||
)
|
||||
return not last_refresh_success
|
||||
|
||||
async def _set_state(self, power_on, brightness=None, kelvin=None, hs_color=None):
|
||||
# This is "rounding" on kelvin to the closest value Alexa is willing to acknowledge the existence of.
|
||||
# The alternative implementation would be to use effects instead.
|
||||
# That is far more non-standard, and would lock users out of things like the Flux integration.
|
||||
# The downsides to this approach is that the UI is giving the user a slider
|
||||
# When the user picks a slider value, the UI will "jump" to the closest possible value.
|
||||
# This trade-off doesn't feel as bad in practice as it sounds.
|
||||
adjusted_kelvin, color_temperature_name = kelvin_to_alexa(kelvin)
|
||||
if color_temperature_name is None:
|
||||
# This is "rounding" on HS color to closest value Alexa supports.
|
||||
# The alexa color list is short, but covers a pretty broad spectrum.
|
||||
# Like for kelvin above, this sounds bad but works ok in practice.
|
||||
adjusted_hs, color_name = hs_to_alexa_color(hs_color)
|
||||
else:
|
||||
# If a color temperature is being set, it is not possible to also adjust the color.
|
||||
adjusted_hs = None
|
||||
color_name = None
|
||||
|
||||
response = await AlexaAPI.set_light_state(
|
||||
self._login,
|
||||
self.alexa_entity_id,
|
||||
power_on,
|
||||
brightness=ha_brightness_to_alexa(brightness),
|
||||
color_temperature_name=color_temperature_name,
|
||||
color_name=color_name,
|
||||
)
|
||||
if not isinstance(response, dict):
|
||||
return await self.coordinator.async_request_refresh()
|
||||
control_responses = response.get("controlResponses", [])
|
||||
for response in control_responses:
|
||||
if not response.get("code") == "SUCCESS":
|
||||
# If something failed any state is possible, fallback to a full refresh
|
||||
return await self.coordinator.async_request_refresh()
|
||||
self._requested_power = power_on
|
||||
self._requested_ha_brightness = (
|
||||
brightness if brightness is not None else self.brightness
|
||||
)
|
||||
self._requested_kelvin = (
|
||||
adjusted_kelvin if adjusted_kelvin is not None else self.color_temp_kelvin
|
||||
)
|
||||
if adjusted_hs is not None:
|
||||
self._requested_hs = adjusted_hs
|
||||
elif adjusted_kelvin is not None:
|
||||
# If a kelvin value was set, it is critical that color is cleared out so that color mode is set properly
|
||||
self._requested_hs = None
|
||||
else:
|
||||
self._requested_hs = self.hs_color
|
||||
self._requested_state_at = datetime.datetime.now(
|
||||
datetime.timezone.utc
|
||||
) # must be set last so that previous getters work properly
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
# Confirm quickly, but debounce to avoid spamming during slider drags.
|
||||
account = self.hass.data[DATA_ALEXAMEDIA]["accounts"].get(self._login.email)
|
||||
if account:
|
||||
debouncer = account.get("confirm_refresh_debouncer")
|
||||
if debouncer:
|
||||
await debouncer.async_call()
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn on."""
|
||||
brightness = None
|
||||
kelvin = None
|
||||
hs_color = None
|
||||
if (
|
||||
ColorMode.ONOFF not in self._attr_supported_color_modes
|
||||
and ATTR_BRIGHTNESS in kwargs
|
||||
):
|
||||
brightness = kwargs[ATTR_BRIGHTNESS]
|
||||
if (
|
||||
ColorMode.COLOR_TEMP in self._attr_supported_color_modes
|
||||
and ATTR_COLOR_TEMP_KELVIN in kwargs
|
||||
):
|
||||
kelvin = kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
if ColorMode.HS in self._attr_supported_color_modes and ATTR_HS_COLOR in kwargs:
|
||||
hs_color = kwargs[ATTR_HS_COLOR]
|
||||
await self._set_state(True, brightness, kelvin, hs_color)
|
||||
|
||||
async def async_turn_off(self, **kwargs): # pylint:disable=unused-argument
|
||||
"""Turn off."""
|
||||
await self._set_state(False)
|
||||
|
||||
|
||||
def kelvin_to_alexa(kelvin: Optional[float]) -> tuple[Optional[float], Optional[str]]:
|
||||
"""Convert a given color temperature in kelvin to the closest available value that Alexa has support for."""
|
||||
if kelvin is None:
|
||||
return None, None
|
||||
if kelvin <= 2400:
|
||||
return 2200, "warm_white"
|
||||
if kelvin <= 3200:
|
||||
return 2700, "soft_white"
|
||||
if kelvin <= 4400:
|
||||
return 4000, "white"
|
||||
if kelvin <= 6000:
|
||||
return 5400, "daylight_white"
|
||||
return 6500, "cool_white"
|
||||
|
||||
|
||||
def ha_brightness_to_alexa(ha_brightness: Optional[float]) -> Optional[float]:
|
||||
"""Convert HA brightness to alexa brightness."""
|
||||
return (ha_brightness / 255 * 100) if ha_brightness is not None else None
|
||||
|
||||
|
||||
def alexa_brightness_to_ha(alexa: Optional[float]) -> Optional[float]:
|
||||
"""Convert Alexa brightness to HA brightness."""
|
||||
return (alexa / 100 * 255) if alexa is not None else None
|
||||
|
||||
|
||||
# This is a fairly complete list of all the colors that Alexa will respond to and their associated RGB value.
|
||||
ALEXA_COLORS = {
|
||||
"alice_blue": (240, 248, 255),
|
||||
"antique_white": (250, 235, 215),
|
||||
"aqua": (0, 255, 255),
|
||||
"aquamarine": (127, 255, 212),
|
||||
"azure": (240, 255, 255),
|
||||
"beige": (245, 245, 220),
|
||||
"bisque": (255, 228, 196),
|
||||
"black": (0, 0, 0),
|
||||
"blanched_almond": (255, 235, 205),
|
||||
"blue": (0, 0, 255),
|
||||
"blue_violet": (138, 43, 226),
|
||||
"brown": (165, 42, 42),
|
||||
"burlywood": (222, 184, 135),
|
||||
"cadet_blue": (95, 158, 160),
|
||||
"chartreuse": (127, 255, 0),
|
||||
"chocolate": (210, 105, 30),
|
||||
"coral": (255, 127, 80),
|
||||
"cornflower_blue": (100, 149, 237),
|
||||
"cornsilk": (255, 248, 220),
|
||||
"crimson": (220, 20, 60),
|
||||
"cyan": (0, 255, 255),
|
||||
"dark_blue": (0, 0, 139),
|
||||
"dark_cyan": (0, 139, 139),
|
||||
"dark_goldenrod": (184, 134, 11),
|
||||
"dark_green": (0, 100, 0),
|
||||
"dark_grey": (169, 169, 169),
|
||||
"dark_khaki": (189, 183, 107),
|
||||
"dark_magenta": (139, 0, 139),
|
||||
"dark_olive_green": (85, 107, 47),
|
||||
"dark_orange": (255, 140, 0),
|
||||
"dark_orchid": (153, 50, 204),
|
||||
"dark_red": (139, 0, 0),
|
||||
"dark_salmon": (233, 150, 122),
|
||||
"dark_sea_green": (143, 188, 143),
|
||||
"dark_slate_blue": (72, 61, 139),
|
||||
"dark_slate_grey": (47, 79, 79),
|
||||
"dark_turquoise": (0, 206, 209),
|
||||
"dark_violet": (148, 0, 211),
|
||||
"deep_pink": (255, 20, 147),
|
||||
"deep_sky_blue": (0, 191, 255),
|
||||
"dim_grey": (105, 105, 105),
|
||||
"dodger_blue": (30, 144, 255),
|
||||
"firebrick": (178, 34, 34),
|
||||
"floral_white": (255, 250, 240),
|
||||
"forest_green": (34, 139, 34),
|
||||
"fuchsia": (255, 0, 255),
|
||||
"gainsboro": (220, 220, 220),
|
||||
"ghost_white": (248, 248, 255),
|
||||
"gold": (255, 215, 0),
|
||||
"goldenrod": (218, 165, 32),
|
||||
"green": (0, 128, 0),
|
||||
"green_yellow": (173, 255, 47),
|
||||
"grey": (128, 128, 128),
|
||||
"honey_dew": (240, 255, 240),
|
||||
"hot_pink": (255, 105, 180),
|
||||
"indian_red": (205, 92, 92),
|
||||
"indigo": (75, 0, 130),
|
||||
"ivory": (255, 255, 240),
|
||||
"khaki": (240, 230, 140),
|
||||
"lavender": (230, 230, 250),
|
||||
"lavender_blush": (255, 240, 245),
|
||||
"lawn_green": (124, 252, 0),
|
||||
"lemon_chiffon": (255, 250, 205),
|
||||
"light_blue": (173, 216, 230),
|
||||
"light_coral": (240, 128, 128),
|
||||
"light_cyan": (224, 255, 255),
|
||||
"light_goldenrod_yellow": (250, 250, 210),
|
||||
"light_green": (144, 238, 144),
|
||||
"light_grey": (211, 211, 211),
|
||||
"light_pink": (255, 182, 193),
|
||||
"light_salmon": (255, 160, 122),
|
||||
"light_sea_green": (32, 178, 170),
|
||||
"light_sky_blue": (135, 206, 250),
|
||||
"light_slate_grey": (119, 136, 153),
|
||||
"light_steel_blue": (176, 196, 222),
|
||||
"light_yellow": (255, 255, 224),
|
||||
"lime": (0, 255, 0),
|
||||
"lime_green": (50, 205, 50),
|
||||
"linen": (250, 240, 230),
|
||||
"magenta": (255, 0, 255),
|
||||
"maroon": (128, 0, 0),
|
||||
"medium_aqua_marine": (102, 205, 170),
|
||||
"medium_blue": (0, 0, 205),
|
||||
"medium_orchid": (186, 85, 211),
|
||||
"medium_purple": (147, 112, 219),
|
||||
"medium_sea_green": (60, 179, 113),
|
||||
"medium_slate_blue": (123, 104, 238),
|
||||
"medium_spring_green": (0, 250, 154),
|
||||
"medium_turquoise": (72, 209, 204),
|
||||
"medium_violet_red": (199, 21, 133),
|
||||
"midnight_blue": (25, 25, 112),
|
||||
"mint_cream": (245, 255, 250),
|
||||
"misty_rose": (255, 228, 225),
|
||||
"moccasin": (255, 228, 181),
|
||||
"navajo_white": (255, 222, 173),
|
||||
"navy": (0, 0, 128),
|
||||
"old_lace": (253, 245, 230),
|
||||
"olive": (128, 128, 0),
|
||||
"olive_drab": (107, 142, 35),
|
||||
"orange": (255, 165, 0),
|
||||
"orange_red": (255, 69, 0),
|
||||
"orchid": (218, 112, 214),
|
||||
"pale_goldenrod": (238, 232, 170),
|
||||
"pale_green": (152, 251, 152),
|
||||
"pale_turquoise": (175, 238, 238),
|
||||
"pale_violet_red": (219, 112, 147),
|
||||
"papaya_whip": (255, 239, 213),
|
||||
"peach_puff": (255, 218, 185),
|
||||
"peru": (205, 133, 63),
|
||||
"pink": (255, 192, 203),
|
||||
"plum": (221, 160, 221),
|
||||
"powder_blue": (176, 224, 230),
|
||||
"purple": (128, 0, 128),
|
||||
"rebecca_purple": (102, 51, 153),
|
||||
"red": (255, 0, 0),
|
||||
"rosy_brown": (188, 143, 143),
|
||||
"royal_blue": (65, 105, 225),
|
||||
"saddle_brown": (139, 69, 19),
|
||||
"salmon": (250, 128, 114),
|
||||
"sandy_brown": (244, 164, 96),
|
||||
"sea_green": (46, 139, 87),
|
||||
"sea_shell": (255, 245, 238),
|
||||
"sienna": (160, 82, 45),
|
||||
"silver": (192, 192, 192),
|
||||
"sky_blue": (135, 206, 235),
|
||||
"slate_blue": (106, 90, 205),
|
||||
"slate_grey": (112, 128, 144),
|
||||
"snow": (255, 250, 250),
|
||||
"spring_green": (0, 255, 127),
|
||||
"steel_blue": (70, 130, 180),
|
||||
"tan": (210, 180, 140),
|
||||
"teal": (0, 128, 128),
|
||||
"thistle": (216, 191, 216),
|
||||
"tomato": (255, 99, 71),
|
||||
"turquoise": (64, 224, 208),
|
||||
"violet": (238, 130, 238),
|
||||
"wheat": (245, 222, 179),
|
||||
"white": (255, 255, 255),
|
||||
"white_smoke": (245, 245, 245),
|
||||
"yellow": (255, 255, 0),
|
||||
"yellow_green": (154, 205, 50),
|
||||
}
|
||||
|
||||
|
||||
def red_mean(color1: tuple[int, int, int], color2: tuple[int, int, int]) -> float:
|
||||
"""Get an approximate 'distance' between two colors using red mean.
|
||||
|
||||
Wikipedia says this method is "one of the better low-cost approximations".
|
||||
"""
|
||||
r_avg = (color2[0] + color1[0]) / 2
|
||||
r_delta = color2[0] - color1[0]
|
||||
g_delta = color2[1] - color1[1]
|
||||
b_delta = color2[2] - color1[2]
|
||||
r_term = (2 + r_avg / 256) * pow(r_delta, 2)
|
||||
g_term = 4 * pow(g_delta, 2)
|
||||
b_term = (2 + (255 - r_avg) / 256) * pow(b_delta, 2)
|
||||
return sqrt(r_term + g_term + b_term)
|
||||
|
||||
|
||||
def alexa_color_name_to_rgb(color_name: str) -> tuple[int, int, int]:
|
||||
"""Convert an alexa color name into RGB."""
|
||||
return color_name_to_rgb(color_name.replace("_", ""))
|
||||
|
||||
|
||||
def rgb_to_alexa_color(
|
||||
rgb: tuple[int, int, int],
|
||||
) -> tuple[Optional[tuple[float, float]], Optional[str]]:
|
||||
"""Convert a given RGB value into the closest Alexa color."""
|
||||
name, alexa_rgb = min(
|
||||
ALEXA_COLORS.items(),
|
||||
key=lambda alexa_color: red_mean(alexa_color[1], rgb),
|
||||
)
|
||||
red, green, blue = alexa_rgb
|
||||
return color_RGB_to_hs(red, green, blue), name
|
||||
|
||||
|
||||
def hs_to_alexa_color(
|
||||
hs_color: Optional[tuple[float, float]],
|
||||
) -> tuple[Optional[tuple[float, float]], Optional[str]]:
|
||||
"""Convert a given hue/saturation value into the closest Alexa color."""
|
||||
if hs_color is None:
|
||||
return None, None
|
||||
hue, saturation = hs_color
|
||||
return rgb_to_alexa_color(color_hs_to_RGB(hue, saturation))
|
||||
|
||||
|
||||
def hsb_to_alexa_color(
|
||||
hsb: Optional[tuple[float, float, float]],
|
||||
) -> tuple[Optional[tuple[float, float]], Optional[str]]:
|
||||
"""Convert a given hue/saturation/brightness value into the closest Alexa color."""
|
||||
if hsb is None:
|
||||
return None, None
|
||||
hue, saturation, brightness = hsb
|
||||
return rgb_to_alexa_color(color_hsb_to_RGB(hue, saturation, brightness))
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"domain": "alexa_media",
|
||||
"name": "Alexa Media Player",
|
||||
"codeowners": ["@alandtse", "@keatontaylor"],
|
||||
"config_flow": true,
|
||||
"dependencies": ["persistent_notification", "http"],
|
||||
"documentation": "https://github.com/alandtse/alexa_media_player/wiki",
|
||||
"iot_class": "cloud_polling",
|
||||
"issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
|
||||
"loggers": ["alexapy", "authcaptureproxy"],
|
||||
"requirements": [
|
||||
"alexapy==1.29.25",
|
||||
"packaging>=20.3",
|
||||
"wrapt>=1.14.0",
|
||||
"dictor>=0.1.12,<0.2"
|
||||
],
|
||||
"version": "5.15.6"
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,191 @@
|
||||
"""Performance metrics and caching for Alexa Media Player.
|
||||
|
||||
Provides boot time tracking and intelligent data caching.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
import logging
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BootMetrics:
|
||||
"""Track boot performance metrics."""
|
||||
|
||||
start_time: float = field(default_factory=time.monotonic)
|
||||
stages: dict[str, float] = field(default_factory=dict)
|
||||
|
||||
def record_stage(self, stage_name: str) -> None:
|
||||
"""Record a boot stage completion."""
|
||||
elapsed = time.monotonic() - self.start_time
|
||||
self.stages[stage_name] = elapsed
|
||||
_LOGGER.debug(
|
||||
"[BOOT METRICS] %s completed in %.3fs",
|
||||
stage_name,
|
||||
elapsed,
|
||||
)
|
||||
|
||||
def get_summary(self) -> dict[str, Any]:
|
||||
"""Get boot metrics summary."""
|
||||
total = time.monotonic() - self.start_time
|
||||
return {
|
||||
"total_time_seconds": round(total, 3),
|
||||
"stages": {k: round(v, 3) for k, v in self.stages.items()},
|
||||
}
|
||||
|
||||
|
||||
class DataCache:
|
||||
"""Simple TTL cache for API responses.
|
||||
|
||||
Reduces redundant API calls during startup and normal operation.
|
||||
"""
|
||||
|
||||
def __init__(self, ttl_seconds: float = 30.0, max_entries: int = 128) -> None:
|
||||
"""Initialize cache with TTL.
|
||||
|
||||
Args:
|
||||
ttl_seconds: Time-to-live for cached entries
|
||||
max_entries: Maximum number of entries before evicting oldest
|
||||
"""
|
||||
self._cache: dict[str, tuple[Any, float]] = {}
|
||||
self._ttl = ttl_seconds
|
||||
self._max_entries = max_entries
|
||||
self._hits = 0
|
||||
self._misses = 0
|
||||
|
||||
def get(self, key: str) -> Any | None:
|
||||
"""Get value from cache if not expired.
|
||||
|
||||
Args:
|
||||
key: Cache key
|
||||
|
||||
Returns:
|
||||
Cached value or None if expired/missing
|
||||
"""
|
||||
if key not in self._cache:
|
||||
self._misses += 1
|
||||
return None
|
||||
|
||||
value, timestamp = self._cache[key]
|
||||
if time.monotonic() - timestamp > self._ttl:
|
||||
# Expired
|
||||
del self._cache[key]
|
||||
self._misses += 1
|
||||
return None
|
||||
|
||||
self._hits += 1
|
||||
return value
|
||||
|
||||
def cache_set(self, key: str, value: Any) -> None:
|
||||
"""Store value in cache.
|
||||
|
||||
Note: Stores a direct reference (not a copy) for performance.
|
||||
Callers should treat cached values as read-only unless the caller created
|
||||
the cached object, is solely responsible for all mutations, and intentionally
|
||||
enriches it in-place (e.g., the device-dict refresh in async_update_data).
|
||||
|
||||
Args:
|
||||
key: Cache key
|
||||
value: Value to cache
|
||||
"""
|
||||
if len(self._cache) >= self._max_entries and key not in self._cache:
|
||||
oldest_key = min(self._cache, key=lambda k: self._cache[k][1])
|
||||
del self._cache[oldest_key]
|
||||
self._cache[key] = (value, time.monotonic())
|
||||
|
||||
def invalidate(self, key: str) -> None:
|
||||
"""Remove key from cache."""
|
||||
self._cache.pop(key, None)
|
||||
|
||||
def clear(self) -> None:
|
||||
"""Clear all cached entries."""
|
||||
self._cache.clear()
|
||||
self._hits = 0
|
||||
self._misses = 0
|
||||
|
||||
def get_stats(self) -> dict[str, int]:
|
||||
"""Get cache statistics."""
|
||||
total = self._hits + self._misses
|
||||
hit_rate = (self._hits / total * 100) if total > 0 else 0
|
||||
return {
|
||||
"entries": len(self._cache),
|
||||
"hits": self._hits,
|
||||
"misses": self._misses,
|
||||
"hit_rate_percent": round(hit_rate, 1),
|
||||
}
|
||||
|
||||
|
||||
class AlexaMetrics:
|
||||
"""Central metrics collector for Alexa Media Player."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
"""Initialize metrics collector."""
|
||||
self.hass = hass
|
||||
self.boot_metrics: BootMetrics | None = None
|
||||
self.api_cache = DataCache(ttl_seconds=30.0)
|
||||
self._api_calls: dict[str, tuple[int, float]] = {} # count, total_time
|
||||
|
||||
def start_boot_tracking(self) -> None:
|
||||
"""Start tracking boot performance."""
|
||||
self.boot_metrics = BootMetrics()
|
||||
_LOGGER.debug("[BOOT METRICS] Started tracking")
|
||||
|
||||
def record_boot_stage(self, stage_name: str) -> None:
|
||||
"""Record a boot stage completion."""
|
||||
if self.boot_metrics:
|
||||
self.boot_metrics.record_stage(stage_name)
|
||||
|
||||
def record_api_call(self, endpoint: str, duration: float) -> None:
|
||||
"""Record API call metrics.
|
||||
|
||||
Args:
|
||||
endpoint: API endpoint name
|
||||
duration: Call duration in seconds
|
||||
"""
|
||||
if endpoint not in self._api_calls:
|
||||
self._api_calls[endpoint] = (0, 0.0)
|
||||
|
||||
count, total = self._api_calls[endpoint]
|
||||
self._api_calls[endpoint] = (count + 1, total + duration)
|
||||
|
||||
def get_api_stats(self) -> dict[str, Any]:
|
||||
"""Get API call statistics."""
|
||||
stats = {}
|
||||
for endpoint, (count, total) in self._api_calls.items():
|
||||
stats[endpoint] = {
|
||||
"calls": count,
|
||||
"total_time": round(total, 3),
|
||||
"avg_time": round(total / count, 3) if count > 0 else 0,
|
||||
}
|
||||
return stats
|
||||
|
||||
def get_full_report(self) -> dict[str, Any]:
|
||||
"""Get complete metrics report."""
|
||||
return {
|
||||
"boot": self.boot_metrics.get_summary() if self.boot_metrics else None,
|
||||
"cache": self.api_cache.get_stats(),
|
||||
"api_calls": self.get_api_stats(),
|
||||
}
|
||||
|
||||
|
||||
def get_metrics(hass: HomeAssistant) -> AlexaMetrics | None:
|
||||
"""Get metrics instance from hass data.
|
||||
|
||||
Args:
|
||||
hass: Home Assistant instance
|
||||
|
||||
Returns:
|
||||
AlexaMetrics instance or None if not initialized
|
||||
"""
|
||||
if DOMAIN in hass.data and "metrics" in hass.data[DOMAIN]:
|
||||
return hass.data[DOMAIN]["metrics"]
|
||||
return None
|
||||
@@ -0,0 +1,370 @@
|
||||
"""
|
||||
Alexa Devices notification service.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
|
||||
from alexapy.helpers import hide_email, hide_serial
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_TARGET,
|
||||
ATTR_TITLE,
|
||||
ATTR_TITLE_DEFAULT,
|
||||
SERVICE_NOTIFY,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.const import CONF_EMAIL
|
||||
from homeassistant.helpers.group import expand_entity_ids
|
||||
import voluptuous as vol
|
||||
|
||||
from .const import (
|
||||
CONF_QUEUE_DELAY,
|
||||
DATA_ALEXAMEDIA,
|
||||
DEFAULT_QUEUE_DELAY,
|
||||
DOMAIN,
|
||||
NOTIFY_URL,
|
||||
)
|
||||
from .helpers import retry_async
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@retry_async(limit=5, delay=2, catch_exceptions=True)
|
||||
async def async_get_service(hass, config, discovery_info=None):
|
||||
# pylint: disable=unused-argument
|
||||
"""Get the demo notification service."""
|
||||
result = False
|
||||
for account, account_dict in hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
for key, _ in account_dict["devices"]["media_player"].items():
|
||||
if key not in account_dict["entities"]["media_player"]:
|
||||
_LOGGER.debug(
|
||||
"%s: Media player %s not loaded yet; delaying load",
|
||||
hide_email(account),
|
||||
hide_serial(key),
|
||||
)
|
||||
return False
|
||||
result = hass.data[DATA_ALEXAMEDIA]["notify_service"] = AlexaNotificationService(
|
||||
hass
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
_LOGGER.debug("Attempting to unload notify")
|
||||
target_account = entry.data[CONF_EMAIL]
|
||||
other_accounts = False
|
||||
for account, account_dict in hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
if account == target_account:
|
||||
if "entities" not in account_dict:
|
||||
continue
|
||||
for device in account_dict["entities"]["media_player"].values():
|
||||
if device.entity_id:
|
||||
entity_id = device.entity_id.split(".")
|
||||
hass.services.async_remove(
|
||||
SERVICE_NOTIFY, f"{DOMAIN}_{entity_id[1]}"
|
||||
)
|
||||
else:
|
||||
other_accounts = True
|
||||
if not other_accounts:
|
||||
hass.services.async_remove(SERVICE_NOTIFY, f"{DOMAIN}")
|
||||
if hass.data[DATA_ALEXAMEDIA].get("notify_service"):
|
||||
hass.data[DATA_ALEXAMEDIA].pop("notify_service")
|
||||
return True
|
||||
|
||||
|
||||
class AlexaNotificationService(BaseNotificationService):
|
||||
"""Implement Alexa Media Player notification service."""
|
||||
|
||||
def __init__(self, hass):
|
||||
"""Initialize the service."""
|
||||
self.hass = hass
|
||||
self.last_called = True
|
||||
|
||||
def convert(self, names, type_="entities", filter_matches=False):
|
||||
"""Return a list of converted Alexa devices based on names.
|
||||
|
||||
Names may be matched either by serialNumber, accountName, or
|
||||
Homeassistant entity_id and can return any of the above plus entities
|
||||
|
||||
Parameters
|
||||
----------
|
||||
names : list(string)
|
||||
A list of names to convert
|
||||
type_ : string
|
||||
The type to return entities, entity_ids, serialnumbers, names
|
||||
filter_matches : bool
|
||||
Whether non-matching items are removed from the returned list.
|
||||
|
||||
Returns
|
||||
-------
|
||||
list(string)
|
||||
List of home assistant entity_ids
|
||||
|
||||
"""
|
||||
devices = []
|
||||
if isinstance(names, str):
|
||||
names = [names]
|
||||
for item in names:
|
||||
matched = False
|
||||
for alexa in self.devices:
|
||||
# _LOGGER.debug(
|
||||
# "Testing item: %s against (%s, %s, %s, %s)",
|
||||
# item,
|
||||
# alexa,
|
||||
# alexa.name,
|
||||
# hide_serial(alexa.unique_id),
|
||||
# alexa.entity_id,
|
||||
# )
|
||||
if item in (
|
||||
alexa,
|
||||
alexa.name,
|
||||
alexa.unique_id,
|
||||
alexa.entity_id,
|
||||
alexa.device_serial_number,
|
||||
):
|
||||
if type_ == "entities":
|
||||
converted = alexa
|
||||
elif type_ == "serialnumbers":
|
||||
converted = alexa.device_serial_number
|
||||
elif type_ == "names":
|
||||
converted = alexa.name
|
||||
elif type_ == "entity_ids":
|
||||
converted = alexa.entity_id
|
||||
devices.append(converted)
|
||||
matched = True
|
||||
# _LOGGER.debug("Converting: %s to (%s): %s", item, type_, converted)
|
||||
if not filter_matches and not matched:
|
||||
devices.append(item)
|
||||
return devices
|
||||
|
||||
@property
|
||||
def targets(self):
|
||||
"""Return a dictionary of Alexa devices."""
|
||||
devices = {}
|
||||
for email, account_dict in self.hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
if "entities" not in account_dict:
|
||||
continue
|
||||
last_called_entity = None
|
||||
for _, entity in account_dict["entities"]["media_player"].items():
|
||||
if entity is None or entity.entity_id is None:
|
||||
continue
|
||||
entity_name = (entity.entity_id).split(".")[1]
|
||||
devices[entity_name] = entity.unique_id
|
||||
if self.last_called and entity.extra_state_attributes.get(
|
||||
"last_called"
|
||||
):
|
||||
attrs = entity.extra_state_attributes
|
||||
try:
|
||||
ts = int(attrs.get("last_called_timestamp") or 0)
|
||||
except (TypeError, ValueError):
|
||||
ts = 0
|
||||
if last_called_entity is None:
|
||||
last_called_entity = entity
|
||||
else:
|
||||
best_attrs = last_called_entity.extra_state_attributes
|
||||
try:
|
||||
best_ts = int(best_attrs.get("last_called_timestamp") or 0)
|
||||
except (TypeError, ValueError):
|
||||
best_ts = 0
|
||||
if ts > best_ts:
|
||||
last_called_entity = entity
|
||||
if last_called_entity is not None:
|
||||
entity_name = (last_called_entity.entity_id).split(".")[1]
|
||||
entity_name_last_called = (
|
||||
f"last_called{'_'+ email if entity_name[-1:].isdigit() else ''}"
|
||||
)
|
||||
devices[entity_name_last_called] = last_called_entity.unique_id
|
||||
return devices
|
||||
|
||||
@property
|
||||
def devices(self):
|
||||
"""Return a list of Alexa devices."""
|
||||
devices = []
|
||||
if (
|
||||
"accounts" not in self.hass.data[DATA_ALEXAMEDIA]
|
||||
or not self.hass.data[DATA_ALEXAMEDIA]["accounts"].items()
|
||||
):
|
||||
return devices
|
||||
for _, account_dict in self.hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
devices = devices + list(account_dict["entities"]["media_player"].values())
|
||||
return devices
|
||||
|
||||
async def async_send_message(self, message="", **kwargs):
|
||||
# pylint: disable=too-many-branches
|
||||
"""Send a message to an Alexa device."""
|
||||
_LOGGER.debug("Message: %s, kwargs: %s", message, kwargs)
|
||||
_LOGGER.debug("Target type: %s", type(kwargs.get(ATTR_TARGET)))
|
||||
kwargs["message"] = message
|
||||
targets = kwargs.get(ATTR_TARGET)
|
||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
data = kwargs.get(ATTR_DATA, {})
|
||||
data = data if data is not None else {}
|
||||
if isinstance(targets, str):
|
||||
try:
|
||||
targets = json.loads(targets)
|
||||
except json.JSONDecodeError:
|
||||
_LOGGER.error("Target must be a valid json")
|
||||
return
|
||||
processed_targets = []
|
||||
for target in targets:
|
||||
_LOGGER.debug("Processing: %s", target)
|
||||
if not isinstance(target, str):
|
||||
processed_targets.append(target)
|
||||
_LOGGER.debug("Processed non-string target: %s", processed_targets)
|
||||
continue
|
||||
try:
|
||||
parsed = json.loads(target)
|
||||
if isinstance(parsed, list):
|
||||
processed_targets.extend(parsed)
|
||||
else:
|
||||
processed_targets.append(parsed)
|
||||
_LOGGER.debug("Processed Target by json: %s", processed_targets)
|
||||
except json.JSONDecodeError:
|
||||
if "," in target:
|
||||
processed_targets += [
|
||||
item.strip() for item in target.split(",") if item.strip()
|
||||
]
|
||||
else:
|
||||
processed_targets.append(target.strip())
|
||||
_LOGGER.debug("Processed Target by string: %s", processed_targets)
|
||||
# Expand Home Assistant group targets into member entity IDs before
|
||||
# passing to convert(). The convert() method resolves Alexa-specific
|
||||
# identifiers (entity_id, name, serial), but it does not expand HA groups.
|
||||
#
|
||||
# Supported group forms:
|
||||
# - media_player.* helper groups with an entity_id attribute
|
||||
# - old-style YAML group.* entities, via expand_entity_ids()
|
||||
#
|
||||
# Expansion happens here, while targets are still plain strings. Do not run
|
||||
# expand_entity_ids() after convert(), because convert() returns Alexa
|
||||
# objects, not entity ID strings.
|
||||
expanded_targets = []
|
||||
|
||||
for target in processed_targets:
|
||||
if not isinstance(target, str):
|
||||
expanded_targets.append(target)
|
||||
continue
|
||||
|
||||
# UI media_player group helper
|
||||
if (
|
||||
target.startswith("media_player.")
|
||||
and (state := self.hass.states.get(target)) is not None
|
||||
and "entity_id" in state.attributes
|
||||
):
|
||||
members = state.attributes["entity_id"]
|
||||
if isinstance(members, (list, tuple)):
|
||||
expanded_targets.extend(members)
|
||||
else:
|
||||
expanded_targets.append(target)
|
||||
continue
|
||||
|
||||
# Old-style YAML group.*, expand before convert()
|
||||
if target.startswith("group."):
|
||||
try:
|
||||
expanded_targets.extend(expand_entity_ids(self.hass, [target]))
|
||||
except ValueError:
|
||||
_LOGGER.debug("Invalid Home Assistant group target: %s", target)
|
||||
expanded_targets.append(target)
|
||||
continue
|
||||
|
||||
expanded_targets.append(target)
|
||||
|
||||
entities = self.convert(expanded_targets, type_="entities")
|
||||
tasks = []
|
||||
for account, account_dict in self.hass.data[DATA_ALEXAMEDIA][
|
||||
"accounts"
|
||||
].items():
|
||||
data_type = data.get("type", "tts")
|
||||
for alexa in account_dict["entities"]["media_player"].values():
|
||||
if data_type == "tts":
|
||||
targets = self.convert(
|
||||
entities, type_="entities", filter_matches=True
|
||||
)
|
||||
# _LOGGER.debug("TTS entities: %s", targets)
|
||||
if alexa in targets and alexa.available:
|
||||
_LOGGER.debug("TTS by %s : %s", alexa, message)
|
||||
tasks.append(
|
||||
alexa.async_send_tts(
|
||||
message,
|
||||
queue_delay=self.hass.data[DATA_ALEXAMEDIA]["accounts"][
|
||||
account
|
||||
]["options"].get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
|
||||
)
|
||||
)
|
||||
elif data_type == "announce":
|
||||
targets = self.convert(
|
||||
entities, type_="serialnumbers", filter_matches=True
|
||||
)
|
||||
# _LOGGER.debug(
|
||||
# "Announce targets: %s entities: %s",
|
||||
# list(map(hide_serial, targets)),
|
||||
# entities,
|
||||
# )
|
||||
if alexa.device_serial_number in targets and alexa.available:
|
||||
_LOGGER.debug(
|
||||
("%s: Announce by %s to targets: %s: %s"),
|
||||
hide_email(account),
|
||||
alexa,
|
||||
list(map(hide_serial, targets)),
|
||||
message,
|
||||
)
|
||||
tasks.append(
|
||||
alexa.async_send_announcement(
|
||||
message,
|
||||
targets=targets,
|
||||
title=title,
|
||||
method=(data["method"] if "method" in data else "all"),
|
||||
queue_delay=self.hass.data[DATA_ALEXAMEDIA]["accounts"][
|
||||
account
|
||||
]["options"].get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
|
||||
)
|
||||
)
|
||||
break
|
||||
elif data_type == "push":
|
||||
targets = self.convert(
|
||||
entities, type_="entities", filter_matches=True
|
||||
)
|
||||
if alexa in targets and alexa.available:
|
||||
_LOGGER.debug("Push by %s: %s %s", alexa, title, message)
|
||||
tasks.append(
|
||||
alexa.async_send_mobilepush(
|
||||
message,
|
||||
title=title,
|
||||
queue_delay=self.hass.data[DATA_ALEXAMEDIA]["accounts"][
|
||||
account
|
||||
]["options"].get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
|
||||
)
|
||||
)
|
||||
elif data_type == "dropin_notification":
|
||||
targets = self.convert(
|
||||
entities, type_="entities", filter_matches=True
|
||||
)
|
||||
if alexa in targets and alexa.available:
|
||||
_LOGGER.debug(
|
||||
"Notification dropin by %s: %s %s", alexa, title, message
|
||||
)
|
||||
tasks.append(
|
||||
alexa.async_send_dropin_notification(
|
||||
message,
|
||||
title=title,
|
||||
queue_delay=self.hass.data[DATA_ALEXAMEDIA]["accounts"][
|
||||
account
|
||||
]["options"].get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
|
||||
)
|
||||
)
|
||||
else:
|
||||
errormessage = (
|
||||
f"{account}: Data value `type={data_type}` is not implemented. "
|
||||
f"See {NOTIFY_URL}"
|
||||
)
|
||||
_LOGGER.debug(errormessage)
|
||||
raise vol.Invalid(errormessage)
|
||||
await asyncio.gather(*tasks)
|
||||
@@ -0,0 +1,184 @@
|
||||
"""Runtime data for Alexa Media Player integration.
|
||||
|
||||
This module implements the Platinum architecture using entry.runtime_data
|
||||
instead of the legacy hass.data[DOMAIN] pattern.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass, field
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Any, Callable
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import (
|
||||
DEFAULT_EXTENDED_ENTITY_DISCOVERY,
|
||||
DEFAULT_PUBLIC_URL,
|
||||
DEFAULT_QUEUE_DELAY,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from alexapy import AlexaLogin, HTTP2EchoClient
|
||||
|
||||
from .coordinator import AlexaMediaCoordinator
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class AlexaRuntimeData:
|
||||
"""Runtime data for Alexa Media Player.
|
||||
|
||||
This replaces the legacy dict-based storage in hass.data[DATA_ALEXAMEDIA]["accounts"][email].
|
||||
All fields are type-safe and properly initialized.
|
||||
"""
|
||||
|
||||
# Core components (optional to support partial initialisation)
|
||||
login_obj: AlexaLogin | None = None
|
||||
config_entry: ConfigEntry | None = None
|
||||
coordinator: AlexaMediaCoordinator | None = None
|
||||
|
||||
# HTTP2 Push connection
|
||||
http2: HTTP2EchoClient | None = None
|
||||
http2_error: int = 0
|
||||
http2_lastattempt: float = 0.0
|
||||
http2_commands: dict[str, float] = field(default_factory=dict)
|
||||
http2_activity: dict[str, Any] = field(
|
||||
default_factory=lambda: {"serials": {}, "refreshed": {}}
|
||||
)
|
||||
|
||||
# Device storage
|
||||
devices: dict[str, Any] = field(
|
||||
default_factory=lambda: {
|
||||
"media_player": {},
|
||||
"switch": {},
|
||||
"guard": [],
|
||||
"light": [],
|
||||
"binary_sensor": [],
|
||||
"temperature": [],
|
||||
"smart_switch": [],
|
||||
}
|
||||
)
|
||||
entities: dict[str, Any] = field(
|
||||
default_factory=lambda: {
|
||||
"media_player": {},
|
||||
"switch": {},
|
||||
"sensor": {},
|
||||
"light": [],
|
||||
"binary_sensor": [],
|
||||
"alarm_control_panel": {},
|
||||
"smart_switch": [],
|
||||
}
|
||||
)
|
||||
excluded: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
# State tracking
|
||||
new_devices: bool = True
|
||||
auth_info: dict[str, Any] | None = None
|
||||
should_get_network: bool = True
|
||||
second_account_index: int = 0
|
||||
|
||||
# Notifications
|
||||
notifications: dict[str, Any] = field(default_factory=dict)
|
||||
notifications_pending: set[str] = field(default_factory=set)
|
||||
notifications_refresh_task: asyncio.Task | None = None
|
||||
notifications_retry_count: int = 0
|
||||
last_notif_poll: float = 0.0
|
||||
|
||||
# Last called tracking
|
||||
last_called: dict[str, Any] | None = None
|
||||
last_called_customer_history_ts: int = 0
|
||||
last_called_probe_task: asyncio.Task | None = None
|
||||
last_called_probe_lock: asyncio.Lock = field(default_factory=asyncio.Lock)
|
||||
last_called_probe_last_run: float = 0.0
|
||||
last_push_activity: float = 0.0
|
||||
|
||||
# Options (mirrored from config_entry)
|
||||
options: dict[str, Any] = field(default_factory=dict)
|
||||
|
||||
# Listeners for cleanup
|
||||
listeners: list[Callable] = field(default_factory=list)
|
||||
|
||||
def __post_init__(self):
|
||||
"""Initialize computed fields after dataclass creation."""
|
||||
# Initialize options from config_entry if available
|
||||
if self.config_entry:
|
||||
from .const import (
|
||||
CONF_DEBUG,
|
||||
CONF_EXCLUDE_DEVICES,
|
||||
CONF_EXTENDED_ENTITY_DISCOVERY,
|
||||
CONF_INCLUDE_DEVICES,
|
||||
CONF_PUBLIC_URL,
|
||||
CONF_QUEUE_DELAY,
|
||||
CONF_SCAN_INTERVAL,
|
||||
DEFAULT_SCAN_INTERVAL,
|
||||
)
|
||||
|
||||
self.options = {
|
||||
CONF_INCLUDE_DEVICES: self.config_entry.data.get(
|
||||
CONF_INCLUDE_DEVICES, ""
|
||||
),
|
||||
CONF_EXCLUDE_DEVICES: self.config_entry.data.get(
|
||||
CONF_EXCLUDE_DEVICES, ""
|
||||
),
|
||||
CONF_QUEUE_DELAY: self.config_entry.data.get(
|
||||
CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY
|
||||
),
|
||||
CONF_SCAN_INTERVAL: self.config_entry.data.get(
|
||||
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
|
||||
),
|
||||
CONF_PUBLIC_URL: self.config_entry.data.get(
|
||||
CONF_PUBLIC_URL, DEFAULT_PUBLIC_URL
|
||||
),
|
||||
CONF_EXTENDED_ENTITY_DISCOVERY: self.config_entry.data.get(
|
||||
CONF_EXTENDED_ENTITY_DISCOVERY, DEFAULT_EXTENDED_ENTITY_DISCOVERY
|
||||
),
|
||||
CONF_DEBUG: self.config_entry.data.get(CONF_DEBUG, False),
|
||||
}
|
||||
|
||||
@property
|
||||
def email(self) -> str:
|
||||
"""Return account email."""
|
||||
return self.login_obj.email if self.login_obj else ""
|
||||
|
||||
@property
|
||||
def url(self) -> str:
|
||||
"""Return account URL."""
|
||||
return self.login_obj.url if self.login_obj else ""
|
||||
|
||||
def get_device(self, device_type: str, serial: str) -> Any | None:
|
||||
"""Get a device by type and serial."""
|
||||
devices = self.devices.get(device_type, {})
|
||||
if isinstance(devices, dict):
|
||||
return devices.get(serial)
|
||||
if isinstance(devices, list):
|
||||
for device in devices:
|
||||
if isinstance(device, dict) and device.get("serialNumber") == serial:
|
||||
return device
|
||||
if (
|
||||
device
|
||||
and hasattr(device, "serialNumber")
|
||||
and device.serialNumber == serial
|
||||
):
|
||||
return device
|
||||
return None
|
||||
|
||||
def get_entity(self, entity_type: str, key: str) -> Any | None:
|
||||
"""Get an entity by type and key."""
|
||||
entities = self.entities.get(entity_type, {})
|
||||
if isinstance(entities, dict):
|
||||
return entities.get(key)
|
||||
if isinstance(entities, list):
|
||||
for entity in entities:
|
||||
if hasattr(entity, "unique_id") and entity.unique_id == key:
|
||||
return entity
|
||||
if hasattr(entity, "serial") and entity.serial == key:
|
||||
return entity
|
||||
return None
|
||||
|
||||
def add_listener(self, unsub: Callable) -> None:
|
||||
"""Add a listener for cleanup."""
|
||||
self.listeners.append(unsub)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,421 @@
|
||||
"""
|
||||
Alexa Services.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from typing import Any, Callable
|
||||
|
||||
from alexapy import AlexaAPI, AlexapyLoginError, hide_email
|
||||
from alexapy.errors import AlexapyConnectionError
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import config_validation as cv, entity_registry as er
|
||||
import voluptuous as vol
|
||||
|
||||
from .const import (
|
||||
ATTR_EMAIL,
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_NUM_ENTRIES,
|
||||
DATA_ALEXAMEDIA,
|
||||
DOMAIN,
|
||||
SERVICE_ENABLE_NETWORK_DISCOVERY,
|
||||
SERVICE_FORCE_LOGOUT,
|
||||
SERVICE_GET_HISTORY_RECORDS,
|
||||
SERVICE_RESTORE_VOLUME,
|
||||
SERVICE_UPDATE_LAST_CALLED,
|
||||
)
|
||||
from .helpers import _catch_login_errors, report_relogin_required, safe_get
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
FORCE_LOGOUT_SCHEMA = vol.Schema(
|
||||
{vol.Optional(ATTR_EMAIL, default=[]): vol.All(cv.ensure_list, [cv.string])}
|
||||
)
|
||||
LAST_CALL_UPDATE_SCHEMA = vol.Schema(
|
||||
{vol.Optional(ATTR_EMAIL, default=[]): vol.All(cv.ensure_list, [cv.string])}
|
||||
)
|
||||
RESTORE_VOLUME_SCHEMA = vol.Schema({vol.Required(ATTR_ENTITY_ID): cv.entity_id})
|
||||
|
||||
GET_HISTORY_RECORDS_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Required(ATTR_ENTITY_ID): cv.entity_id,
|
||||
vol.Optional(ATTR_NUM_ENTRIES, default=5): cv.positive_int,
|
||||
}
|
||||
)
|
||||
|
||||
ENABLE_NETWORK_DISCOVERY_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional(ATTR_EMAIL, default=[]): vol.All(
|
||||
cv.ensure_list,
|
||||
[cv.string],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class AlexaServiceDef:
|
||||
"""Definition for an Alexa Media custom service."""
|
||||
|
||||
name: str # service name as exposed in HA: alexa_media.<name>
|
||||
schema: vol.Schema # voluptuous schema
|
||||
handler: str # method name on AlexaMediaServices
|
||||
|
||||
|
||||
SERVICE_DEFS: tuple[AlexaServiceDef, ...] = (
|
||||
AlexaServiceDef(
|
||||
name=SERVICE_FORCE_LOGOUT,
|
||||
schema=FORCE_LOGOUT_SCHEMA,
|
||||
handler="force_logout",
|
||||
),
|
||||
AlexaServiceDef(
|
||||
name=SERVICE_UPDATE_LAST_CALLED,
|
||||
schema=LAST_CALL_UPDATE_SCHEMA,
|
||||
handler="last_call_handler",
|
||||
),
|
||||
AlexaServiceDef(
|
||||
name=SERVICE_RESTORE_VOLUME,
|
||||
schema=RESTORE_VOLUME_SCHEMA,
|
||||
handler="restore_volume",
|
||||
),
|
||||
AlexaServiceDef(
|
||||
name=SERVICE_GET_HISTORY_RECORDS,
|
||||
schema=GET_HISTORY_RECORDS_SCHEMA,
|
||||
handler="get_history_records",
|
||||
),
|
||||
AlexaServiceDef(
|
||||
name=SERVICE_ENABLE_NETWORK_DISCOVERY,
|
||||
schema=ENABLE_NETWORK_DISCOVERY_SCHEMA,
|
||||
handler="enable_network_discovery",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class AlexaMediaServices:
|
||||
def __init__(self, hass: HomeAssistant, functions: dict[str, Callable[..., Any]]):
|
||||
self.hass = hass
|
||||
self._functions = functions
|
||||
|
||||
async def register(self) -> None:
|
||||
"""Register Alexa Media custom services."""
|
||||
for service_def in SERVICE_DEFS:
|
||||
handler = getattr(self, service_def.handler)
|
||||
self.hass.services.async_register(
|
||||
DOMAIN,
|
||||
service_def.name,
|
||||
handler,
|
||||
schema=service_def.schema,
|
||||
)
|
||||
|
||||
async def unregister(self) -> None:
|
||||
"""Unregister Alexa Media custom services."""
|
||||
for service_def in SERVICE_DEFS:
|
||||
self.hass.services.async_remove(DOMAIN, service_def.name)
|
||||
|
||||
async def force_logout(self, call: ServiceCall) -> bool:
|
||||
"""Handle force logout service request.
|
||||
|
||||
Arguments
|
||||
call.ATTR_EMAIL {List[str] | None}: List of case-sensitive Alexa emails.
|
||||
If None, all accounts are logged out.
|
||||
|
||||
Returns
|
||||
bool -- True if at least one account was marked for relogin.
|
||||
"""
|
||||
requested_emails = call.data.get(ATTR_EMAIL)
|
||||
_LOGGER.debug("Service force_logout called for: %s", requested_emails)
|
||||
|
||||
accounts = self.hass.data[DATA_ALEXAMEDIA]["accounts"]
|
||||
success = False
|
||||
|
||||
for email, account_dict in accounts.items():
|
||||
if requested_emails and email not in requested_emails:
|
||||
continue
|
||||
|
||||
login_obj = account_dict["login_obj"]
|
||||
|
||||
# This is the effective “force logout” for this account: mark it as
|
||||
# requiring reauthentication and notify the user/UI.
|
||||
report_relogin_required(self.hass, login_obj, email)
|
||||
success = True
|
||||
_LOGGER.debug(
|
||||
"Marked Alexa Media account %s for relogin via force_logout service",
|
||||
hide_email(email),
|
||||
)
|
||||
|
||||
if requested_emails and not success:
|
||||
_LOGGER.warning(
|
||||
"force_logout called for %s but no matching Alexa Media accounts were found",
|
||||
requested_emails,
|
||||
)
|
||||
|
||||
return success
|
||||
|
||||
@_catch_login_errors
|
||||
async def last_call_handler(self, call: ServiceCall) -> None:
|
||||
"""Handle last call service request.
|
||||
|
||||
Arguments
|
||||
call.ATTR_EMAIL: {List[str: None]}: List of case-sensitive Alexa emails.
|
||||
If None, all accounts are updated.
|
||||
"""
|
||||
requested_emails = call.data.get(ATTR_EMAIL)
|
||||
update_last_called = self._functions.get("update_last_called")
|
||||
|
||||
if not callable(update_last_called):
|
||||
_LOGGER.error(
|
||||
"update_last_called function not registered; cannot update last_called"
|
||||
)
|
||||
return
|
||||
|
||||
_LOGGER.debug("Service update_last_called called for: %s", requested_emails)
|
||||
|
||||
for email, account_dict in self.hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
if requested_emails and email not in requested_emails:
|
||||
continue
|
||||
|
||||
login_obj = account_dict["login_obj"]
|
||||
|
||||
async def _run_update_last_called(email: str, login_obj) -> None:
|
||||
try:
|
||||
await update_last_called(login_obj)
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except AlexapyLoginError:
|
||||
report_relogin_required(self.hass, login_obj, email)
|
||||
except AlexapyConnectionError:
|
||||
_LOGGER.error(
|
||||
"Unable to connect to Alexa for %s;"
|
||||
" check your network connection and try again",
|
||||
hide_email(email),
|
||||
)
|
||||
except Exception: # pragma: no cover
|
||||
_LOGGER.exception(
|
||||
"Unexpected error updating last_called for %s",
|
||||
hide_email(email),
|
||||
)
|
||||
finally:
|
||||
# Clean up task reference when done
|
||||
if email in self.hass.data[DATA_ALEXAMEDIA]["accounts"]:
|
||||
self.hass.data[DATA_ALEXAMEDIA]["accounts"][email].pop(
|
||||
"service_update_last_called_task", None
|
||||
)
|
||||
|
||||
# Cancel any existing task for this account before creating a new one
|
||||
existing_task = account_dict.get("service_update_last_called_task")
|
||||
if existing_task and not existing_task.done():
|
||||
existing_task.cancel()
|
||||
|
||||
# Store task handle for proper cleanup on unload
|
||||
task = self.hass.async_create_task(
|
||||
_run_update_last_called(email, login_obj),
|
||||
name=f"alexa_media.update_last_called.{hide_email(email)}",
|
||||
)
|
||||
account_dict["service_update_last_called_task"] = task
|
||||
|
||||
async def restore_volume(self, call: ServiceCall) -> bool:
|
||||
"""Handle restore volume service request.
|
||||
|
||||
Arguments:
|
||||
call.ATTR_ENTITY_ID {str: None} -- Alexa Media Player entity.
|
||||
|
||||
"""
|
||||
entity_id = call.data.get(ATTR_ENTITY_ID)
|
||||
_LOGGER.debug("Service restore_volume called for: %s", entity_id)
|
||||
|
||||
# Retrieve the entity registry and entity entry
|
||||
entity_registry = er.async_get(self.hass)
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
|
||||
if not entity_entry:
|
||||
_LOGGER.error("Entity %s not found in registry", entity_id)
|
||||
return False
|
||||
|
||||
# Retrieve the state and attributes
|
||||
state = self.hass.states.get(entity_id)
|
||||
if not state:
|
||||
_LOGGER.warning("Entity %s has no state; cannot restore volume", entity_id)
|
||||
return False
|
||||
|
||||
previous_volume = state.attributes.get("previous_volume")
|
||||
current_volume = state.attributes.get("volume_level")
|
||||
|
||||
if previous_volume is None:
|
||||
_LOGGER.warning(
|
||||
"Previous volume not found for %s; attempting to use current volume level: %s",
|
||||
entity_id,
|
||||
current_volume,
|
||||
)
|
||||
previous_volume = current_volume
|
||||
|
||||
if previous_volume is None:
|
||||
_LOGGER.warning(
|
||||
"No valid volume levels found for entity %s; cannot restore volume",
|
||||
entity_id,
|
||||
)
|
||||
return False
|
||||
|
||||
# Call the volume_set service with the retrieved volume
|
||||
await self.hass.services.async_call(
|
||||
domain="media_player",
|
||||
service="volume_set",
|
||||
service_data={
|
||||
"volume_level": previous_volume,
|
||||
},
|
||||
target={"entity_id": entity_id},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
_LOGGER.debug("Volume restored to %s for entity %s", previous_volume, entity_id)
|
||||
return True
|
||||
|
||||
async def get_history_records(self, call: ServiceCall) -> bool:
|
||||
"""Handle request to get history records and store them on the entity."""
|
||||
entity_id = call.data.get(ATTR_ENTITY_ID)
|
||||
number_of_entries = call.data.get(ATTR_NUM_ENTRIES)
|
||||
|
||||
# Validate number_of_entries
|
||||
try:
|
||||
number_of_entries_int = int(number_of_entries)
|
||||
except (TypeError, ValueError):
|
||||
_LOGGER.exception(
|
||||
"Service get_history_records for %s has invalid entries value: %s",
|
||||
entity_id,
|
||||
number_of_entries,
|
||||
)
|
||||
return False
|
||||
|
||||
if number_of_entries_int <= 0:
|
||||
_LOGGER.error(
|
||||
"Service get_history_records for %s with %s entries is invalid; must be > 0",
|
||||
entity_id,
|
||||
number_of_entries_int,
|
||||
)
|
||||
return False
|
||||
|
||||
_LOGGER.debug(
|
||||
"Service get_history_records for: %s with %s entries",
|
||||
entity_id,
|
||||
number_of_entries_int,
|
||||
)
|
||||
|
||||
# Validate the target entity
|
||||
entity_registry = er.async_get(self.hass)
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
if not entity_entry or entity_entry.platform != DOMAIN:
|
||||
_LOGGER.error("Entity %s not found or not part of %s", entity_id, DOMAIN)
|
||||
return False
|
||||
target_serial_number = entity_entry.unique_id
|
||||
|
||||
history_data_total: list[dict[str, Any]] = []
|
||||
|
||||
async def _collect_history_for_account(login_obj) -> None:
|
||||
"""Collect history entries for a single account matching the target device."""
|
||||
# Get the history records. Input: time_from, time_to (both None here).
|
||||
history_data = await AlexaAPI.get_customer_history_records(
|
||||
login_obj, None, None
|
||||
)
|
||||
if not history_data:
|
||||
return
|
||||
|
||||
for item in history_data:
|
||||
summary = safe_get(item, ["description", "summary"], "")
|
||||
device_serial_number = item.get("deviceSerialNumber")
|
||||
timestamp = item.get("creationTimestamp")
|
||||
|
||||
if (
|
||||
not summary
|
||||
or summary == ","
|
||||
or device_serial_number != target_serial_number
|
||||
or timestamp is None
|
||||
):
|
||||
continue
|
||||
|
||||
entry = {
|
||||
"timestamp": timestamp,
|
||||
"summary": summary,
|
||||
"response": item.get("alexaResponse", ""),
|
||||
}
|
||||
history_data_total.append(entry)
|
||||
|
||||
# Iterate accounts and collect history
|
||||
for email, account_dict in self.hass.data[DATA_ALEXAMEDIA]["accounts"].items():
|
||||
login_obj = account_dict["login_obj"]
|
||||
try:
|
||||
await _collect_history_for_account(login_obj)
|
||||
except AlexapyConnectionError:
|
||||
_LOGGER.exception(
|
||||
"Error retrieving history for %s",
|
||||
hide_email(email),
|
||||
)
|
||||
except AlexapyLoginError:
|
||||
_LOGGER.exception(
|
||||
"Login error retrieving history for %s",
|
||||
hide_email(email),
|
||||
)
|
||||
report_relogin_required(self.hass, login_obj, email)
|
||||
|
||||
except asyncio.CancelledError:
|
||||
# Let HA cancellation propagate
|
||||
raise
|
||||
except Exception:
|
||||
# Fallback for truly unexpected errors
|
||||
_LOGGER.exception(
|
||||
"Unexpected error retrieving history for %s",
|
||||
hide_email(email),
|
||||
)
|
||||
|
||||
# Sort and limit entries
|
||||
history_data_total.sort(key=lambda x: x["timestamp"], reverse=True)
|
||||
history_data_total = history_data_total[:number_of_entries_int]
|
||||
|
||||
# Update the entity's attributes
|
||||
state = self.hass.states.get(entity_id)
|
||||
if state is not None:
|
||||
new_attributes = dict(state.attributes)
|
||||
new_attributes["history_records"] = history_data_total
|
||||
self.hass.states.async_set(entity_id, state.state, new_attributes)
|
||||
return True
|
||||
|
||||
_LOGGER.error("Entity %s state not found", entity_id)
|
||||
return False
|
||||
|
||||
async def enable_network_discovery(self, call: ServiceCall) -> None:
|
||||
"""Re-enable network discovery for one or more Alexa accounts."""
|
||||
data = call.data or {}
|
||||
target_emails: list[str] = data.get(ATTR_EMAIL, [])
|
||||
|
||||
accounts = self.hass.data[DATA_ALEXAMEDIA]["accounts"]
|
||||
any_matched = False
|
||||
|
||||
for email, account_dict in accounts.items():
|
||||
if target_emails and email not in target_emails:
|
||||
continue
|
||||
|
||||
any_matched = True
|
||||
|
||||
if "should_get_network" not in account_dict:
|
||||
_LOGGER.debug(
|
||||
"Account %s has no 'should_get_network' flag; skipping",
|
||||
hide_email(email),
|
||||
)
|
||||
continue
|
||||
|
||||
account_dict["should_get_network"] = True
|
||||
_LOGGER.debug(
|
||||
"Re-enabled network discovery for Alexa Media account %s",
|
||||
hide_email(email),
|
||||
)
|
||||
|
||||
if target_emails and not any_matched:
|
||||
_LOGGER.warning(
|
||||
"enable_network_discovery called for %s but no matching Alexa Media accounts were found",
|
||||
target_emails,
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
force_logout:
|
||||
# Description of the service
|
||||
description: Force logout of Alexa Login account and deletion of .pickle. Intended for debugging use.
|
||||
# Different fields that your service accepts
|
||||
fields:
|
||||
# Key of the field
|
||||
email:
|
||||
# Description of the field
|
||||
description: List of Alexa accounts to log out. If empty, will log out from all known accounts.
|
||||
# Example value that can be passed for this field
|
||||
example: "my_email@alexa.com"
|
||||
|
||||
restore_volume:
|
||||
description: Restores an Alexa Media Player volume level to the previous volume level.
|
||||
fields:
|
||||
entity_id:
|
||||
name: Entity
|
||||
description: Alexa Media Player device to restore volume on.
|
||||
required: true
|
||||
selector:
|
||||
entity:
|
||||
domain: media_player
|
||||
integration: alexa_media
|
||||
|
||||
get_history_records:
|
||||
description: Returns the last entries of all the customer history.
|
||||
fields:
|
||||
entity_id:
|
||||
name: Entity
|
||||
description: Alexa Media Player device to get history from.
|
||||
required: true
|
||||
selector:
|
||||
entity:
|
||||
domain: media_player
|
||||
integration: alexa_media
|
||||
entries:
|
||||
name: Entries
|
||||
description: Number of records to return.
|
||||
required: false
|
||||
default: 5
|
||||
example: 5
|
||||
|
||||
update_last_called:
|
||||
# Description of the service
|
||||
description: Forces update of last_called echo device for each Alexa account.
|
||||
# Different fields that your service accepts
|
||||
fields:
|
||||
# Key of the field
|
||||
email:
|
||||
# Description of the field
|
||||
description: List of Alexa accounts to update. If empty, will update all known accounts.
|
||||
# Example value that can be passed for this field
|
||||
example: "my_email@alexa.com"
|
||||
|
||||
enable_network_discovery:
|
||||
name: Enable network discovery
|
||||
description: >
|
||||
Re-enable Alexa network discovery so the next polling cycle will
|
||||
rediscover Alexa devices for the selected accounts.
|
||||
fields:
|
||||
email:
|
||||
name: Account email(s)
|
||||
description: >
|
||||
Optional Alexa account email or list of emails. If omitted,
|
||||
all Alexa Media accounts will be refreshed.
|
||||
required: false
|
||||
example: [email protected]
|
||||
selector:
|
||||
text:
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "The Forgot Password page was detected. This normally is the result of too many failed logins. Amazon may require action before a relogin can be attempted.",
|
||||
"login_failed": "Alexa Media Player failed to login.",
|
||||
"reauth_successful": "Alexa Media Player successfully reauthenticated. Please ignore the \"Aborted\" message from HA."
|
||||
},
|
||||
"error": {
|
||||
"connection_error": "Error connecting; check network and retry",
|
||||
"identifier_exists": "Email for Alexa URL already registered",
|
||||
"invalid_credentials": "Invalid credentials",
|
||||
"invalid_auth": "Login was not successful. Please double-check your email, password, and Authenticator key.",
|
||||
"oauth_error": "Could not complete OAuth login. Please try again.",
|
||||
"invalid_url": "URL is invalid: {message}",
|
||||
"2fa_key_invalid": "{otp_secret} is invalid",
|
||||
"unable_to_connect_hass_url": "Unable to connect to Home Assistant Local URL. Please check the URL under Settings > System > Network > Home Assistant URL > Local network",
|
||||
"unknown_error": "Unknown error: {message}"
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"email": "Email Address",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"hass_url": "Local network URL to access Home Assistant",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"password": "Password",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"securitycode": "One-time password (OTP)",
|
||||
"should_get_network": "Discover Alexa network",
|
||||
"url": "Amazon region domain (e.g., amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
},
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore and Continue - I understand that no support for login issues are provided for bypassing this warning."
|
||||
},
|
||||
"description": "The HA server cannot connect to the URL provided: {hass_url}.\n> {error}\n\nTo fix this, please confirm your browser can reach {hass_url}. This field is from Settings > System > Network > Home Assistant URL.\n\nIf you are **certain** your browser can reach this URL, you can bypass this warning.",
|
||||
"title": "Alexa Media Player - Unable to Connect to HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Yes, OTP code was verified"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHave you verified the OTP code in Amazon 2SV? \n >OTP Code: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmation"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Alexa Media Player - Reconfiguration",
|
||||
"description": "* Required entry",
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"should_get_network": "Discover Alexa network"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"force_logout": {
|
||||
"name": "Force Logout",
|
||||
"description": "Force account to logout. Used mainly for debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"name": "Email address",
|
||||
"description": "Accounts to clear. Empty will clear all."
|
||||
}
|
||||
}
|
||||
},
|
||||
"restore_volume": {
|
||||
"name": "Restore Previous Volume",
|
||||
"description": "Restore previous volume level on Alexa media player device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"name": "Select media player:",
|
||||
"description": "Entity to restore the previous volume level on"
|
||||
}
|
||||
}
|
||||
},
|
||||
"get_history_records": {
|
||||
"name": "Get History Records",
|
||||
"description": "Parses the history records for the specified device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"name": "Select media player:",
|
||||
"description": "Entity to get the history for"
|
||||
},
|
||||
"entries": {
|
||||
"name": "Number of entries",
|
||||
"description": "Number of entries to get"
|
||||
}
|
||||
}
|
||||
},
|
||||
"update_last_called": {
|
||||
"name": "Update Last Called Sensor",
|
||||
"description": "Forces update of last_called echo device for each Alexa account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"name": "Email address",
|
||||
"description": "List of Alexa accounts to update. If empty, will update all known accounts."
|
||||
}
|
||||
}
|
||||
},
|
||||
"enable_network_discovery": {
|
||||
"name": "Enable Network Discovery",
|
||||
"description": "Re-enables Alexa network discovery so the next polling cycle will rediscover Alexa devices for the selected accounts.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"name": "Email address",
|
||||
"description": "Optional Alexa account email or list of emails. If empty, all known accounts will be refreshed."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
},
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"title": "YAML configuration is deprecated",
|
||||
"description": "YAML configuration of Alexa Media Player is deprecated.\nPlease remove `alexa_media` from your configuration, restart Home Assistant and use the UI to configure it instead.\nSettings > Devices & services > Integrations > ADD INTEGRATION"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,502 @@
|
||||
"""
|
||||
Alexa Devices Switches.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
|
||||
"""
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
from alexapy import AlexaAPI
|
||||
from homeassistant.exceptions import ConfigEntryNotReady, NoEntitySpecifiedError
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import (
|
||||
CONF_EMAIL,
|
||||
CONF_EXCLUDE_DEVICES,
|
||||
CONF_INCLUDE_DEVICES,
|
||||
DATA_ALEXAMEDIA,
|
||||
DOMAIN as ALEXA_DOMAIN,
|
||||
hide_email,
|
||||
hide_serial,
|
||||
)
|
||||
from .alexa_entity import parse_power_from_coordinator
|
||||
from .alexa_media import AlexaMedia
|
||||
from .const import CONF_EXTENDED_ENTITY_DISCOVERY
|
||||
from .helpers import _catch_login_errors, add_devices, safe_get
|
||||
|
||||
try:
|
||||
from homeassistant.components.switch import SwitchEntity as SwitchDevice
|
||||
except ImportError:
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
"""Set up the Alexa switch platform."""
|
||||
devices: list[DNDSwitch] = []
|
||||
SWITCH_TYPES = [ # pylint: disable=invalid-name
|
||||
("dnd", DNDSwitch),
|
||||
("shuffle", ShuffleSwitch),
|
||||
("repeat", RepeatSwitch),
|
||||
]
|
||||
account = None
|
||||
if config:
|
||||
account = config.get(CONF_EMAIL)
|
||||
if account is None and discovery_info:
|
||||
account = safe_get(discovery_info, ["config", CONF_EMAIL])
|
||||
if account is None:
|
||||
raise ConfigEntryNotReady
|
||||
include_filter = config.get(CONF_INCLUDE_DEVICES, [])
|
||||
exclude_filter = config.get(CONF_EXCLUDE_DEVICES, [])
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
_LOGGER.debug("%s: Loading switches", hide_email(account))
|
||||
if "switch" not in account_dict["entities"]:
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"]["switch"] = {}
|
||||
for key, _ in account_dict["devices"]["media_player"].items():
|
||||
if key not in account_dict["entities"]["media_player"]:
|
||||
_LOGGER.debug(
|
||||
"%s: Media player %s not loaded yet; delaying load",
|
||||
hide_email(account),
|
||||
hide_serial(key),
|
||||
)
|
||||
raise ConfigEntryNotReady
|
||||
if key not in (
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"]["switch"]
|
||||
):
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"]["switch"][
|
||||
key
|
||||
] = {}
|
||||
for switch_key, class_ in SWITCH_TYPES:
|
||||
if (
|
||||
switch_key == "dnd"
|
||||
and not safe_get(account_dict, ["devices", "switch", key, "dnd"])
|
||||
) or (
|
||||
switch_key in ["shuffle", "repeat"]
|
||||
and "MUSIC_SKILL"
|
||||
not in account_dict["devices"]["media_player"]
|
||||
.get(key, {})
|
||||
.get("capabilities", {})
|
||||
):
|
||||
_LOGGER.debug(
|
||||
"%s: Skipping %s for %s",
|
||||
hide_email(account),
|
||||
switch_key,
|
||||
hide_serial(key),
|
||||
)
|
||||
continue
|
||||
alexa_client = class_(
|
||||
account_dict["entities"]["media_player"][key]
|
||||
) # type: AlexaMediaSwitch
|
||||
_LOGGER.debug(
|
||||
"%s: Found %s %s switch with status: %s",
|
||||
hide_email(account),
|
||||
hide_serial(key),
|
||||
switch_key,
|
||||
alexa_client.is_on,
|
||||
)
|
||||
devices.append(alexa_client)
|
||||
(
|
||||
hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"][
|
||||
"switch"
|
||||
][key][switch_key]
|
||||
) = alexa_client
|
||||
else:
|
||||
for alexa_client in hass.data[DATA_ALEXAMEDIA]["accounts"][account][
|
||||
"entities"
|
||||
]["switch"][key].values():
|
||||
_LOGGER.debug(
|
||||
"%s: Skipping already added device: %s",
|
||||
hide_email(account),
|
||||
alexa_client,
|
||||
)
|
||||
# Add Amazon Smart Plug devices
|
||||
switch_entities = safe_get(account_dict, ["devices", "smart_switch"], [])
|
||||
hue_emulated_enabled = "emulated_hue" in hass.config.as_dict().get(
|
||||
"components", set()
|
||||
)
|
||||
if switch_entities and account_dict["options"].get(CONF_EXTENDED_ENTITY_DISCOVERY):
|
||||
for switch_entity in switch_entities:
|
||||
if not (switch_entity["is_hue_v1"] and hue_emulated_enabled):
|
||||
_LOGGER.debug(
|
||||
"Creating entity %s for a switch with name %s",
|
||||
hide_serial(switch_entity["id"]),
|
||||
switch_entity["name"],
|
||||
)
|
||||
coordinator = account_dict["coordinator"]
|
||||
switch = SmartSwitch(
|
||||
coordinator, account_dict["login_obj"], switch_entity
|
||||
)
|
||||
account_dict["entities"]["smart_switch"].append(switch)
|
||||
devices.append(switch)
|
||||
else:
|
||||
_LOGGER.debug(
|
||||
"Switch '%s' has not been added because it may originate from emulated_hue",
|
||||
switch_entity["name"],
|
||||
)
|
||||
return await add_devices(
|
||||
hide_email(account),
|
||||
devices,
|
||||
add_devices_callback,
|
||||
include_filter,
|
||||
exclude_filter,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_devices):
|
||||
"""Set up the Alexa switch platform by config_entry."""
|
||||
return await async_setup_platform(
|
||||
hass, config_entry.data, async_add_devices, discovery_info=None
|
||||
)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
account = entry.data[CONF_EMAIL]
|
||||
_LOGGER.debug("Attempting to unload switch")
|
||||
account_dict = hass.data[DATA_ALEXAMEDIA]["accounts"][account]
|
||||
for key, switches in account_dict["entities"]["switch"].items():
|
||||
for device in switches[key].values():
|
||||
_LOGGER.debug("Removing %s", device)
|
||||
await device.async_remove()
|
||||
return True
|
||||
|
||||
|
||||
class AlexaMediaSwitch(SwitchDevice, AlexaMedia):
|
||||
"""Representation of a Alexa Media switch."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client,
|
||||
switch_property: str,
|
||||
switch_function: str,
|
||||
unique_id_suffix: str = "switch",
|
||||
):
|
||||
"""Initialize the Alexa Switch device."""
|
||||
# Class info
|
||||
self._client = client
|
||||
self._unique_id_suffix = unique_id_suffix
|
||||
self._switch_property = switch_property
|
||||
self._switch_function = switch_function
|
||||
super().__init__(client, client._login)
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Store register state change callback."""
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
# Register event handler on bus
|
||||
self._listener = async_dispatcher_connect(
|
||||
self.hass,
|
||||
f"{ALEXA_DOMAIN}_{hide_email(self.email)}"[0:32],
|
||||
self._handle_event,
|
||||
)
|
||||
|
||||
async def async_will_remove_from_hass(self):
|
||||
"""Prepare to remove entity."""
|
||||
# Register event handler on bus
|
||||
self._listener()
|
||||
|
||||
def _handle_event(self, event):
|
||||
"""Handle events.
|
||||
|
||||
This will update PUSH_MEDIA_QUEUE_CHANGE events to see if the switch
|
||||
should be updated.
|
||||
"""
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
if "queue_state" in event:
|
||||
queue_state = event["queue_state"]
|
||||
if queue_state["dopplerId"]["deviceSerialNumber"] == self._client.unique_id:
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
@_catch_login_errors
|
||||
async def _set_switch(self, state, **kwargs):
|
||||
# pylint: disable=unused-argument
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
success = await getattr(self.alexa_api, self._switch_function)(state)
|
||||
# if function returns success, make immediate state change
|
||||
if success:
|
||||
setattr(self._client, self._switch_property, state)
|
||||
_LOGGER.debug(
|
||||
"Setting %s to %s",
|
||||
self.name,
|
||||
getattr(self._client, self._switch_property),
|
||||
)
|
||||
self.schedule_update_ha_state()
|
||||
elif self.should_poll:
|
||||
# if we need to poll, refresh media_client
|
||||
_LOGGER.debug(
|
||||
"Requesting update of %s due to %s switch to %s",
|
||||
self._client,
|
||||
self._unique_id_suffix,
|
||||
state,
|
||||
)
|
||||
await self._client.async_update()
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if on."""
|
||||
return self.available and getattr(self._client, self._switch_property)
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn on switch."""
|
||||
await self._set_switch(True, **kwargs)
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn off switch."""
|
||||
await self._set_switch(False, **kwargs)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return the availability of the switch."""
|
||||
return (
|
||||
self._client.available
|
||||
and getattr(self._client, self._switch_property) is not None
|
||||
)
|
||||
|
||||
@property
|
||||
def assumed_state(self):
|
||||
"""Return whether the state is an assumed_state."""
|
||||
return self._client.assumed_state
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the unique ID."""
|
||||
return self._client.unique_id + "_" + self._unique_id_suffix
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the device_class of the switch."""
|
||||
return "switch"
|
||||
|
||||
@property
|
||||
def hidden(self):
|
||||
"""Return whether the switch should be hidden from the UI."""
|
||||
return not self.available
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""Return the polling state."""
|
||||
return True
|
||||
|
||||
@_catch_login_errors
|
||||
async def async_update(self):
|
||||
"""Update state."""
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
self.schedule_update_ha_state()
|
||||
except NoEntitySpecifiedError:
|
||||
pass # we ignore this due to a harmless startup race condition
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return device_info for device registry."""
|
||||
return {
|
||||
"identifiers": {(ALEXA_DOMAIN, self._client.unique_id)},
|
||||
"via_device": (ALEXA_DOMAIN, self._client.unique_id),
|
||||
}
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the switch."""
|
||||
return self._icon()
|
||||
|
||||
def _icon(self, on=None, off=None): # pylint: disable=invalid-name
|
||||
return on if self.is_on else off
|
||||
|
||||
|
||||
class DNDSwitch(AlexaMediaSwitch):
|
||||
"""Representation of a Alexa Media Do Not Disturb switch."""
|
||||
|
||||
_attr_translation_key = "do_not_disturb"
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the Alexa Switch."""
|
||||
# Class info
|
||||
super().__init__(
|
||||
client,
|
||||
"dnd_state",
|
||||
"set_dnd_state",
|
||||
"do not disturb", # Keep original suffix for backward compatibility
|
||||
)
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the switch."""
|
||||
return super()._icon("mdi:minus-circle", "mdi:minus-circle-off")
|
||||
|
||||
@property
|
||||
def entity_category(self):
|
||||
"""Return the entity category of the switch."""
|
||||
return EntityCategory.CONFIG
|
||||
|
||||
def _handle_event(self, event):
|
||||
"""Handle events."""
|
||||
try:
|
||||
if not self.enabled:
|
||||
return
|
||||
except AttributeError:
|
||||
pass
|
||||
if "dnd_update" in event:
|
||||
result = list(
|
||||
filter(
|
||||
lambda x: x["deviceSerialNumber"]
|
||||
== self._client.device_serial_number,
|
||||
event["dnd_update"],
|
||||
)
|
||||
)
|
||||
if result:
|
||||
state = result[0]["enabled"] is True
|
||||
if state != self.is_on:
|
||||
_LOGGER.debug("Detected %s changed to %s", self, state)
|
||||
setattr(self._client, self._switch_property, state)
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
|
||||
class ShuffleSwitch(AlexaMediaSwitch):
|
||||
"""Representation of a Alexa Media Shuffle switch."""
|
||||
|
||||
_attr_translation_key = "shuffle"
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the Alexa Switch."""
|
||||
# Class info
|
||||
super().__init__(client, "shuffle", "shuffle", "shuffle")
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the switch."""
|
||||
return super()._icon("mdi:shuffle", "mdi:shuffle-disabled")
|
||||
|
||||
@property
|
||||
def entity_category(self):
|
||||
"""Return the entity category of the switch."""
|
||||
return EntityCategory.CONFIG
|
||||
|
||||
|
||||
class RepeatSwitch(AlexaMediaSwitch):
|
||||
"""Representation of a Alexa Media Repeat switch."""
|
||||
|
||||
_attr_translation_key = "repeat"
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the Alexa Switch."""
|
||||
# Class info
|
||||
super().__init__(client, "repeat_state", "repeat", "repeat")
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon of the switch."""
|
||||
return super()._icon("mdi:repeat", "mdi:repeat-off")
|
||||
|
||||
@property
|
||||
def entity_category(self):
|
||||
"""Return the entity category of the switch."""
|
||||
return EntityCategory.CONFIG
|
||||
|
||||
|
||||
class SmartSwitch(CoordinatorEntity, SwitchDevice):
|
||||
def __init__(self, coordinator, login, details):
|
||||
"""Initialize alexa light entity."""
|
||||
super().__init__(coordinator)
|
||||
self.alexa_entity_id = details["id"]
|
||||
self._name = details["name"]
|
||||
self._login = login
|
||||
|
||||
# Store the requested state from the last call to _set_state
|
||||
# This is so that no new network call is needed just to get values that are already known
|
||||
# This is useful because refreshing the full state can take a bit when many switches are in play.
|
||||
# Especially since Alexa actually polls the switches and that appears to be error-prone with some Zigbee lights.
|
||||
# That delay(1-5s in practice) causes the UI controls to jump all over the place after _set_state
|
||||
self._requested_state_at = None # When was state last set in UTC
|
||||
self._requested_power = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return name."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return unique id."""
|
||||
return self.alexa_entity_id
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return whether on."""
|
||||
power = parse_power_from_coordinator(
|
||||
self.coordinator, self.alexa_entity_id, self._requested_state_at
|
||||
)
|
||||
if power is None:
|
||||
return self._requested_power if self._requested_power is not None else False
|
||||
return power == "ON"
|
||||
|
||||
@property
|
||||
def assumed_state(self) -> bool:
|
||||
"""Return whether state is assumed."""
|
||||
last_refresh_success = (
|
||||
self.coordinator.data and self.alexa_entity_id in self.coordinator.data
|
||||
)
|
||||
return not last_refresh_success
|
||||
|
||||
async def _set_state(self, power_on: bool) -> None:
|
||||
response = await AlexaAPI.set_light_state(
|
||||
self._login,
|
||||
self.alexa_entity_id,
|
||||
power_on,
|
||||
)
|
||||
|
||||
if not isinstance(response, dict):
|
||||
# If something failed any state is possible, fallback to a full refresh
|
||||
await self.coordinator.async_request_refresh()
|
||||
return
|
||||
|
||||
control_responses = response.get("controlResponses", [])
|
||||
for ctrl_resp in control_responses:
|
||||
if ctrl_resp.get("code") != "SUCCESS":
|
||||
# If something failed any state is possible, fallback to a full refresh
|
||||
await self.coordinator.async_request_refresh()
|
||||
return
|
||||
|
||||
self._requested_power = power_on
|
||||
self._requested_state_at = datetime.datetime.now(
|
||||
datetime.timezone.utc
|
||||
) # must be set last so that previous getters work properly
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
# Confirm quickly, but debounce to avoid spamming across multiple entities.
|
||||
account = self.hass.data[DATA_ALEXAMEDIA]["accounts"].get(self._login.email)
|
||||
if account:
|
||||
debouncer = account.get("confirm_refresh_debouncer")
|
||||
if debouncer:
|
||||
await debouncer.async_call()
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn on."""
|
||||
await self._set_state(True)
|
||||
|
||||
async def async_turn_off(self, **kwargs): # pylint:disable=unused-argument
|
||||
"""Turn off."""
|
||||
await self._set_state(False)
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "تم الكشف عن صفحة نسيت كلمة المرور. عادةً ما يكون هذا نتيجة لمحاولات تسجيل دخول فاشلة كثيرة. قد تتطلب أمازون اتخاذ إجراء قبل محاولة تسجيل الدخول مرة أخرى.",
|
||||
"login_failed": "فشل تسجيل الدخول إلى Alexa Media Player.",
|
||||
"reauth_successful": "تمت إعادة التحقق من Alexa Media Player بنجاح. يرجى تجاهل رسالة \"تم الإلغاء\" من Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} غير صالح",
|
||||
"connection_error": "خطأ في الاتصال؛ تحقق من الشبكة وأعد المحاولة",
|
||||
"identifier_exists": "البريد الإلكتروني لرابط Alexa مسجل مسبقًا",
|
||||
"invalid_auth": "لم تنجح عملية تسجيل الدخول. يرجى التحقق من بريدك الإلكتروني وكلمة المرور ومفتاح المصادقة.",
|
||||
"invalid_credentials": "بيانات اعتماد غير صالحة",
|
||||
"invalid_url": "رابط غير صالح: {message}",
|
||||
"oauth_error": "تعذر إكمال تسجيل الدخول عبر OAuth. يرجى المحاولة مرة أخرى.",
|
||||
"unable_to_connect_hass_url": "غير قادر على الاتصال بالرابط المحلي لـ Home Assistant. يرجى التحقق من العنوان ضمن:\nالإعدادات > النظام > الشبكة > رابط Home Assistant > الشبكة المحلية.",
|
||||
"unknown_error": "خطأ غير معروف: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "تجاهل ومتابعة - أتفهم أنه لا يوجد دعم لمشاكل تسجيل الدخول لتجاوز هذا التحذير."
|
||||
},
|
||||
"description": "لا يمكن لخادم Home Assistant الاتصال بالرابط المقدم: {hass_url}. \n > {error} \n \n لإصلاح هذه المشكلة، يرجى التأكد من أن متصفحك يمكنه الوصول إلى {hass_url}. هذا الحقل موجود في الإعدادات > النظام > الشبكة > رابط Home Assistant. \n \n إذا كنت **متأكدًا** من أن متصفحك يمكنه الوصول إلى هذا الرابط، فيمكنك تجاوز هذا التحذير.",
|
||||
"title": "Alexa Media Player - غير قادر على الاتصال برابط Home Assistant"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "نعم، تم التحقق من رمز OTP"
|
||||
},
|
||||
"description": "** {email} - alexa. {url} ** \n هل قمت بالتحقق من رمز OTP في Amazon 2SV؟ \n >رمز OTP: {message}",
|
||||
"title": "Alexa Media Player - تأكيد OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "تصحيح الأخطاء المتقدم",
|
||||
"email": "البريد الإلكتروني",
|
||||
"exclude_devices": "أو استبعاد هذه الأجهزة من الكل (مفصولة بفواصل)",
|
||||
"extended_entity_discovery": "أضف أجهزة استشعار ومفاتيح وأضواء إضافية",
|
||||
"hass_url": "رابط الشبكة المحلية للوصول إلى Home Assistant",
|
||||
"include_devices": "تضمين هذه الأجهزة فقط (مفصولة بفواصل)",
|
||||
"otp_secret": "مفتاح تطبيق المصادقة المؤلف من 52 حرفًا للتحقق الثنائي من أمازون",
|
||||
"password": "كلمة المرور",
|
||||
"public_url": "رابط عام مشترك مع خدمات مستضافة خارجية",
|
||||
"queue_delay": "تأخير وضع أوامر متعددة في قائمة الانتظار معًا (بالثواني)",
|
||||
"scan_interval": "الفاصل الزمني للإستطلاع المجدول (بالثواني)",
|
||||
"securitycode": "كلمة مرور لمرة واحدة (OTP)",
|
||||
"should_get_network": "اكتشف شبكة اليكسا",
|
||||
"url": "نطاق منطقة Amazon (على سبيل المثال، amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "تم إيقاف استخدام ملف YAML لتكوين مشغل وسائط Alexa.\n\nيرجى إزالة `alexa_media` من ملف التكوين، وإعادة تشغيل Home Assistant، واستخدام واجهة المستخدم لتكوينه.\n\nالإعدادات > الأجهزة والخدمات > التكاملات > إضافة تكامل",
|
||||
"title": "إعدادات YAML غير معتمد"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "تصحيح الأخطاء المتقدم",
|
||||
"exclude_devices": "أو استبعاد هذه الأجهزة من الكل (مفصولة بفواصل)",
|
||||
"extended_entity_discovery": "أضف أجهزة استشعار ومفاتيح وأضواء إضافية",
|
||||
"include_devices": "تضمين هذه الأجهزة فقط (مفصولة بفواصل)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "رابط عام مشترك مع خدمات مستضافة خارجية",
|
||||
"queue_delay": "تأخير وضع أوامر متعددة في قائمة الانتظار معًا (بالثواني)",
|
||||
"scan_interval": "تكرار الاستطلاع المجدول (بالثواني)",
|
||||
"should_get_network": "اكتشف شبكة اليكسا"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* إدخالات مطلوبة",
|
||||
"title": "Alexa Media Player - إعادة التكوين"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "يعيد تفعيل اكتشاف شبكة Alexa بحيث تعيد دورة الاستطلاع التالية اكتشاف أجهزة Alexa للحسابات المحددة.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "بريد إلكتروني اختياري لحساب أليكسا أو قائمة عناوين البريد الإلكتروني. في حال عدم وجودها، سيتم تحديث جميع الحسابات المعروفة.",
|
||||
"name": "عنوان البريد الإلكتروني"
|
||||
}
|
||||
},
|
||||
"name": "تفعيل اكتشاف الشبكة"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "إجبار الحساب على تسجيل الخروج. يُستخدم بشكل أساسي لأغراض التصحيح.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "الحسابات المراد مسحها. إذا كانت فارغة سيتم مسح الكل.",
|
||||
"name": "البريد الإلكتروني"
|
||||
}
|
||||
},
|
||||
"name": "فرض تسجيل الخروج"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "يقوم بتحليل سجلات التاريخ للجهاز المحدد",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "الكيان الذي سيتم الحصول منه على السجل",
|
||||
"name": "حدد مشغل الوسائط:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "عدد الإدخالات المطلوب الحصول عليها",
|
||||
"name": "عدد الإدخالات"
|
||||
}
|
||||
},
|
||||
"name": "الحصول على سجلات التاريخ"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "استعادة مستوى الصوت السابق على جهاز Alexa media player",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "العنصر لاستعادة مستوى الصوت السابق عليه",
|
||||
"name": "اختر مشغل الوسائط:"
|
||||
}
|
||||
},
|
||||
"name": "استعادة مستوى الصوت السابق"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "فرض التحديث لـ \"آخر إتصال\" من جهاز echo لجميع حسابات Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "قائمة حسابات Alexa للتحديث. إذا كانت فارغة، سيتم تحديث جميع الحسابات المعروفة.",
|
||||
"name": "البريد الإلكتروني"
|
||||
}
|
||||
},
|
||||
"name": "تحديث مستشعر \"آخر إتصال\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "The Forgot Password page was detected. This normally is the result of too many failed logins. Amazon may require action before a relogin can be attempted.",
|
||||
"login_failed": "Alexa Media Player failed to login.",
|
||||
"reauth_successful": "Alexa Media Player successfully reauthenticated. Please ignore the \"Aborted\" message from HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} is invalid",
|
||||
"connection_error": "Error connecting; check network and retry",
|
||||
"identifier_exists": "Email for Alexa URL already registered",
|
||||
"invalid_auth": "Login was not successful. Please double-check your email, password, and Authenticator key.",
|
||||
"invalid_credentials": "Invalid credentials",
|
||||
"invalid_url": "URL is invalid: {message}",
|
||||
"oauth_error": "Could not complete OAuth login. Please try again.",
|
||||
"unable_to_connect_hass_url": "Unable to connect to Home Assistant Local URL. Please check the URL under Settings > System > Network > Home Assistant URL > Local network",
|
||||
"unknown_error": "Unknown error: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore and Continue - I understand that no support for login issues are provided for bypassing this warning."
|
||||
},
|
||||
"description": "The HA server cannot connect to the URL provided: {hass_url}.\n> {error}\n\nTo fix this, please confirm your browser can reach {hass_url}. This field is from Settings > System > Network > Home Assistant URL.\n\nIf you are **certain** your browser can reach this URL, you can bypass this warning.",
|
||||
"title": "Alexa Media Player - Unable to Connect to HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Yes, OTP code was verified"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHave you verified the OTP code in Amazon 2SV? \n >OTP Code: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmation"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"email": "Email Address",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"hass_url": "Local network URL to access Home Assistant",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"password": "Password",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"securitycode": "One-time password (OTP)",
|
||||
"should_get_network": "Discover Alexa network",
|
||||
"url": "Amazon region domain (e.g., amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "YAML configuration of Alexa Media Player is deprecated.\nPlease remove `alexa_media` from your configuration, restart Home Assistant and use the UI to configure it instead.\nSettings > Devices & services > Integrations > ADD INTEGRATION",
|
||||
"title": "YAML configuration is deprecated"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"should_get_network": "Discover Alexa network"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Required entry",
|
||||
"title": "Alexa Media Player - Reconfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Re-enables Alexa network discovery so the next polling cycle will rediscover Alexa devices for the selected accounts.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optional Alexa account email or list of emails. If empty, all known accounts will be refreshed.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Enable Network Discovery"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Force account to logout. Used mainly for debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Accounts to clear. Empty will clear all.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Force Logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Parses the history records for the specified device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to get the history for",
|
||||
"name": "Select media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Number of entries to get",
|
||||
"name": "Number of entries"
|
||||
}
|
||||
},
|
||||
"name": "Get History Records"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restore previous volume level on Alexa media player device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to restore the previous volume level on",
|
||||
"name": "Select media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restore Previous Volume"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forces update of last_called echo device for each Alexa account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Update Last Called Sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "The Forgot Password page was detected. This normally is the result of too many failed logins. Amazon may require action before a relogin can be attempted.",
|
||||
"login_failed": "Alexa Media Player failed to login.",
|
||||
"reauth_successful": "Alexa Media Player successfully reauthenticated. Please ignore the \"Aborted\" message from HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} is invalid",
|
||||
"connection_error": "Error connecting; check network and retry",
|
||||
"identifier_exists": "Email for Alexa URL already registered",
|
||||
"invalid_auth": "Login was not successful. Please double-check your email, password, and Authenticator key.",
|
||||
"invalid_credentials": "Invalid credentials",
|
||||
"invalid_url": "URL is invalid: {message}",
|
||||
"oauth_error": "Could not complete OAuth login. Please try again.",
|
||||
"unable_to_connect_hass_url": "Unable to connect to Home Assistant Local URL. Please check the URL under Settings > System > Network > Home Assistant URL > Local network",
|
||||
"unknown_error": "Unknown error: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore and Continue - I understand that no support for login issues are provided for bypassing this warning."
|
||||
},
|
||||
"description": "The HA server cannot connect to the URL provided: {hass_url}.\n> {error}\n\nTo fix this, please confirm your browser can reach {hass_url}. This field is from Settings > System > Network > Home Assistant URL.\n\nIf you are **certain** your browser can reach this URL, you can bypass this warning.",
|
||||
"title": "Alexa Media Player - Unable to Connect to HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Yes, OTP code was verified"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHave you verified the OTP code in Amazon 2SV? \n >OTP Code: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmation"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"email": "Email Address",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"hass_url": "Local network URL to access Home Assistant",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"password": "Password",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"securitycode": "One-time password (OTP)",
|
||||
"should_get_network": "Discover Alexa network",
|
||||
"url": "Amazon region domain (e.g., amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "YAML configuration of Alexa Media Player is deprecated.\nPlease remove `alexa_media` from your configuration, restart Home Assistant and use the UI to configure it instead.\nSettings > Devices & services > Integrations > ADD INTEGRATION",
|
||||
"title": "YAML configuration is deprecated"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"should_get_network": "Discover Alexa network"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Required entry",
|
||||
"title": "Alexa Media Player - Reconfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Re-enables Alexa network discovery so the next polling cycle will rediscover Alexa devices for the selected accounts.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optional Alexa account email or list of emails. If empty, all known accounts will be refreshed.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Enable Network Discovery"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Force account to logout. Used mainly for debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Accounts to clear. Empty will clear all.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Force Logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Parses the history records for the specified device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to get the history for",
|
||||
"name": "Select media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Number of entries to get",
|
||||
"name": "Number of entries"
|
||||
}
|
||||
},
|
||||
"name": "Get History Records"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restore previous volume level on Alexa media player device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to restore the previous volume level on",
|
||||
"name": "Select media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restore Previous Volume"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forces update of last_called echo device for each Alexa account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Update Last Called Sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "Die Seite 'Passwort vergessen' wurde erkannt. Dies ist normalerweise das Ergebnis zu vieler fehlgeschlagener Anmeldeversuche. Amazon könnte eine Aktion verlangen, bevor ein erneuter Login versucht werden kann.",
|
||||
"login_failed": "Alexa Media Player konnte nicht angemeldet werden.",
|
||||
"reauth_successful": "Alexa Media Player wurde erfolgreich neu authentifiziert. Bitte ignorieren Sie die Meldung „Abgebrochen“ von Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} ist ungültig",
|
||||
"connection_error": "Verbindungsfehler; Netzwerk prüfen und erneut versuchen",
|
||||
"identifier_exists": "Diese E-Mail-Adresse ist bereits registriert",
|
||||
"invalid_auth": "Die Anmeldung ist fehlgeschlagen. Bitte überprüfen Sie Ihre E-Mail-Adresse, Ihr Passwort und Ihren Authentifizierungsschlüssel.",
|
||||
"invalid_credentials": "Ungültige Zugangsdaten",
|
||||
"invalid_url": "URL ist ungültig: {message}",
|
||||
"oauth_error": "Die OAuth-Anmeldung konnte nicht abgeschlossen werden. Bitte versuchen Sie es erneut.",
|
||||
"unable_to_connect_hass_url": "Es konnte keine Verbindung zur lokalen Home Assistant-URL hergestellt werden. Bitte überprüfen Sie die URL unter Einstellungen > System > Netzwerk > Home Assistant-URL > Lokales Netzwerk.",
|
||||
"unknown_error": "Unbekannter Fehler: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignorieren und Fortfahren - Ich verstehe, dass keine Unterstützung für Anmeldeprobleme beim Umgehen dieser Warnung angeboten wird."
|
||||
},
|
||||
"description": "Der HA-Server kann keine Verbindung zur bereitgestellten URL herstellen: {hass_url}.\n> {error}\n\nUm dies zu beheben, bestätigen Sie bitte, dass Ihr **HA-Server** {hass_url} erreichen kann. Dieses Feld stammt aus der externen URL unter Konfiguration -> Allgemein, aber Sie können auch Ihre interne URL ausprobieren.\n\nWenn Sie **sicher** sind, dass Ihr Client diese URL erreichen kann, können Sie diese Warnung ignorieren und fortsetzen.",
|
||||
"title": "Alexa Media Player - Keine Verbindung zur Home Assistant-URL möglich"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Ja, der OTP-Code wurde verifiziert."
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHaben Sie erfolgreich einen OTP-Code aus dem integrierten 2FA-App-Schlüssel mit Amazon bestätigt?\n >OTP-Code {message}",
|
||||
"title": "Alexa Media Player - OTP-Bestätigung"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Erweitertes Debugging",
|
||||
"email": "E-Mail-Adresse",
|
||||
"exclude_devices": "oder Diese Geräte von allen ausschließen (durch Komma getrennt)",
|
||||
"extended_entity_discovery": "Fügen Sie zusätzliche Sensoren, Schalter und Leuchten hinzu.",
|
||||
"hass_url": "Lokale Netzwerk-URL für den Zugriff auf Home Assistant",
|
||||
"include_devices": "Eingebundene Geräte (Komma getrennt)",
|
||||
"otp_secret": "52-stelliger Authenticator-App Schlüssel für Amazon 2SV",
|
||||
"password": "Passwort",
|
||||
"public_url": "Öffentliche URL, die mit extern gehosteten Diensten geteilt wird",
|
||||
"queue_delay": "Verzögerung beim Zusammenführen mehrerer Befehle in einer Warteschlange (Sekunden)",
|
||||
"scan_interval": "Geplantes Abfrageintervall (Sekunden)",
|
||||
"securitycode": "Einmalpasswort (OTP)",
|
||||
"should_get_network": "Entdecken Sie das Alexa-Netzwerk",
|
||||
"url": "Amazon Region (z.B. amazon.de)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Ermöglicht eine sehr ausführliche Protokollierung auf Trace-Ebene für die erweiterte Fehlerbehebung. \n Aufgrund des erhöhten Protokollvolumens wird dies für den Normalbetrieb nicht empfohlen. \n Stellen Sie sicher, dass die Protokollierungsstufe auf DEBUG eingestellt ist, um die vollständige Ausgabe zu erhalten.",
|
||||
"otp_secret": "Beispiel: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Luftqualität"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Kohlenmonoxid"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Luftfeuchtigkeit"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Innenraumluftqualität"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Feinstaub"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Flüchtige organische Verbindungen"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Nächster Alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Nächste Erinnerung"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Nächster Timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatur"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Bitte nicht stören"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Wiederholen"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "Die YAML-Konfiguration des Alexa Media Players ist veraltet.\nBitte entfernen Sie `alexa_media` aus Ihrer Konfiguration, starten Sie Home Assistant neu und verwenden Sie stattdessen die Benutzeroberfläche zur Konfiguration.\nEinstellungen > Geräte & Dienste > Integrationen > INTEGRATION HINZUFÜGEN",
|
||||
"title": "Die YAML-Konfiguration ist veraltet"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Erweitertes Debugging",
|
||||
"exclude_devices": "oder diese Geräte von allen ausschließen (durch Komma getrennt)",
|
||||
"extended_entity_discovery": "Fügen Sie zusätzliche Sensoren, Schalter und Leuchten hinzu.",
|
||||
"include_devices": "Nur diese Geräte angeben (durch Komma getrennt)",
|
||||
"otp_secret": "52-stelliger Authenticator-App-Schlüssel für Amazon 2SV",
|
||||
"public_url": "Öffentliche URL, die mit extern gehosteten Diensten geteilt wird",
|
||||
"queue_delay": "Verzögerung beim Zusammenführen mehrerer Befehle in die Warteschlange (Sekunden)",
|
||||
"scan_interval": "Geplante Abfragehäufigkeit (Sekunden)",
|
||||
"should_get_network": "Entdecken Sie das Alexa-Netzwerk"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Ermöglicht eine sehr ausführliche Protokollierung auf Trace-Ebene für die erweiterte Fehlerbehebung. \n Aufgrund des erhöhten Protokollvolumens wird dies für den Normalbetrieb nicht empfohlen. \n Stellen Sie sicher, dass die Protokollierungsstufe auf DEBUG eingestellt ist, um die vollständige Ausgabe zu erhalten.",
|
||||
"otp_secret": "Beispiel: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Erforderliche Angabe",
|
||||
"title": "Alexa Media Player - Rekonfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Aktiviert die Alexa-Netzwerkerkennung erneut, sodass beim nächsten Abfragezyklus die Alexa-Geräte für die ausgewählten Konten erneut erkannt werden.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optionale E-Mail-Adresse oder Liste von E-Mail-Adressen Ihres Alexa-Kontos. Falls leer, werden alle bekannten Konten aktualisiert.",
|
||||
"name": "E-Mail-Adresse"
|
||||
}
|
||||
},
|
||||
"name": "Aktivieren Sie die Netzwerkerkennung"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Logout erzwingen. Primär für Debugging genutzt.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Zu löschende Accounts. Falls leer, werden alle gelöscht.",
|
||||
"name": "E-Mail-Adresse"
|
||||
}
|
||||
},
|
||||
"name": "Logout erzwingen"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analysiert die Verlaufsdatensätze für das angegebene Gerät",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entität, für die der Verlauf abgerufen werden soll",
|
||||
"name": "Mediaplayer auswählen:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Anzahl der abzurufenden Einträge",
|
||||
"name": "Anzahl der Einträge"
|
||||
}
|
||||
},
|
||||
"name": "Verlaufsdatensätze abrufen"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Vorherige Lautstärke auf dem Alexa-Mediaplayer-Gerät wiederherstellen",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entität zum Wiederherstellen der vorherigen Lautstärke auf",
|
||||
"name": "Mediaplayer auswählen:"
|
||||
}
|
||||
},
|
||||
"name": "Vorherige Lautstärke wiederherstellen"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Erzwingt eine Aktualisierung des zuletzt aufgerufenen Echo-Geräts für jedes Alexa-Konto.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Liste der zu aktualisierenden Alexa-Konten. Wenn leer, werden alle bekannten Konten aktualisiert.",
|
||||
"name": "E-Mail-Adresse"
|
||||
}
|
||||
},
|
||||
"name": "Aktualisiere den zuletzt aufgerufenen Sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "The Forgot Password page was detected. This normally is the result of too many failed logins. Amazon may require action before a relogin can be attempted.",
|
||||
"login_failed": "Alexa Media Player failed to login.",
|
||||
"reauth_successful": "Alexa Media Player successfully reauthenticated. Please ignore the \"Aborted\" message from HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} is invalid",
|
||||
"connection_error": "Error connecting; check network and retry",
|
||||
"identifier_exists": "Email for Alexa URL already registered",
|
||||
"invalid_auth": "Login was not successful. Please double-check your email, password, and Authenticator key.",
|
||||
"invalid_credentials": "Invalid credentials",
|
||||
"invalid_url": "URL is invalid: {message}",
|
||||
"oauth_error": "Could not complete OAuth login. Please try again.",
|
||||
"unable_to_connect_hass_url": "Unable to connect to Home Assistant Local URL. Please check the URL under Settings > System > Network > Home Assistant URL > Local network",
|
||||
"unknown_error": "Unknown error: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore and Continue - I understand that no support for login issues are provided for bypassing this warning."
|
||||
},
|
||||
"description": "The HA server cannot connect to the URL provided: {hass_url}.\n> {error}\n\nTo fix this, please confirm your browser can reach {hass_url}. This field is from Settings > System > Network > Home Assistant URL.\n\nIf you are **certain** your browser can reach this URL, you can bypass this warning.",
|
||||
"title": "Alexa Media Player - Unable to Connect to HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Yes, OTP code was verified"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHave you verified the OTP code in Amazon 2SV? \n >OTP Code: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmation"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"email": "Email Address",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"hass_url": "Local network URL to access Home Assistant",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"password": "Password",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"securitycode": "One-time password (OTP)",
|
||||
"should_get_network": "Discover Alexa network",
|
||||
"url": "Amazon region domain (e.g., amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "YAML configuration of Alexa Media Player is deprecated.\nPlease remove `alexa_media` from your configuration, restart Home Assistant and use the UI to configure it instead.\nSettings > Devices & services > Integrations > ADD INTEGRATION",
|
||||
"title": "YAML configuration is deprecated"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"should_get_network": "Discover Alexa network"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Required entry",
|
||||
"title": "Alexa Media Player - Reconfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Re-enables Alexa network discovery so the next polling cycle will rediscover Alexa devices for the selected accounts.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optional Alexa account email or list of emails. If empty, all known accounts will be refreshed.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Enable Network Discovery"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Force account to logout. Used mainly for debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Accounts to clear. Empty will clear all.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Force Logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Parses the history records for the specified device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to get the history for",
|
||||
"name": "Select media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Number of entries to get",
|
||||
"name": "Number of entries"
|
||||
}
|
||||
},
|
||||
"name": "Get History Records"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restore previous volume level on Alexa media player device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to restore the previous volume level on",
|
||||
"name": "Select media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restore Previous Volume"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forces update of last_called echo device for each Alexa account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Update Last Called Sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "Se detectó la página de Olvidé mi contraseña. Normalmente, esto es el resultado de demasiados intentos fallidos de inicio de sesión. Amazon puede requerir acción antes de que se pueda intentar iniciar sesión nuevamente.",
|
||||
"login_failed": "Alexa Media Player no pudo iniciar sesión.",
|
||||
"reauth_successful": "Alexa Media Player se volvió a autenticar con éxito. Ignore el mensaje \"Cancelado\" de HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} no es válido",
|
||||
"connection_error": "Error al conectar, verifique la red y vuelva a intentarlo",
|
||||
"identifier_exists": "Correo electrónico para la URL de Alexa ya registrado",
|
||||
"invalid_auth": "No se pudo iniciar sesión correctamente. Por favor, revise su correo electrónico, contraseña y clave de autenticación.",
|
||||
"invalid_credentials": "Credenciales no válidas",
|
||||
"invalid_url": "La URL no es válida: {message}",
|
||||
"oauth_error": "No se pudo completar el inicio de sesión de OAuth. Inténtalo de nuevo.",
|
||||
"unable_to_connect_hass_url": "No se puede conectar a la URL local de Home Assistant. Verifique la URL en Ajustes > Sistema > Red > URL de Home Assistant > Red local.",
|
||||
"unknown_error": "Error desconocido: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignorar y continuar: entiendo que no se proporciona soporte para problemas de inicio de sesión para eludir esta advertencia."
|
||||
},
|
||||
"description": "El servidor HA no puede conectarse a la URL proporcionada: {hass_url}.\n> {error}\n\nPara solucionar esto, confirme que su navegador pueda acceder a {hass_url}. Este campo se encuentra en Ajustes > Sistema > Red > URL de Home Assistant.\n\nSi está **seguro** de que su navegador puede acceder a esta URL, puede omitir esta advertencia.",
|
||||
"title": "Alexa Media Player: no se puede conectar a la URL de alta disponibilidad"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Sí, el código OTP fue verificado"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \n¿Has verificado el código OTP en Amazon 2SV?\n>Código OTP: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmación"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Depuración avanzada",
|
||||
"email": "Dirección de correo electrónico",
|
||||
"exclude_devices": "o Excluir estos dispositivos de todos (separados por comas)",
|
||||
"extended_entity_discovery": "Incluye sensores, interruptores y luces adicionales.",
|
||||
"hass_url": "URL de red local para acceder a Home Assistant",
|
||||
"include_devices": "Incluya solo estos dispositivos (separados por comas)",
|
||||
"otp_secret": "Clave de aplicación de autenticación de 52 caracteres para la verificación en dos pasos de Amazon",
|
||||
"password": "Contraseña",
|
||||
"public_url": "URL pública compartida con servicios alojados externos",
|
||||
"queue_delay": "Retraso para poner en cola varios comandos juntos (segundos)",
|
||||
"scan_interval": "Intervalo de sondeo programado (segundos)",
|
||||
"securitycode": "Contraseña de un solo uso (OTP)",
|
||||
"should_get_network": "Descubra la red Alexa",
|
||||
"url": "Región del dominio de Amazon (por ejemplo, amazon.es)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita un registro de nivel de seguimiento muy detallado para la resolución de problemas avanzada. \n No se recomienda para el funcionamiento normal debido al aumento del volumen de registro. \n Asegúrese de que los niveles del registrador estén configurados en DEBUG para obtener una salida completa.",
|
||||
"otp_secret": "Ejemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Calidad del aire"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Monóxido de carbono"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humedad"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Calidad del aire interior"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "materia particulada"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Compuestos orgánicos volátiles"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Próxima alarma"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Próximo recordatorio"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Próximo temporizador"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatura"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "No molestar"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repetir"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Barajar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "La configuración YAML de Alexa Media Player está obsoleta.\nElimina `alexa_media` de tu configuración, reinicia Home Assistant y usa la interfaz de usuario para configurarlo.\nAjustes > Dispositivos y servicios > Integraciones > AÑADIR INTEGRACIÓN",
|
||||
"title": "La configuración de YAML está obsoleta"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Depuración avanzada",
|
||||
"exclude_devices": "o Excluir estos dispositivos de todos (separados por comas)",
|
||||
"extended_entity_discovery": "Incluye sensores, interruptores y luces adicionales.",
|
||||
"include_devices": "Incluya solo estos dispositivos (separados por comas)",
|
||||
"otp_secret": "Clave de aplicación de autenticación de 52 caracteres para la verificación en dos pasos de Amazon",
|
||||
"public_url": "URL pública compartida con servicios alojados externos",
|
||||
"queue_delay": "Retraso para poner en cola varios comandos juntos (segundos)",
|
||||
"scan_interval": "Frecuencia de sondeo programada (segundos)",
|
||||
"should_get_network": "Descubra la red Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita un registro de nivel de seguimiento muy detallado para la resolución de problemas avanzada. \n No se recomienda para el funcionamiento normal debido al aumento del volumen de registro. \n Asegúrese de que los niveles del registrador estén configurados en DEBUG para obtener una salida completa.",
|
||||
"otp_secret": "Ejemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Entradas obligatorias",
|
||||
"title": "Alexa Media Player - Reconfiguración"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Vuelve a habilitar el descubrimiento de red de Alexa para que el próximo ciclo de sondeo redescubra los dispositivos Alexa para las cuentas seleccionadas.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Correo electrónico o lista de correos electrónicos de la cuenta de Alexa (opcional). Si está vacío, se actualizarán todas las cuentas conocidas.",
|
||||
"name": "Dirección de correo electrónico"
|
||||
}
|
||||
},
|
||||
"name": "Habilitar el descubrimiento de red"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Obligar el cierre de sesión de la cuenta. Usar principalmente para depuración.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Cuentas a borrar. Si se deja vacío se borraran todas.",
|
||||
"name": "Dirección de correo electrónico"
|
||||
}
|
||||
},
|
||||
"name": "Obligar cierre de sesión"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analiza los registros del historial del dispositivo especificado",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidad para obtener el historial",
|
||||
"name": "Seleccionar reproductor multimedia:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Número de entradas a obtener",
|
||||
"name": "Número de entradas"
|
||||
}
|
||||
},
|
||||
"name": "Obtener registros históricos"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restaurar el nivel de volumen anterior en el reproductor multimedia Alexa",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidad para restaurar el nivel de volumen anterior",
|
||||
"name": "Seleccionar reproductor multimedia:"
|
||||
}
|
||||
},
|
||||
"name": "Restaurar volumen anterior"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Obligar la actualización del último dispositivo Echo llamado para cada cuenta Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Cuentas de Alexa para actualizar. Si se deja vacío, se actualizaran todas las cuentas.",
|
||||
"name": "Dirección de correo electrónico"
|
||||
}
|
||||
},
|
||||
"name": "Actualizar el último sensor utilizado"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "La page de réinitialisation du mot de passe a été détectée. Cela résulte généralement de trop nombreuses tentatives de connexion échouées. Amazon peut exiger une action avant qu'une nouvelle connexion ne puisse être tentée.",
|
||||
"login_failed": "Alexa Media Player n'a pas réussi à se connecter.",
|
||||
"reauth_successful": "Alexa Media Player s'est ré-authentifié avec succès. Veuillez ignorer le message \"Abandonné\" de Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} n'est pas valide",
|
||||
"connection_error": "Erreur de connexion ; vérifiez le réseau et réessayez",
|
||||
"identifier_exists": "L'adresse e-mail pour cette URL Alexa est déjà enregistrée",
|
||||
"invalid_auth": "La connexion a échoué. Veuillez vérifier votre adresse e-mail, votre mot de passe et votre clé d'authentification.",
|
||||
"invalid_credentials": "Identifiants invalides",
|
||||
"invalid_url": "L'URL n'est pas valide: {message}",
|
||||
"oauth_error": "Impossible de terminer la connexion OAuth. Veuillez réessayer.",
|
||||
"unable_to_connect_hass_url": "Impossible de se connecter à l'URL locale de Home Assistant. Veuillez vérifier l'URL sous Paramètres > Système > Réseau > URL de Home Assistant > Réseau local",
|
||||
"unknown_error": "Erreur inconnue : {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignorer et continuer - Je comprends qu'aucune assistance pour les problèmes de connexion ne sera fournie si je contourne cet avertissement."
|
||||
},
|
||||
"description": "Le serveur Home Assistant ne peut pas se connecter à l'URL fournie : {hass_url}.\n> {error}\n\nPour résoudre ce problème, veuillez confirmer que votre navigateur peut atteindre {hass_url}. Ce champ provient de Paramètres > Système > Réseau > URL de Home Assistant.\n\nSi vous êtes **certain** que votre navigateur peut accéder à cette URL, vous pouvez ignorer cet avertissement.",
|
||||
"title": "Alexa Media Player - Impossible de se connecter à l'URL de HA"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Oui, le code OTP a été vérifié"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}**\nAvez-vous vérifié le code OTP dans la validation en deux étapes Amazon ?\n> Code OTP : {message}",
|
||||
"title": "Alexa Media Player - Confirmation OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Débogage avancé",
|
||||
"email": "Adresse e-mail",
|
||||
"exclude_devices": "ou Exclure ces appareils (séparés par des virgules)",
|
||||
"extended_entity_discovery": "Inclure les capteurs, interrupteurs et lumières additionnels",
|
||||
"hass_url": "URL du réseau local pour accéder à Home Assistant",
|
||||
"include_devices": "Inclure uniquement ces appareils (séparés par des virgules)",
|
||||
"otp_secret": "Clé d'authentification à 52 caractères pour Amazon 2SV",
|
||||
"password": "Mot de passe",
|
||||
"public_url": "URL publique partagée avec les services externes hébergés",
|
||||
"queue_delay": "Délai pour regrouper plusieurs commandes (secondes)",
|
||||
"scan_interval": "Intervalle d'interrogation programmé (secondes)",
|
||||
"securitycode": "Mot de passe à usage unique (OTP)",
|
||||
"should_get_network": "Découvrir le réseau Alexa",
|
||||
"url": "Domaine de la région Amazon (ex : amazon.fr)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Active une journalisation très détaillée, au niveau de la trace, pour un dépannage avancé. \n Non recommandé en fonctionnement normal en raison de l'augmentation du volume des journaux. \n Assurez-vous que le niveau de journalisation est défini sur DEBUG pour obtenir une sortie complète.",
|
||||
"otp_secret": "Exemple : 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "qualité de l'air"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Monoxyde de carbone"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidité"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "qualité de l'air intérieur"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Matières particulaires"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Composés organiques volatils"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Prochaine alarme"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Prochain rappel"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "La prochaine fois"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Température"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Ne pas déranger"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Répéter"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Mélanger"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "La configuration YAML d'Alexa Media Player est obsolète.\nVeuillez supprimer `alexa_media` de votre configuration, redémarrer Home Assistant et utiliser l'interface utilisateur pour la configurer à la place.\nParamètres > Appareils et services > Intégrations > AJOUTER UNE INTÉGRATION",
|
||||
"title": "La configuration YAML est obsolète"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Débogage avancé",
|
||||
"exclude_devices": "ou Exclure ces appareils (séparés par des virgules)",
|
||||
"extended_entity_discovery": "Inclure les capteurs, interrupteurs et lumières additionnels",
|
||||
"include_devices": "Inclure uniquement ces appareils (séparés par des virgules)",
|
||||
"otp_secret": "Clé d'authentification à 52 caractères pour Amazon 2SV",
|
||||
"public_url": "URL publique partagée avec les services externes hébergés",
|
||||
"queue_delay": "Délai pour regrouper plusieurs commandes (secondes)",
|
||||
"scan_interval": "Fréquence d'interrogation programmée (secondes)",
|
||||
"should_get_network": "Découvrir le réseau Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Active une journalisation très détaillée, au niveau de la trace, pour un dépannage avancé. \n Non recommandé en fonctionnement normal en raison de l'augmentation du volume des journaux. \n Assurez-vous que le niveau de journalisation est défini sur DEBUG pour obtenir une sortie complète.",
|
||||
"otp_secret": "Exemple : 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Champs obligatoires",
|
||||
"title": "Alexa Media Player - Reconfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Réactive la découverte du réseau Alexa afin que le prochain cycle d'interrogation redécouvre les appareils Alexa pour les comptes sélectionnés.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Adresse e-mail du compte Alexa ou liste d'adresses (facultatif). Si vide, tous les comptes connus seront actualisés.",
|
||||
"name": "Adresse email"
|
||||
}
|
||||
},
|
||||
"name": "Activer la découverte du réseau"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Force la déconnexion du compte. Utilisé principalement pour le débogage.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Comptes à effacer. Laisser vide effacera tous les comptes.",
|
||||
"name": "Adresse e-mail"
|
||||
}
|
||||
},
|
||||
"name": "Forcer la déconnexion"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analyse les enregistrements d'historique pour l'appareil spécifié.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entité pour laquelle obtenir l'historique",
|
||||
"name": "Sélectionner le lecteur multimédia:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Nombre d'entrées à récupérer",
|
||||
"name": "Nombre d'entrées"
|
||||
}
|
||||
},
|
||||
"name": "Obtenir les enregistrements d'historique"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restaure le niveau de volume précédent sur l'appareil Alexa Media Player.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entité sur laquelle restaurer le niveau de volume précédent",
|
||||
"name": "Sélectionner le lecteur multimédia:"
|
||||
}
|
||||
},
|
||||
"name": "Restaurer le volume précédent"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Force la mise à jour du dernier appareil Echo appelé pour chaque compte Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Liste des comptes Alexa à mettre à jour. Si vide, tous les comptes connus seront mis à jour.",
|
||||
"name": "Adresse e-mail"
|
||||
}
|
||||
},
|
||||
"name": "Mettre à jour le capteur du dernier appel"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "La pagina Password Dimenticata è stata rilevata. Questo normalmente è il risultato di troppi tentativi di accesso falliti. Amazon potrebbe richiedere un'azione prima di poter tentare nuovamente il login.",
|
||||
"login_failed": "Alexa Media Player ha fallito il login.",
|
||||
"reauth_successful": "Alexa Media Player è stato riautenticato con successo. Ignorare il messaggio \"Abortito\" da HA"
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} non è valido",
|
||||
"connection_error": "Errore durante la connessione; controlla la rete e riprova",
|
||||
"identifier_exists": "L'email per l'URL di Alexa è già stata registrata",
|
||||
"invalid_auth": "Accesso non riuscito. Controlla nuovamente la tua email, la password e la chiave di autenticazione.",
|
||||
"invalid_credentials": "Credenziali non valide",
|
||||
"invalid_url": "URL non valido: {message}",
|
||||
"oauth_error": "Impossibile completare l'accesso OAuth. Riprova.",
|
||||
"unable_to_connect_hass_url": "Impossibile connettersi all'URL locale di Home Assistant. Controllare l'URL in Impostazioni > Sistema > Rete > URL di Home Assistant > Rete locale",
|
||||
"unknown_error": "Errore sconosciuto: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignora e continua - capisco che non verrà fornito alcun supporto per i problemi di accesso derivanti dall'aggirare questo avviso."
|
||||
},
|
||||
"description": "Il server HA non riesce a connettersi all'URL fornito: {hass_url}.\n> {error}\n\nPer risolvere questo problema, verifica che il tuo browser possa raggiungere {hass_url}. Questo campo si trova in Impostazioni > Sistema > Rete > URL Home Assistant.\n\nSe sei **certo** che il tuo browser possa raggiungere questo URL, puoi ignorare questo avviso.",
|
||||
"title": "Alexa Media Player - Impossibile connettersi all'URL HA"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Sì, il codice OTP è stato verificato"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}**\nHai verificato il codice OTP in Amazon 2SV?\n>Codice OTP {message}",
|
||||
"title": "Alexa Media Player - Conferma OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Debug avanzato",
|
||||
"email": "Indirizzo email",
|
||||
"exclude_devices": "o Escludi questi dispositivi da tutti (separati da virgole)",
|
||||
"extended_entity_discovery": "Includere sensori, interruttori e luci aggiuntivi",
|
||||
"hass_url": "URL della rete locale per accedere a Home Assistant",
|
||||
"include_devices": "Includi solo questi dispositivi (separati da virgole)",
|
||||
"otp_secret": "Chiave da 52 caratteri dell'app Authenticator per il 2SV di Amazon",
|
||||
"password": "Password",
|
||||
"public_url": "URL pubblico condiviso con servizi ospitati esterni",
|
||||
"queue_delay": "Ritardo per mettere in coda più comandi contemporaneamente (secondi)",
|
||||
"scan_interval": "Frequenza di sondaggio pianificata (secondi)",
|
||||
"securitycode": "Password monouso (OTP)",
|
||||
"should_get_network": "Scopri la rete Alexa",
|
||||
"url": "Regione del dominio Amazon (ad es., amazon.it)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Abilita la registrazione molto dettagliata a livello di traccia per la risoluzione avanzata dei problemi. \n Non consigliato per il normale funzionamento a causa dell'aumento del volume di registro. \n Assicurarsi che i livelli del logger siano impostati su DEBUG per un output completo.",
|
||||
"otp_secret": "Esempio: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Qualità dell'aria"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "monossido di carbonio"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Umidità"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Qualità dell'aria interna"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "particolato"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Composti organici volatili"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Prossimo allarme"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Prossimo promemoria"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Prossimo timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatura"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Non disturbare"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Ripetere"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Mescolare"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "La configurazione YAML di Alexa Media Player è obsoleta.\nRimuovi `alexa_media` dalla configurazione, riavvia Home Assistant e utilizza l'interfaccia utente per configurarla.\nImpostazioni > Dispositivi e servizi > Integrazioni > AGGIUNGI INTEGRAZIONE",
|
||||
"title": "La configurazione YAML è deprecata"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Debug avanzato",
|
||||
"exclude_devices": "o Escludi questi dispositivi da tutti (separati da virgole)",
|
||||
"extended_entity_discovery": "Includere sensori, interruttori e luci aggiuntivi",
|
||||
"include_devices": "Includi solo questi dispositivi (separati da virgole)",
|
||||
"otp_secret": "Chiave da 52 caratteri dell'app Authenticator per il 2SV di Amazon",
|
||||
"public_url": "URL pubblico condiviso con servizi ospitati esterni",
|
||||
"queue_delay": "Ritardo per mettere in coda più comandi contemporaneamente (secondi)",
|
||||
"scan_interval": "Frequenza di sondaggio pianificata (secondi)",
|
||||
"should_get_network": "Scopri la rete Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Abilita la registrazione molto dettagliata a livello di traccia per la risoluzione avanzata dei problemi. \n Non consigliato per il normale funzionamento a causa dell'aumento del volume di registro. \n Assicurarsi che i livelli del logger siano impostati su DEBUG per un output completo.",
|
||||
"otp_secret": "Esempio: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Voci obbligatorie",
|
||||
"title": "Alexa Media Player - Riconfigurazione"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Riattiva la rilevazione della rete Alexa in modo che il successivo ciclo di sondaggio rilevi i dispositivi Alexa per gli account selezionati.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Indirizzo email dell'account Alexa facoltativo o elenco d'indirizzi email. Se vuoto, tutti gli account noti verranno aggiornati.",
|
||||
"name": "Indirizzo email"
|
||||
}
|
||||
},
|
||||
"name": "Abilita rilevamento rete"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Forza logout dell'account. Usato principalmente per il debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Account da eliminare. Se vuoto, verranno cancellati tutti.",
|
||||
"name": "Indirizzo email"
|
||||
}
|
||||
},
|
||||
"name": "Forza Logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analizza i record cronologici per il dispositivo specificato",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entità per cui ottenere la cronologia",
|
||||
"name": "Seleziona lettore multimediale:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Numero di voci da ottenere",
|
||||
"name": "Numero di voci"
|
||||
}
|
||||
},
|
||||
"name": "Ottieni i record della cronologia"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Ripristina il livello del volume precedente sul dispositivo lettore multimediale Alexa",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entità per ripristinare il livello del volume precedente",
|
||||
"name": "Seleziona lettore multimediale:"
|
||||
}
|
||||
},
|
||||
"name": "Ripristina il volume precedente"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forza l'aggiornamento del dispositivo echo last_called per ogni account Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Lista di account Alexa da aggiornare. Se vuoto, verranno aggiornati tutti.",
|
||||
"name": "Indirizzo email"
|
||||
}
|
||||
},
|
||||
"name": "Aggiorna sensore last_called"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "「パスワードを忘れた場合」ページが検出されました。これは通常、ログインに何度も失敗した結果です。Amazonでは、再ログインを試みる前に対応を求める場合があります。",
|
||||
"login_failed": "Alexa Media Playerがログインに失敗しました。",
|
||||
"reauth_successful": "Alexa Media Playerは正常に再認証されました。Home Assistant からの \"Aborted\" メッセージは無視してください。"
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} は無効な認証アプリキーです",
|
||||
"connection_error": "接続エラー:ネットワークを確認して再試行してください",
|
||||
"identifier_exists": "Alexa URLに対するメールアドレスはすでに登録されています",
|
||||
"invalid_auth": "ログインに失敗しました。メールアドレス、パスワード、認証キーを再度ご確認ください。",
|
||||
"invalid_credentials": "無効な資格情報",
|
||||
"invalid_url": "URL が無効です:{message}",
|
||||
"oauth_error": "OAuthログインを完了できませんでした。もう一度お試しください。",
|
||||
"unable_to_connect_hass_url": "Home Assistant URL に接続できません。[設定] -> [全般] の [外部 URL] を確認してください。",
|
||||
"unknown_error": "不明なエラー:{message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "無視して続行 - この警告を回避することで、ログイン問題に関するサポートはされないことを承知しています。"
|
||||
},
|
||||
"description": "Home Assistant サーバーへ、指定された URL {hass_url}で接続できません。 \n> {error}\n\nこの問題を解決するには、あなたのHome Assistant サーバーに{hass_url}でアクセスできることを確認してください。このフィールドは、[設定] -> [全般] の [外部 URL] からのものですが、内部 URL を試すこともできます。クライアントがこの URL にアクセスできることが 確実であれば、この警告をバイパスできます。",
|
||||
"title": "Alexa Media Player - Home Assistant URLに接続できません"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "はい、OTP コードを確認しました。"
|
||||
},
|
||||
"description": "** {email} - alexa. {url} **\nAmazon 2段階認証で OTPコードを確認しましたか? \n>OTP コード: {message}",
|
||||
"title": "Alexa Media Player - OTP の確認"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "高度なデバッグ",
|
||||
"email": "メールアドレス",
|
||||
"exclude_devices": "除外するデバイス(カンマ区切り)",
|
||||
"extended_entity_discovery": "Echo経由で接続されたデバイスを含める",
|
||||
"hass_url": "Home AssistantにアクセスするためのURL",
|
||||
"include_devices": "含まれるデバイス(カンマ区切り)",
|
||||
"otp_secret": "Amazon 2段階認証用認証アプリキー(52桁)",
|
||||
"password": "パスワード",
|
||||
"public_url": "外部ホスティング・サービスと共有される公開URL",
|
||||
"queue_delay": "コマンドをキューにまとめて待機させる秒数",
|
||||
"scan_interval": "スキャン間隔秒数",
|
||||
"securitycode": "[%key_id:55616596%]",
|
||||
"should_get_network": "Alexaネットワークを探索",
|
||||
"url": "Amazon 地域ドメイン (例: amazon.co.jp)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "Alexa Media PlayerのYAML設定は非推奨であり、バージョン4.14.0で削除される予定です。 この設定の自動インポートは行われません。 設定から削除し、Home Assistantを再起動して、代わりにUIを使用して設定してください。 [設定] -> [デバイスとサービス] -> [統合] -> [統合を追加]",
|
||||
"title": "YAML設定は非推奨です"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "高度なデバッグ",
|
||||
"exclude_devices": "除外するデバイス(カンマ区切り)",
|
||||
"extended_entity_discovery": "Alexaデバイスに接続された追加のセンサー、スイッチ、ライトを含める",
|
||||
"include_devices": "含まれるデバイス(カンマ区切り)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Home Assistant にアクセスするための公開URL (末尾の '/' を含む)",
|
||||
"queue_delay": "コマンドをキューにまとめて待機させる秒数",
|
||||
"scan_interval": "スキャン間隔秒数",
|
||||
"should_get_network": "Alexaネットワークを探索"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* 必須エントリ\n注: **拡張エンティティ検出** を使用するには、**Alexa ネットワークの探索** を有効にする必要があります。",
|
||||
"title": "Alexa Media Player - 再設定"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Alexa ネットワーク検出を再度有効にすると、次のポーリングサイクルで、選択したアカウントの Alexa デバイスが再検出されます。",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "オプションのalexaアカウントのメールアドレスまたはメールアドレスのリスト。空の場合、すべての既知のアカウントが更新されます。",
|
||||
"name": "Emailアドレス"
|
||||
}
|
||||
},
|
||||
"name": "ネットワーク探索を有効にする"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "アカウントを強制的にログアウトさせます (主にデバッグに使用します)",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "削除するアカウント 空にするとすべて削除されます",
|
||||
"name": "メールアドレス"
|
||||
}
|
||||
},
|
||||
"name": "強制ログアウト"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "指定したデバイスの履歴レコードを解析します",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "履歴を取得するエンティティ",
|
||||
"name": "メディアプレーヤーを選択:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "取得するエントリー数",
|
||||
"name": "エントリー数"
|
||||
}
|
||||
},
|
||||
"name": "履歴レコードを取得する"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Alexaメディアプレーヤーデバイスで以前の音量レベルを復元する",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "以前の音量レベルを復元するエンティティ",
|
||||
"name": "メディアプレーヤーを選択:"
|
||||
}
|
||||
},
|
||||
"name": "以前のボリュームを復元"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "各Alexaアカウントの最後に呼び出されたEchoデバイスを強制的に更新します。",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "更新する Alexa アカウントの一覧。空の場合、既知のすべてのアカウントが更新されます。",
|
||||
"name": "メールアドレス"
|
||||
}
|
||||
},
|
||||
"name": "最後に呼び出されたセンサーを更新"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "Glemt passord-siden ble oppdaget. Dette er vanligvis et resultat av for mange mislykkede påloggingsforsøk. Amazon kan kreve at du gjør noe før du kan prøve å logge inn igjen.",
|
||||
"login_failed": "Alexa Media Player kunne ikke logge inn.",
|
||||
"reauth_successful": "Alexa Media Player er autentisert på nytt. Vennligst ignorer meldingen «Avbrutt» fra HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} er ugyldig",
|
||||
"connection_error": "Feil ved tilkobling; sjekk nettverket og prøv på nytt",
|
||||
"identifier_exists": "E-post for Alexa URL allerede registrert",
|
||||
"invalid_auth": "Innloggingen mislyktes. Dobbeltsjekk e-post, passord og autentiseringsnøkkel.",
|
||||
"invalid_credentials": "ugyldige legitimasjon",
|
||||
"invalid_url": "URL er ugyldig: {message}",
|
||||
"oauth_error": "Kunne ikke fullføre OAuth-pålogging. Prøv på nytt.",
|
||||
"unable_to_connect_hass_url": "Kan ikke koble til den lokale URL-adressen for Home Assistant. Sjekk URL-adressen under Innstillinger > System > Nettverk > URL for Home Assistant > Lokalt nettverk",
|
||||
"unknown_error": "Ukjent feil: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignorer og fortsett – jeg forstår at det ikke gis støtte for innloggingsproblemer når denne advarselen omgås."
|
||||
},
|
||||
"description": "HA-serveren kan ikke koble til den oppgitte URL-en: {hass_url}.\n> {error}\n\nFor å fikse dette, må du bekrefte at nettleseren din kan nå {hass_url}. Dette feltet er fra Innstillinger > System > Nettverk > URL-adresse for Home Assistant.\n\nHvis du er **sikker** på at nettleseren din kan nå denne URL-en, kan du omgå denne advarselen.",
|
||||
"title": "Alexa Media Player – Kan ikke koble til HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Ja, engangskoden ble bekreftet"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHar du bekreftet engangskoden i Amazon 2SV?\n >OTP Kode {message}",
|
||||
"title": "Alexa Media Player - OTP bekreftelse"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Avansert feilsøking",
|
||||
"email": "Epostadresse",
|
||||
"exclude_devices": "eller Ekskluder disse enhetene fra alle (kommaseparert)",
|
||||
"extended_entity_discovery": "Inkluder ekstra sensorer, brytere og lys",
|
||||
"hass_url": "URL-adresse for lokalt nettverk for å få tilgang til Home Assistant",
|
||||
"include_devices": "Inkluder bare disse enhetene (kommaseparert)",
|
||||
"otp_secret": "52-tegns nøkkel fra autentiseringsappen for Amazon 2SV",
|
||||
"password": "Passord",
|
||||
"public_url": "Offentlig URL delt med eksterne vertsbaserte tjenester",
|
||||
"queue_delay": "Forsinkelse for å sette flere kommandoer sammen i kø (sekunder)",
|
||||
"scan_interval": "Planlagt avstemningsintervall (sekunder)",
|
||||
"securitycode": "Engangspassord (OTP)",
|
||||
"should_get_network": "Oppdag Alexa-nettverket",
|
||||
"url": "Amazon-regiondomenet (f.eks. Amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Muliggjør svært detaljert logging på spornivå for avansert feilsøking. \n Anbefales ikke for normal drift på grunn av økt loggvolum. \n Sørg for at loggnivåene er satt til DEBUG for full utdata.",
|
||||
"otp_secret": "Eksempel: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Luftkvalitet"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Karbonmonoksid"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Fuktighet"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Innendørs luftkvalitet"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Partikkelformet materiale"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Flyktige organiske forbindelser"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Neste alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Neste påminnelse"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Neste timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatur"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Ikke forstyrr"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Gjenta"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Bland"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "YAML-konfigurasjonen av Alexa Media Player er utdatert.\nFjern `alexa_media` fra konfigurasjonen din, start Home Assistant på nytt og bruk brukergrensesnittet til å konfigurere den i stedet.\nInnstillinger > Enheter og tjenester > Integrasjoner > LEGG TIL INTEGRASJON",
|
||||
"title": "YAML-konfigurasjonen er utdatert"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Avansert feilsøking",
|
||||
"exclude_devices": "eller Ekskluder disse enhetene fra alle (kommaseparert)",
|
||||
"extended_entity_discovery": "Inkluder ekstra sensorer, brytere og lys",
|
||||
"include_devices": "Inkluder bare disse enhetene (kommaseparert)",
|
||||
"otp_secret": "52-tegns nøkkel fra autentiseringsappen for Amazon 2SV",
|
||||
"public_url": "Offentlig URL delt med eksterne vertsbaserte tjenester",
|
||||
"queue_delay": "Forsinkelse for å sette flere kommandoer sammen i kø (sekunder)",
|
||||
"scan_interval": "Planlagt avstemningsfrekvens (sekunder)",
|
||||
"should_get_network": "Oppdag Alexa-nettverket"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Muliggjør svært detaljert logging på spornivå for avansert feilsøking. \n Anbefales ikke for normal drift på grunn av økt loggvolum. \n Sørg for at loggnivåene er satt til DEBUG for full utdata.",
|
||||
"otp_secret": "Eksempel: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Obligatoriske oppføringer",
|
||||
"title": "Alexa Media Player – Rekonfigurasjon"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Aktiverer Alexa-nettverksoppdagelse på nytt, slik at neste avstemningssyklus vil oppdage Alexa-enheter på nytt for de valgte kontoene.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Valgfri e-postadresse for Alexa-kontoen eller liste over e-postadresser. Hvis tom, vil alle kjente kontoer bli oppdatert.",
|
||||
"name": "E-postadresse"
|
||||
}
|
||||
},
|
||||
"name": "Aktiver nettverksoppdagelse"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Tving kontoen til å logge ut. Brukes hovedsakelig til feilsøking.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Kontoer som skal tømmes. Tøm vil tømme alle.",
|
||||
"name": "E-postadresse"
|
||||
}
|
||||
},
|
||||
"name": "Tving utlogging"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analyserer historikkpostene for den angitte enheten",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entitet å hente historien for",
|
||||
"name": "Velg mediespiller:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Antall oppføringer å få",
|
||||
"name": "Antall oppføringer"
|
||||
}
|
||||
},
|
||||
"name": "Få historikk"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Gjenopprett forrige volumnivå på Alexa mediespillerenhet",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entitet for å gjenopprette forrige volumnivå på",
|
||||
"name": "Velg mediespiller:"
|
||||
}
|
||||
},
|
||||
"name": "Gjenopprett forrige volum"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Tvinger frem oppdatering av sist oppringte echo-enhet for hver Alexa-konto.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Liste over Alexa-kontoer som skal oppdateres. Hvis tom, oppdateres alle kjente kontoer.",
|
||||
"name": "E-postadresse"
|
||||
}
|
||||
},
|
||||
"name": "Oppdater sist oppringte sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "De pagina 'Wachtwoord vergeten' is gedetecteerd. Dit is meestal het gevolg van te veel mislukte inlogpogingen. Amazon kan actie vereisen voordat opnieuw kan worden ingelogd.",
|
||||
"login_failed": "Het inloggen van Alexa Mediaspeler is mislukt.",
|
||||
"reauth_successful": "Alexa Mediaspeler is met succes opnieuw geverifieerd. Negeer a.u.b. het bericht \"Afgebroken\" van HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} is ongeldig",
|
||||
"connection_error": "Fout bij verbinding; controleer netwerk en probeer opnieuw",
|
||||
"identifier_exists": "E-mailadres voor Alexa-URL is al geregistreerd",
|
||||
"invalid_auth": "Inloggen is mislukt. Controleer uw e-mailadres, wachtwoord en Authenticator-sleutel nogmaals.",
|
||||
"invalid_credentials": "Ongeldige inloggegevens",
|
||||
"invalid_url": "De URL is ongeldig: {message}",
|
||||
"oauth_error": "OAuth-aanmelding kon niet worden voltooid. Probeer het opnieuw.",
|
||||
"unable_to_connect_hass_url": "Kan geen verbinding maken met de lokale Home Assistant-URL. Controleer de URL onder Instellingen > Systeem > Netwerk > Home Assistant-URL > Lokaal netwerk.",
|
||||
"unknown_error": "Onbekende fout: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Negeren en doorgaan - Ik begrijp dat er geen ondersteuning wordt geboden bij inlogproblemen wanneer ik deze waarschuwing omzeil."
|
||||
},
|
||||
"description": "De HA server kan geen verbinding maken met de opgegeven URL: {hass_url}.\n> {error}\n\nOm dit op te lossen, controleer of uw browser {hass_url} kan bereiken. Dit veld vindt u in Instellingen > Systeem > Netwerk > Home Assistant-URL.\n\nAls u er **zeker van bent** dat uw browser deze URL kan bereiken, kunt u deze waarschuwing negeren.",
|
||||
"title": "Alexa Mediaspeler - Kan geen verbinding maken met HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Ja, de OTP-code is geverifieerd."
|
||||
},
|
||||
"description": "**{email} - alexa.{url}**\nHeb je met succes een OTP van de ingebouwde 2FA App Key met Amazon bevestigd? \n >OTP-code {message}",
|
||||
"title": "Alexa Mediaspeler - OTP Bevestiging"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Geavanceerde foutopsporing",
|
||||
"email": "E-mailadres",
|
||||
"exclude_devices": "of Sluit deze apparaten uit van alles (gescheiden door komma's)",
|
||||
"extended_entity_discovery": "Voeg extra sensoren, schakelaars en lampen toe.",
|
||||
"hass_url": "Lokale netwerk-URL om toegang te krijgen tot Home Assistant",
|
||||
"include_devices": "Vermeld alleen deze apparaten (gescheiden door komma's)",
|
||||
"otp_secret": "52-karakter Authenticator-appsleutel voor Amazon 2SV",
|
||||
"password": "Wachtwoord",
|
||||
"public_url": "Openbare URL gedeeld met externe hostingdiensten",
|
||||
"queue_delay": "Vertraging om meerdere opdrachten tegelijk in de wachtrij te plaatsen (seconden)",
|
||||
"scan_interval": "Gepland pollinginterval (seconden)",
|
||||
"securitycode": "Eenmalig wachtwoord (OTP)",
|
||||
"should_get_network": "Ontdek het Alexa-netwerk",
|
||||
"url": "Domeinnaam van Amazon regio (bijv: amazon.nl)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Schakelt zeer gedetailleerde logboekregistratie op traceniveau in voor geavanceerde probleemoplossing. \n Niet aanbevolen voor normaal gebruik vanwege het toegenomen logvolume. \n Zorg ervoor dat de logniveaus zijn ingesteld op DEBUG voor volledige uitvoer.",
|
||||
"otp_secret": "Voorbeeld: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Luchtkwaliteit"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Koolmonoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Vochtigheid"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Binnenluchtkwaliteit"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Fijnstof"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Vluchtige organische verbindingen"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Volgende alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Volgende herinnering"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Volgende keer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatuur"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Niet storen"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Herhalen"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Schudden"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "De YAML-configuratie van Alexa Media Player is verouderd.\n\nVerwijder `alexa_media` uit uw configuratie, herstart Home Assistant en gebruik in plaats daarvan de gebruikersinterface om het te configureren.\n\nInstellingen > Apparaten en services > Integraties > INTEGRATIE TOEVOEGEN",
|
||||
"title": "YAML-configuratie is verouderd"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Geavanceerde foutopsporing",
|
||||
"exclude_devices": "of Sluit deze apparaten uit van alles (gescheiden door komma's)",
|
||||
"extended_entity_discovery": "Voeg extra sensoren, schakelaars en lampen toe",
|
||||
"include_devices": "Vermeld alleen deze apparaten (gescheiden door komma's)",
|
||||
"otp_secret": "52-karakter Authenticator-appsleutel voor Amazon 2SV",
|
||||
"public_url": "Openbare URL gedeeld met externe hostingdiensten",
|
||||
"queue_delay": "Vertraging om meerdere opdrachten tegelijk in de wachtrij te plaatsen (seconden)",
|
||||
"scan_interval": "Geplande pollingfrequentie (seconden)",
|
||||
"should_get_network": "Ontdek het Alexa-netwerk"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Schakelt zeer gedetailleerde logboekregistratie op traceniveau in voor geavanceerde probleemoplossing. \n Niet aanbevolen voor normaal gebruik vanwege het toegenomen logvolume. \n Zorg ervoor dat de logniveaus zijn ingesteld op DEBUG voor volledige uitvoer.",
|
||||
"otp_secret": "Voorbeeld: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Vereiste invoer",
|
||||
"title": "Alexa Mediaspeler - Herconfiguratie"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Hiermee wordt de Alexa-netwerkdetectie opnieuw ingeschakeld, zodat de volgende pollingcyclus Alexa-apparaten voor de geselecteerde accounts opnieuw kan detecteren.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optioneel Alexa-account-e-mailadres of lijst met e-mailadressen. Indien leeg, worden alle bekende accounts vernieuwd.",
|
||||
"name": "E-mailadres"
|
||||
}
|
||||
},
|
||||
"name": "Schakel netwerkdetectie in"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Forceer account om uit te loggen. Voornamelijk gebruikt voor foutopsporing.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Te vereffenen accounts. Leegmaken zal alles wissen.",
|
||||
"name": "E-mailadres"
|
||||
}
|
||||
},
|
||||
"name": "Uitloggen forceren"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analyseert de geschiedenisrecords voor het opgegeven apparaat",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entiteit om de geschiedenis op te halen",
|
||||
"name": "Selecteer mediaspeler:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Aantal inzendingen om te krijgen",
|
||||
"name": "Aantal inzendingen"
|
||||
}
|
||||
},
|
||||
"name": "Geschiedenisrecords ophalen"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Herstel het vorige volumeniveau op het Alexa-mediaspelerapparaat",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entiteit om het vorige volumeniveau te herstellen op",
|
||||
"name": "Selecteer mediaspeler:"
|
||||
}
|
||||
},
|
||||
"name": "Vorig volume herstellen"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forceert update van last_called echo apparaat voor elk Alexa-account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Lijst met Alexa accounts om bij te werken. Als het veld leeg is, worden alle bekende accounts bijgewerkt.",
|
||||
"name": "E-mailadres"
|
||||
}
|
||||
},
|
||||
"name": "Laatst opgeroepen sensor bijwerken"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "Wykryto stronę „Zapomniałem hasła”. Zwykle jest to spowodowane zbyt wieloma nieudanymi próbami logowania. Amazon może wymagać podjęcia działań, zanim będzie można ponownie spróbować zalogować się.",
|
||||
"login_failed": "Alexa Media Player nie może się zalogować.",
|
||||
"reauth_successful": "Odtwarzacz multimedialny Alexa pomyślnie przeszedł ponowne uwierzytelnienie. Proszę zignorować komunikat „Przerwano” od HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} jest nieprawidłowy",
|
||||
"connection_error": "Błąd podczas łączenia; sprawdź sieć i spróbuj ponownie",
|
||||
"identifier_exists": "Adres e-mail dla Alexy już jest zarejestrowany",
|
||||
"invalid_auth": "Logowanie nie powiodło się. Sprawdź ponownie swój adres e-mail, hasło i klucz uwierzytelniający.",
|
||||
"invalid_credentials": "Nieprawidłowe dane logowania",
|
||||
"invalid_url": "URL jest nieprawidłowy: {message}",
|
||||
"oauth_error": "Nie udało się dokończyć logowania OAuth. Spróbuj ponownie.",
|
||||
"unable_to_connect_hass_url": "Nie można połączyć się z lokalnym adresem URL Home Assistant. Sprawdź adres URL w Ustawieniach > System > Sieć > Adres URL Home Assistant > Sieć lokalna.",
|
||||
"unknown_error": "Nieznany błąd: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignoruj i kontynuuj – rozumiem, że nie jest zapewniane wsparcie dla problemów z logowaniem wynikających z obejścia tego ostrzeżenia."
|
||||
},
|
||||
"description": "Serwer HA nie może połączyć się z podanym adresem URL: {hass_url}.\n> {error}\n\nAby rozwiązać ten problem, upewnij się, że Twoja przeglądarka może uzyskać dostęp do adresu {hass_url}. To pole znajduje się w Ustawieniach > System > Sieć > Adres URL Asystenta Domowego.\n\nJeśli masz **pewność**, że Twoja przeglądarka może uzyskać dostęp do tego adresu URL, możesz pominąć to ostrzeżenie.",
|
||||
"title": "Alexa Media Player – nie można połączyć się z adresem URL HA"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Tak, kod OTP został zweryfikowany"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nCzy zweryfikowałeś kod OTP w Amazon 2SV?\n>Kod OTP: {message}",
|
||||
"title": "Alexa Media Player - Potwierdzanie hasła jednorazowego"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Zaawansowane debugowanie",
|
||||
"email": "Adres e-mail",
|
||||
"exclude_devices": "lub Wyklucz te urządzenia ze wszystkich (rozdzielone przecinkami)",
|
||||
"extended_entity_discovery": "Dodaj dodatkowe czujniki, przełączniki i światła",
|
||||
"hass_url": "Lokalny adres URL sieciowy umożliwiający dostęp do Home Assistant",
|
||||
"include_devices": "Uwzględnij tylko te urządzenia (rozdzielone przecinkami)",
|
||||
"otp_secret": "52-znakowy klucz aplikacji uwierzytelniającej dla Amazon 2SV",
|
||||
"password": "Hasło",
|
||||
"public_url": "Publiczny adres URL udostępniany zewnętrznym usługom hostowanym",
|
||||
"queue_delay": "Opóźnienie w kolejkowaniu wielu poleceń (sekundy)",
|
||||
"scan_interval": "Zaplanowany interwał sondowania (sekundy)",
|
||||
"securitycode": "Jednorazowe hasło (OTP)",
|
||||
"should_get_network": "Odkryj sieć Alexa",
|
||||
"url": "Region/domena Amazon (np. amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Włącza bardzo szczegółowe rejestrowanie na poziomie śledzenia w celu zaawansowanego rozwiązywania problemów. \n Niezalecane do normalnego użytkowania ze względu na zwiększoną objętość dziennika. \n Upewnij się, że poziomy rejestratora są ustawione na DEBUG, aby uzyskać pełny wynik.",
|
||||
"otp_secret": "Przykład: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Jakość powietrza"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Tlenek węgla"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Wilgotność"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Jakość powietrza w pomieszczeniach"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Cząstki stałe"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Lotne związki organiczne"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Następny alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Następne przypomnienie"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Następnym razem"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatura"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Nie przeszkadzać"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Powtarzać"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Odtwarzanie losowe"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "Konfiguracja YAML odtwarzacza multimedialnego Alexa jest przestarzała.\nUsuń „alexa_media” z konfiguracji, uruchom ponownie Asystenta Domowego i skonfiguruj go za pomocą interfejsu użytkownika.\nUstawienia > Urządzenia i usługi > Integracje > DODAJ INTEGRACJĘ",
|
||||
"title": "Konfiguracja YAML jest przestarzała"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Zaawansowane debugowanie",
|
||||
"exclude_devices": "lub Wyklucz te urządzenia ze wszystkich (rozdzielone przecinkami)",
|
||||
"extended_entity_discovery": "Dodaj dodatkowe czujniki, przełączniki i światła",
|
||||
"include_devices": "Uwzględnij tylko te urządzenia (rozdzielone przecinkami)",
|
||||
"otp_secret": "52-znakowy klucz aplikacji uwierzytelniającej dla Amazon 2SV",
|
||||
"public_url": "Publiczny adres URL udostępniany zewnętrznym usługom hostowanym",
|
||||
"queue_delay": "Opóźnienie w kolejkowaniu wielu poleceń (sekundy)",
|
||||
"scan_interval": "Interwał skanowania (sekundy)",
|
||||
"should_get_network": "Odkryj sieć Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Włącza bardzo szczegółowe rejestrowanie na poziomie śledzenia w celu zaawansowanego rozwiązywania problemów. \n Niezalecane do normalnego użytkowania ze względu na zwiększoną objętość dziennika. \n Upewnij się, że poziomy rejestratora są ustawione na DEBUG, aby uzyskać pełny wynik.",
|
||||
"otp_secret": "Przykład: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Wymagane wpisy",
|
||||
"title": "Odtwarzacz multimedialny Alexa – rekonfiguracja"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Ponownie włącza wykrywanie sieci Alexa, dzięki czemu kolejny cykl sondowania ponownie wykryje urządzenia Alexa dla wybranych kont.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Opcjonalny adres e-mail konta Alexa lub lista adresów e-mail. Jeśli jest pusty, wszystkie znane konta zostaną odświeżone.",
|
||||
"name": "Adres e-mail"
|
||||
}
|
||||
},
|
||||
"name": "Włącz wykrywanie sieci"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Wymuś wylogowanie z konta. Używane głównie do debugowania.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Konta do wyczyszczenia. Opcja „Opróżnij” wyczyści wszystkie konta.",
|
||||
"name": "Adres e-mail"
|
||||
}
|
||||
},
|
||||
"name": "Wymuś wylogowanie"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analizuje zapisy historii dla określonego urządzenia",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Podmiot, dla którego ma zostać pobrana historia",
|
||||
"name": "Wybierz odtwarzacz multimedialny:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Liczba wpisów do uzyskania",
|
||||
"name": "Liczba wpisów"
|
||||
}
|
||||
},
|
||||
"name": "Pobierz zapisy historyczne"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Przywróć poprzedni poziom głośności na urządzeniu z odtwarzaczem multimedialnym Alexa",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Podmiot przywracający poprzedni poziom głośności",
|
||||
"name": "Wybierz odtwarzacz multimedialny:"
|
||||
}
|
||||
},
|
||||
"name": "Przywróć poprzednią głośność"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Wymusza aktualizację ostatnio używanego urządzenia echo dla każdego konta Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Lista kont Alexa do aktualizacji. Jeśli pusta, zaktualizuje wszystkie znane konta.",
|
||||
"name": "Adres e-mail"
|
||||
}
|
||||
},
|
||||
"name": "Aktualizuj ostatnio wywołany czujnik"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "A página de Esqueceu a Senha foi detectada. Isso normalmente é resultado de muitas tentativas de login falhadas. A Amazon pode exigir ação antes que seja possível tentar fazer login novamente.",
|
||||
"login_failed": "Alexa Media Player falhou no login.",
|
||||
"reauth_successful": "Alexa Media Player reautenticado com sucesso. Por favor, ignore a mensagem \"Abortado\" do Home Assistant."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} é inválido",
|
||||
"connection_error": "Erro de conexão; verifique a sua conexão e tente novamente",
|
||||
"identifier_exists": "Email para URL Alexa já registrado",
|
||||
"invalid_auth": "O ‘login’ não foi bem-sucedido. Verifique novamente seu endereço eletrônico, senha e chave de autenticação.",
|
||||
"invalid_credentials": "Credenciais inválidas",
|
||||
"invalid_url": "O URL é inválido: {message}",
|
||||
"oauth_error": "Não foi possível concluir o ‘login’ OAuth. Tente novamente.",
|
||||
"unable_to_connect_hass_url": "Não foi possível conectar ao URL local do Home Assistant. Verifique o URL em Configurações > Sistema > Rede > URL do Home Assistant > Rede local.",
|
||||
"unknown_error": "Erro desconhecido: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignorar e continuar - Entendo que nenhum suporte para problemas de login é fornecido para ignorar este aviso."
|
||||
},
|
||||
"description": "O servidor HA não consegue se conectar ao URL fornecido: {hass_url}.\n> {error}\n\nPara corrigir isso, confirme se o seu navegador consegue acessar {hass_url}. Este campo está em Configurações > Sistema > Rede > URL do Home Assistant.\n\nSe você tiver **certeza** de que seu navegador consegue acessar este URL, pode ignorar este aviso.",
|
||||
"title": "Alexa Media Player - Não foi possível se conectar a URL do Home Assistant"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Sim, o código OTP foi verificado."
|
||||
},
|
||||
"description": "**{email} - alexa.{url}**\nVocê verificou o código OTP na verificação em duas etapas da Amazon?\n >Código OTP: {message}",
|
||||
"title": "Alexa Media Player - Confirmação OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Depuração avançada",
|
||||
"email": "Endereço eletrônico",
|
||||
"exclude_devices": "ou Excluir esses dispositivos de todos (separados por vírgula)",
|
||||
"extended_entity_discovery": "Inclua sensores, interruptores e luzes adicionais.",
|
||||
"hass_url": "URL da rede local para acessar o Home Assistant",
|
||||
"include_devices": "Inclua apenas estes dispositivos (separados por vírgula)",
|
||||
"otp_secret": "Chave de 52 caracteres do App Autenticador para 2SV da Amazon",
|
||||
"password": "Senha",
|
||||
"public_url": "URL pública compartilhada com serviços hospedados externamente",
|
||||
"queue_delay": "Tempo de espera para enfileirar vários comandos (em segundos)",
|
||||
"scan_interval": "Intervalo de sondagem programado (segundos)",
|
||||
"securitycode": "Senha de uso único (OTP)",
|
||||
"should_get_network": "Descubra a rede Alexa",
|
||||
"url": "Domínio regional da Amazon (ex: amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita o registro detalhado em nível de rastreamento para solução de problemas avançada. \n Não recomendado para operação normal devido ao aumento do volume de logs. \n Certifique-se de que os níveis de registro estejam definidos como DEBUG para obter a saída completa.",
|
||||
"otp_secret": "Exemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Qualidade do ar"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Monóxido de carbono"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Umidade"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Qualidade do ar interior"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Material particulado"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Compostos orgânicos voláteis"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Próximo alarme"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Próximo lembrete"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Próximo cronômetro"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatura"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Não incomodar"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repita"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Embaralhar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "A configuração YAML do Alexa Media Player está obsoleta.\nRemova `alexa_media` da sua configuração, reinicie o Home Assistant e use a ‘interface’ do usuário para configurá-lo.\n\nConfigurações > Dispositivos e serviços > Integrações > ADICIONAR INTEGRAÇÃO",
|
||||
"title": "A configuração YAML está obsoleta!"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Depuração avançada",
|
||||
"exclude_devices": "ou Excluir esses dispositivos de todos (separados por vírgula)",
|
||||
"extended_entity_discovery": "Inclua sensores, interruptores e luzes adicionais.",
|
||||
"include_devices": "Inclua apenas estes dispositivos (separados por vírgula)",
|
||||
"otp_secret": "Chave de 52 caracteres do App Autenticador para 2SV da Amazon",
|
||||
"public_url": "URL pública compartilhada com serviços hospedados externamente",
|
||||
"queue_delay": "Tempo de espera para enfileirar vários comandos (em segundos)",
|
||||
"scan_interval": "Frequência de sondagem programada (segundos)",
|
||||
"should_get_network": "Descubra a rede Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita o registro detalhado em nível de rastreamento para solução de problemas avançada. \n Não recomendado para operação normal devido ao aumento do volume de logs. \n Certifique-se de que os níveis de registro estejam definidos como DEBUG para obter a saída completa.",
|
||||
"otp_secret": "Exemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Entradas obrigatórias",
|
||||
"title": "Alexa Media Player - Reconfiguração"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Reativa a descoberta de rede da Alexa para que o próximo ciclo de pesquisa redescubra os dispositivos Alexa das contas selecionadas.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Opcional: Endereço eletrônico da conta Alexa ou lista de endereços eletrônicos. Se estiver vazio, todas as contas conhecidas serão atualizadas.",
|
||||
"name": "Endereço eletrônico"
|
||||
}
|
||||
},
|
||||
"name": "Habilitar descoberta de rede"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Forçar o logout da conta. Usado principalmente para depuração.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Contas para limpar. Deixar vazio limpará tudo.",
|
||||
"name": "Endereço eletrônico"
|
||||
}
|
||||
},
|
||||
"name": "Forçar o logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analisa os registros de histórico do dispositivo especificado:",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidade para obter o histórico de:",
|
||||
"name": "Selecione o media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Número de entradas para obter:",
|
||||
"name": "Número de entradas"
|
||||
}
|
||||
},
|
||||
"name": "Obter registros históricos"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restaurar o nível de volume anterior no dispositivo reprodutor de mídia Alexa.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidade para restaurar o nível de volume anterior",
|
||||
"name": "Selecione o media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restaurar volume anterior"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Força a atualização do último dispositivo eco chamado para cada conta Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Lista de contas Alexa para atualizar. Se deixar vazio, atualizará todas as contas conhecidas.",
|
||||
"name": "Endereço eletrônico"
|
||||
}
|
||||
},
|
||||
"name": "Atualizar último sensor chamado"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "A página de Esqueci a Palavra-passe foi detetada. Isto normalmente é o resultado de demasiadas tentativas de login falhadas. A Amazon pode exigir uma ação antes de ser possível tentar iniciar sessão novamente.",
|
||||
"login_failed": "Alexa Media Player não conseguiu fazer o login.",
|
||||
"reauth_successful": "Alexa Media Player reautenticado com sucesso. Por favor, ignore a mensagem \"Aborted\" do HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} é inválido",
|
||||
"connection_error": "Erro ao conectar; verifique a rede e tente novamente",
|
||||
"identifier_exists": "E-mail para URL Alexa já registado",
|
||||
"invalid_auth": "O ‘login’ não foi bem-sucedido. Verifique novamente o seu endereço eletrónico, senha e chave de autenticação.",
|
||||
"invalid_credentials": "Credenciais inválidas",
|
||||
"invalid_url": "O URL é inválido: {message}",
|
||||
"oauth_error": "Não foi possível concluir o login OAuth. Tente novamente.",
|
||||
"unable_to_connect_hass_url": "Não foi possível conectar ao URL local do Home Assistant. Verifique o URL em Configurações > Sistema > Rede > URL do Home Assistant > Rede local.",
|
||||
"unknown_error": "Erro desconhecido: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore e Continue - Entendo que não há suporte para problemas de login para ignorar este aviso."
|
||||
},
|
||||
"description": "O servidor HA não consegue se conectar ao URL fornecido: {hass_url}.\n > {error} \n\nPara corrigir isso, confirme se o seu navegador consegue acessar o endereço. {hass_url}. Este campo é de Configurações > Sistema > Rede > URL do Home Assistant.\n\nSe você tiver **certeza** de que o seu navegador consegue acessar este URL, pode ignorar este aviso.",
|
||||
"title": "Alexa Media Player - Não é possível conectar ao URL de alta disponibilidade"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Sim, o código OTP foi verificado."
|
||||
},
|
||||
"description": "** {email} - alexa. {url} **\nVocê verificou o código OTP na verificação de duas vias da Amazon?\n>Código OTP: {message}",
|
||||
"title": "Alexa Media Player - Confirmação OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Depuração avançada",
|
||||
"email": "Endereço de e-mail",
|
||||
"exclude_devices": "ou Excluir esses dispositivos de todos (separados por vírgula)",
|
||||
"extended_entity_discovery": "Inclua sensores, interruptores e luzes adicionais.",
|
||||
"hass_url": "URL da rede local para acessar o Home Assistant",
|
||||
"include_devices": "Inclua apenas estes dispositivos (separados por vírgula)",
|
||||
"otp_secret": "Chave de 52 caracteres da App Autenticadora para Amazon 2SV",
|
||||
"password": "Senha",
|
||||
"public_url": "URL pública compartilhada com serviços hospedados externos",
|
||||
"queue_delay": "Tempo de espera para enfileirar vários comandos (em segundos)",
|
||||
"scan_interval": "Intervalo de sondagem programado (segundos)",
|
||||
"securitycode": "Palavra-passe de uso único (OTP)",
|
||||
"should_get_network": "Descubra a rede Alexa",
|
||||
"url": "Região do domínio Amazon (ex. amazon.com.br)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita o registro detalhado em nível de rastreamento para solução de problemas avançada. \n Não recomendado para operação normal devido ao aumento do volume de logs. \n Certifique-se de que os níveis de registro estejam definidos como DEBUG para obter a saída completa.",
|
||||
"otp_secret": "Exemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Qualidade do ar"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Monóxido de carbono"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Umidade"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Qualidade do ar interior"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Material particulado"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Compostos orgânicos voláteis"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Próximo alarme"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Próximo lembrete"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Próximo cronômetro"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperatura"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Não incomodar"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repita"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Embaralhar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "A configuração YAML do Alexa Media Player está obsoleta.\nRemova alexa_media da sua configuração, reinicie o Home Assistant e utilize a “interface” do utilizador para o configurar.\nConfigurações > Dispositivos e serviços > Integrações > ADICIONAR INTEGRAÇÃO",
|
||||
"title": "A configuração YAML está obsoleta"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Depuração avançada",
|
||||
"exclude_devices": "ou Excluir esses dispositivos de todos (separados por vírgula)",
|
||||
"extended_entity_discovery": "Inclua sensores, interruptores e luzes adicionais.",
|
||||
"include_devices": "Inclua apenas estes dispositivos (separados por vírgula)",
|
||||
"otp_secret": "Chave de 52 caracteres da App Autenticadora para Amazon 2SV",
|
||||
"public_url": "URL pública compartilhada com serviços hospedados externamente",
|
||||
"queue_delay": "Tempo de espera para enfileirar vários comandos (em segundos)",
|
||||
"scan_interval": "Frequência de sondagem programada (segundos)",
|
||||
"should_get_network": "Descubra a rede Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Habilita o registro detalhado em nível de rastreamento para solução de problemas avançada. \n Não recomendado para operação normal devido ao aumento do volume de logs. \n Certifique-se de que os níveis de registro estejam definidos como DEBUG para obter a saída completa.",
|
||||
"otp_secret": "Exemplo: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Entradas obrigatórias",
|
||||
"title": "Alexa Media Player - Reconfiguração"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Reativa a descoberta de rede da Alexa para que o próximo ciclo de pesquisa redescubra os dispositivos Alexa das contas selecionadas.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Opcional: Endereço eletrónico da conta Alexa ou lista de endereços eletrónicos. Se estiver vazio, todas as contas conhecidas serão atualizadas.",
|
||||
"name": "Endereço de email"
|
||||
}
|
||||
},
|
||||
"name": "Habilitar descoberta de rede"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Forçar o logout da conta. Usado principalmente para depuração.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Contas a limpar. Vazio vai limpar tudo.",
|
||||
"name": "Endereço de email"
|
||||
}
|
||||
},
|
||||
"name": "Forçar logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Analisa os registos de histórico do dispositivo especificado",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidade para obter o histórico de",
|
||||
"name": "Selecione o media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Número de entradas para obter",
|
||||
"name": "Número de entradas"
|
||||
}
|
||||
},
|
||||
"name": "Obter registos históricos"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restaurar o nível de volume anterior no dispositivo reprodutor de média Alexa",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entidade para restaurar o nível de volume anterior em",
|
||||
"name": "Selecione o media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restaurar volume anterior"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Força a atualização do dispositivo de echo last_called para cada conta Alexa.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Lista de contas Alexa para atualizar. Se estiver vazio, atualizará todas as contas conhecidas.",
|
||||
"name": "Endereço de email"
|
||||
}
|
||||
},
|
||||
"name": "Atualizar último sensor chamado"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "Обнаружена страница «Забыли пароль». Обычно это происходит из-за слишком большого количества неудачных попыток входа. Amazon может потребовать действий, прежде чем можно будет повторно войти в систему.",
|
||||
"login_failed": "Алекса Медиа Проигрыватель логин не удался.",
|
||||
"reauth_successful": "Алекса Медиа Проигрыватель успешно прошел повторную аутентификацию. Пожалуйста, игнорируйте сообщение «Прервано» от HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} недействителен",
|
||||
"connection_error": "Ошибка подключения; проверьте сеть и повторите попытку",
|
||||
"identifier_exists": "Электронная почта для Alexa уже зарегистрирована",
|
||||
"invalid_auth": "Не удалось войти. Пожалуйста, проверьте адрес электронной почты, пароль и ключ аутентификации.",
|
||||
"invalid_credentials": "Неверные учетные данные",
|
||||
"invalid_url": "Недопустимый URL-адрес: {message}",
|
||||
"oauth_error": "Не удалось завершить вход через OAuth. Попробуйте ещё раз.",
|
||||
"unable_to_connect_hass_url": "Не удаётся подключиться к локальному URL-адресу Home Assistant. Проверьте URL-адрес в разделе «Настройки» > «Система» > «Сеть» > «URL-адрес Home Assistant» > «Локальная сеть».",
|
||||
"unknown_error": "Неизвестная ошибка: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Игнорировать и продолжить. Я понимаю, что для обхода этого предупреждения не предоставляется никакой поддержки при проблемах со входом в систему."
|
||||
},
|
||||
"description": "Home Assistant сервер не может подключиться по указанному адресу: {hass_url}.\n> {error}\n\nДля решения этой проблемы, пожалуйста, убедитесь, что ваш браузер имеет доступ к указанному ресурсу. {hass_url}. Это поле находится в разделе Настройки > Система > Сеть > URL-адрес Home Assistant.\n\nЕсли вы **уверены**, что ваш клиент может получить доступ к этому URL-адресу, вы можете обойти это предупреждение.",
|
||||
"title": "Алекса Медиа Проигрыватель - не может подключиться к Home Assistant адресу"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Да, код OTP был подтвержден."
|
||||
},
|
||||
"description": "**{email} - Алекса.{url}** \nВы подтвердили OTP-код в Amazon 2SV?\n >OTP-код {message}",
|
||||
"title": "Алекса Медиа Проигрыватель — подтверждение OTP"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Расширенные возможности отладки",
|
||||
"email": "Адрес электронной почты",
|
||||
"exclude_devices": "или Исключить эти устройства из всех (разделенных запятыми)",
|
||||
"extended_entity_discovery": "Включите дополнительные датчики, выключатели и осветительные приборы.",
|
||||
"hass_url": "URL-адрес локальной сети для доступа к Home Assistant",
|
||||
"include_devices": "Укажите только эти устройства (разделенные запятыми).",
|
||||
"otp_secret": "52-символьный ключ приложения аутентификатора для Amazon 2SV",
|
||||
"password": "Пароль",
|
||||
"public_url": "Публичный URL-адрес, предоставленный внешним размещенным службам",
|
||||
"queue_delay": "Задержка для объединения нескольких команд в очередь (в секундах)",
|
||||
"scan_interval": "Запланированный интервал опроса (в секундах)",
|
||||
"securitycode": "Одноразовый пароль (OTP)",
|
||||
"should_get_network": "Откройте для себя сеть Alexa",
|
||||
"url": "Домен региона Amazon (например, amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Включает очень подробное логирование на уровне трассировки для расширенного поиска и устранения неисправностей. \n Не рекомендуется для обычной работы из-за увеличенного объема логов. \n Убедитесь, что уровни логирования установлены на DEBUG для получения полного вывода.",
|
||||
"otp_secret": "Пример: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Качество воздуха"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Оксид углерода"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Влажность"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Качество воздуха в помещении"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Твердые частицы"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Летучие органические соединения"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Следующий будильник"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Следующее напоминание"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "В следующий раз"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Температура"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Просьба не беспокоить"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Повторить"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Перетасовка"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "Конфигурация Alexa Media Player в формате YAML устарела.\nУдалите `alexa_media` из конфигурации, перезапустите Home Assistant и используйте пользовательский интерфейс для настройки.\nНастройки > Устройства и сервисы > Интеграции > ДОБАВИТЬ ИНТЕГРАЦИЮ",
|
||||
"title": "Конфигурация YAML устарела"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Расширенные возможности отладки",
|
||||
"exclude_devices": "или Исключить эти устройства из всех (разделенных запятыми)",
|
||||
"extended_entity_discovery": "Включите дополнительные датчики, выключатели и осветительные приборы.",
|
||||
"include_devices": "Укажите только эти устройства (разделенные запятыми).",
|
||||
"otp_secret": "52-символьный ключ приложения аутентификатора для Amazon 2SV",
|
||||
"public_url": "Публичный URL-адрес предоставляется внешним хостинг-сервисам.",
|
||||
"queue_delay": "Задержка для объединения нескольких команд в очередь (в секундах)",
|
||||
"scan_interval": "Запланированная частота опроса (в секундах)",
|
||||
"should_get_network": "Откройте для себя сеть Alexa"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Включает очень подробное логирование на уровне трассировки для расширенного поиска и устранения неисправностей. \n Не рекомендуется для обычной работы из-за увеличенного объема логов. \n Убедитесь, что уровни логирования установлены на DEBUG для получения полного вывода.",
|
||||
"otp_secret": "Пример: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Обязательные поля",
|
||||
"title": "Alexa Media Player - Перенастройка"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Повторно включает обнаружение сети Alexa, чтобы в следующем цикле опроса были повторно обнаружены устройства Alexa для выбранных учетных записей.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Необязательный адрес электронной почты для учётной записи Alexa или список адресов электронной почты. Если не указано, все известные учётные записи будут обновлены.",
|
||||
"name": "Почтовые адреса"
|
||||
}
|
||||
},
|
||||
"name": "Включить сетевое обнаружение"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Принудительный выход из аккаунта. В основном используется для отладки.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Аккаунты для очистки. Если пустое, то будут очищены все.",
|
||||
"name": "Почтовые адреса"
|
||||
}
|
||||
},
|
||||
"name": "Принудительный выход"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Анализирует записи истории для указанного устройства.",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Сущность, для которой нужно получить историю",
|
||||
"name": "Выберите медиа плеер:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Количество записей, которые нужно получить",
|
||||
"name": "Количество записей"
|
||||
}
|
||||
},
|
||||
"name": "Получить исторические записи"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Восстановить предыдущий уровень громкости на медиа плеере Alexa",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Сущность для восстановления предыдущего уровня громкости",
|
||||
"name": "Выберите медиа плеер:"
|
||||
}
|
||||
},
|
||||
"name": "Восстановить предыдущий том"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Принудительное обновление последнего вызванного устройства для каждого аккаунта Алекса.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Список аккаунтов Алекса для обновления. Если пустое, будут обновлены все аккаунты.",
|
||||
"name": "Почтовые адреса"
|
||||
}
|
||||
},
|
||||
"name": "Обновление последнего вызванного сенсора"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "The Forgot Password page was detected. This normally is the result of too many failed logins. Amazon may require action before a relogin can be attempted.",
|
||||
"login_failed": "Alexa Media Player failed to login.",
|
||||
"reauth_successful": "Alexa Media Player successfully reauthenticated. Please ignore the \"Aborted\" message from HA."
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} is invalid",
|
||||
"connection_error": "Error connecting; check network and retry",
|
||||
"identifier_exists": "Email for Alexa URL already registered",
|
||||
"invalid_auth": "Login was not successful. Please double-check your email, password, and Authenticator key.",
|
||||
"invalid_credentials": "Invalid credentials",
|
||||
"invalid_url": "URL is invalid: {message}",
|
||||
"oauth_error": "Could not complete OAuth login. Please try again.",
|
||||
"unable_to_connect_hass_url": "Unable to connect to Home Assistant Local URL. Please check the URL under Settings > System > Network > Home Assistant URL > Local network",
|
||||
"unknown_error": "Unknown error: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "Ignore and Continue - I understand that no support for login issues are provided for bypassing this warning."
|
||||
},
|
||||
"description": "The HA server cannot connect to the URL provided: {hass_url}.\n> {error}\n\nTo fix this, please confirm your browser can reach {hass_url}. This field is from Settings > System > Network > Home Assistant URL.\n\nIf you are **certain** your browser can reach this URL, you can bypass this warning.",
|
||||
"title": "Alexa Media Player - Unable to Connect to HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "Yes, OTP code was verified"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \nHave you verified the OTP code in Amazon 2SV? \n >OTP Code: {message}",
|
||||
"title": "Alexa Media Player - OTP Confirmation"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"email": "Email Address",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"hass_url": "Local network URL to access Home Assistant",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"password": "Password",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"securitycode": "One-time password (OTP)",
|
||||
"should_get_network": "Discover Alexa network",
|
||||
"url": "Amazon region domain (e.g., amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "YAML configuration of Alexa Media Player is deprecated.\nPlease remove `alexa_media` from your configuration, restart Home Assistant and use the UI to configure it instead.\nSettings > Devices & services > Integrations > ADD INTEGRATION",
|
||||
"title": "YAML configuration is deprecated"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "Advanced debug",
|
||||
"exclude_devices": "or Exclude these devices from all (comma separated)",
|
||||
"extended_entity_discovery": "Include additional sensors, switches and lights",
|
||||
"include_devices": "Only include these devices (comma separated)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "Public URL shared with external hosted services",
|
||||
"queue_delay": "Delay to queue multiple commands together (seconds)",
|
||||
"scan_interval": "Scheduled polling interval (seconds)",
|
||||
"should_get_network": "Discover Alexa network"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* Required entry",
|
||||
"title": "Alexa Media Player - Reconfiguration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "Re-enables Alexa network discovery so the next polling cycle will rediscover Alexa devices for the selected accounts.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Optional Alexa account email or list of emails. If empty, all known accounts will be refreshed.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Enable Network Discovery"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "Force account to logout. Used mainly for debugging.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "Accounts to clear. Empty will clear all.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Force Logout"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "Parses the history records for the specified device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to get the history for",
|
||||
"name": "Select media player:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "Number of entries to get",
|
||||
"name": "Number of entries"
|
||||
}
|
||||
},
|
||||
"name": "Get History Records"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "Restore previous volume level on Alexa media player device",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "Entity to restore the previous volume level on",
|
||||
"name": "Select media player:"
|
||||
}
|
||||
},
|
||||
"name": "Restore Previous Volume"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "Forces update of last_called echo device for each Alexa account.",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "List of Alexa accounts to update. If empty, will update all known accounts.",
|
||||
"name": "Email address"
|
||||
}
|
||||
},
|
||||
"name": "Update Last Called Sensor"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"forgot_password": "检测到“忘记密码”页面。这通常是由于多次登录失败导致的。在重新登录之前,亚马逊可能需要采取一些措施。",
|
||||
"login_failed": "Alexa 媒体播放器登录失败。",
|
||||
"reauth_successful": "Alexa 媒体播放器已成功重新验证。请忽略来自 HA 的“Aborted”消息。"
|
||||
},
|
||||
"error": {
|
||||
"2fa_key_invalid": "{otp_secret} 无效",
|
||||
"connection_error": "连接错误;检查网络并重试",
|
||||
"identifier_exists": "Alexa URL的电子邮件已注册",
|
||||
"invalid_auth": "登录失败。请仔细检查您的邮箱、密码和验证码。",
|
||||
"invalid_credentials": "无效的凭证",
|
||||
"invalid_url": "URL 无效: {message}",
|
||||
"oauth_error": "OAuth登录失败,请重试。",
|
||||
"unable_to_connect_hass_url": "无法连接到 Home Assistant 本地 URL。请检查“设置”>“系统”>“网络”>“Home Assistant URL”>“本地网络”中的 URL。",
|
||||
"unknown_error": "未知错误: {message}"
|
||||
},
|
||||
"step": {
|
||||
"proxy_warning": {
|
||||
"data": {
|
||||
"proxy_warning": "忽略并继续 - 我了解不提供对登录问题的支持来绕过此警告。"
|
||||
},
|
||||
"description": "HA 服务器无法连接到提供的 URL:{hass_url}。\n> {error}\n\n要解决此问题,请确认您的浏览器可以访问 {hass_url}。此字段位于“设置”>“系统”>“网络”>“Home Assistant URL”中。\n\n如果您**确定**您的浏览器可以访问此 URL,则可以绕过此警告。",
|
||||
"title": "Alexa 媒体播放器 - 无法连接到 HA URL"
|
||||
},
|
||||
"totp_register": {
|
||||
"data": {
|
||||
"registered": "是的,OTP验证码已验证"
|
||||
},
|
||||
"description": "**{email} - alexa.{url}** \n您是否已在亚马逊 2SV 中验证过 OTP 代码?\n >OTP Code {message}",
|
||||
"title": "Alexa 媒体播放器 - OTP 确认"
|
||||
},
|
||||
"user": {
|
||||
"data": {
|
||||
"debug": "高级调试",
|
||||
"email": "电子邮件地址",
|
||||
"exclude_devices": "或者将这些设备从所有列表中排除(以逗号分隔)",
|
||||
"extended_entity_discovery": "增加额外的传感器、开关和灯",
|
||||
"hass_url": "用于访问 Home Assistant 的本地网络 URL",
|
||||
"include_devices": "仅包含以下设备(以逗号分隔)",
|
||||
"otp_secret": "亚马逊双重验证的 52 字符身份验证器应用密钥",
|
||||
"password": "密码",
|
||||
"public_url": "与外部托管服务共享的公共 URL",
|
||||
"queue_delay": "将多个命令排队的延迟时间(秒)",
|
||||
"scan_interval": "计划轮询间隔(秒)",
|
||||
"securitycode": "一次性密码(OTP)",
|
||||
"should_get_network": "发现 Alexa 网络",
|
||||
"url": "亚马逊区域域名(例如 amazon.co.uk)"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"air_quality": {
|
||||
"name": "Air quality"
|
||||
},
|
||||
"air_quality_carbon_monoxide": {
|
||||
"name": "Carbon monoxide"
|
||||
},
|
||||
"air_quality_humidity": {
|
||||
"name": "Humidity"
|
||||
},
|
||||
"air_quality_indoor_air_quality": {
|
||||
"name": "Indoor air quality"
|
||||
},
|
||||
"air_quality_particulate_matter": {
|
||||
"name": "Particulate matter"
|
||||
},
|
||||
"air_quality_volatile_organic_compounds": {
|
||||
"name": "Volatile organic compounds"
|
||||
},
|
||||
"next_alarm": {
|
||||
"name": "Next alarm"
|
||||
},
|
||||
"next_reminder": {
|
||||
"name": "Next reminder"
|
||||
},
|
||||
"next_timer": {
|
||||
"name": "Next timer"
|
||||
},
|
||||
"temperature": {
|
||||
"name": "Temperature"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"do_not_disturb": {
|
||||
"name": "Do not disturb"
|
||||
},
|
||||
"repeat": {
|
||||
"name": "Repeat"
|
||||
},
|
||||
"shuffle": {
|
||||
"name": "Shuffle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
"deprecated_yaml_configuration": {
|
||||
"description": "Alexa Media Player 的 YAML 配置已弃用。\n请从配置中移除 `alexa_media`,重启 Home Assistant,然后改用用户界面进行配置。\n设置 > 设备和服务 > 集成 > 添加集成",
|
||||
"title": "YAML配置已弃用"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"debug": "高级调试",
|
||||
"exclude_devices": "或者将这些设备从所有列表中排除(以逗号分隔)",
|
||||
"extended_entity_discovery": "增加额外的传感器、开关和灯",
|
||||
"include_devices": "仅包含以下设备(以逗号分隔)",
|
||||
"otp_secret": "52-character Authenticator App Key for Amazon 2SV",
|
||||
"public_url": "与外部托管服务共享的公共 URL",
|
||||
"queue_delay": "将多个命令排队的延迟时间(秒)",
|
||||
"scan_interval": "计划轮询频率(秒)",
|
||||
"should_get_network": "发现 Alexa 网络"
|
||||
},
|
||||
"data_description": {
|
||||
"debug": "Enables very verbose, trace-level logging for advanced troubleshooting.\nNot recommended for normal operation due to increased log volume.\nEnsure logger levels are set to DEBUG for full output.",
|
||||
"otp_secret": "Example: 35T5 LQSY I5IO 3EFQ LGAJ I6YB JWBY JJPR PYT7 XPPW IDAK SQBJ CVXA"
|
||||
},
|
||||
"description": "* 必填项",
|
||||
"title": "Alexa 媒体播放器 - 重新配置"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"enable_network_discovery": {
|
||||
"description": "重新启用 Alexa 网络发现功能,以便在下一个轮询周期中重新发现所选帐户的 Alexa 设备。",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "可选的 Alexa 帐户电子邮件地址或电子邮件地址列表。如果为空,则会刷新所有已知帐户。",
|
||||
"name": "电子邮件"
|
||||
}
|
||||
},
|
||||
"name": "启用网络发现"
|
||||
},
|
||||
"force_logout": {
|
||||
"description": "强制帐户注销。主要用于调试。",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "要清除的帐户。清空将清除所有帐户。",
|
||||
"name": "电子邮件地址"
|
||||
}
|
||||
},
|
||||
"name": "强制注销"
|
||||
},
|
||||
"get_history_records": {
|
||||
"description": "解析指定设备的历史记录",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "要获取历史记录的实体",
|
||||
"name": "选择媒体播放器:"
|
||||
},
|
||||
"entries": {
|
||||
"description": "需要获取的条目数量",
|
||||
"name": "条目数量"
|
||||
}
|
||||
},
|
||||
"name": "获取历史记录"
|
||||
},
|
||||
"restore_volume": {
|
||||
"description": "恢复 Alexa 媒体播放器设备上的先前音量级别",
|
||||
"fields": {
|
||||
"entity_id": {
|
||||
"description": "实体恢复先前的音量水平",
|
||||
"name": "选择媒体播放器:"
|
||||
}
|
||||
},
|
||||
"name": "恢复先前的音量"
|
||||
},
|
||||
"update_last_called": {
|
||||
"description": "强制更新每个 Alexa 帐户的 last_called 回声设备。",
|
||||
"fields": {
|
||||
"email": {
|
||||
"description": "要更新的 Alexa 帐户列表。如果为空,将更新所有已知帐户。",
|
||||
"name": "电子邮件地址"
|
||||
}
|
||||
},
|
||||
"name": "更新上次呼叫传感器"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user