diff --git a/custom_components/alexa_media/.translations/de.json b/custom_components/alexa_media/.translations/de.json index 1947cbe..3127aa2 100644 --- a/custom_components/alexa_media/.translations/de.json +++ b/custom_components/alexa_media/.translations/de.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Verbindungsfehler; Netzwerk prüfen und erneut versuchen", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Es kann keine Verbindung zur Home Assistant-URL hergestellt werden. Bitte überprüfen Sie die externe URL unter Konfiguration - > Allgemein", "identifier_exists": "Diese Email ist bereits registriert", "invalid_credentials": "Falsche Zugangsdaten", "unknown_error": "Unbekannter Fehler, bitte Log-Info melden" diff --git a/custom_components/alexa_media/.translations/en.json b/custom_components/alexa_media/.translations/en.json index cc25c70..4b0ea68 100644 --- a/custom_components/alexa_media/.translations/en.json +++ b/custom_components/alexa_media/.translations/en.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Error connecting; check network and retry", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the External Url under Configuration -> General", "identifier_exists": "Email for Alexa URL already registered", "invalid_credentials": "Invalid credentials", "unknown_error": "Unknown error, please enable advanced debugging and report log info" diff --git a/custom_components/alexa_media/.translations/es.json b/custom_components/alexa_media/.translations/es.json index 932a64a..eabeb59 100644 --- a/custom_components/alexa_media/.translations/es.json +++ b/custom_components/alexa_media/.translations/es.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Error al conectar, verifique la red y vuelva a intentarlo", - "hass_url_invalid": "No se puede conectar a la url de Home Assistant. Compruebe la dirección URL interna en Configuración -> General", + "hass_url_invalid": "No se puede conectar a la url de Home Assistant. Compruebe la dirección URL externa en Configuración -> General", "identifier_exists": "Correo electrónico para la URL de Alexa ya registrado", "invalid_credentials": "Credenciales no válidas", "unknown_error": "Error desconocido, por favor revisa los registros en Home Assistant y reporta el error si es necesario." diff --git a/custom_components/alexa_media/.translations/nb.json b/custom_components/alexa_media/.translations/nb.json index 0c36c1d..7aa9532 100644 --- a/custom_components/alexa_media/.translations/nb.json +++ b/custom_components/alexa_media/.translations/nb.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Feil ved tilkobling; sjekk nettverket og prøv på nytt", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Kan ikke koble til nettadressen til hjemmeassistenten. Vennligst sjekk den eksterne nettadressen under Konfigurasjon - > Generelt", "identifier_exists": "E-post for Alexa URL allerede registrert", "invalid_credentials": "ugyldige legitimasjon", "unknown_error": "Ukjent feil, vennligst rapporter logginfo" diff --git a/custom_components/alexa_media/.translations/nl.json b/custom_components/alexa_media/.translations/nl.json index 902cda4..820662c 100644 --- a/custom_components/alexa_media/.translations/nl.json +++ b/custom_components/alexa_media/.translations/nl.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Fout bij verbinden; controleer netwerk en probeer opnieuw", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Kan geen verbinding maken met de Home Assistant-URL. Controleer de externe URL onder Configuratie - > Algemeen", "identifier_exists": "Dit e-mailadres is reeds geregistreerd", "invalid_credentials": "Ongeldige inloggegevens", "unknown_error": "Onbekende fout, meld de loggegevens" diff --git a/custom_components/alexa_media/.translations/pl.json b/custom_components/alexa_media/.translations/pl.json index 1d8c2d9..32d7f3a 100644 --- a/custom_components/alexa_media/.translations/pl.json +++ b/custom_components/alexa_media/.translations/pl.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Nieprawidłowy klucz z wbudowanej aplikacji uwierzytelniania dwuskładnikowego", "connection_error": "Błąd podczas łączenia; sprawdź sieć i spróbuj ponownie", - "hass_url_invalid": "Nie można połączyć się z adresem URL Home Assistanta. Sprawdź wewnętrzny adres URL w sekcji Konfiguracja -> Ogólne", + "hass_url_invalid": "Nie można połączyć się z adresem URL Home Assistanta. Sprawdź publiczny adres URL w sekcji Konfiguracja -> Ogólne", "identifier_exists": "Adres e-mail dla Alexy już jest zarejestrowany", "invalid_credentials": "Nieprawidłowe dane logowania", "unknown_error": "Nieznany błąd, zgłoś log z tego zdarzenia" diff --git a/custom_components/alexa_media/.translations/pt_BR.json b/custom_components/alexa_media/.translations/pt_BR.json index 750d1d1..c519b55 100644 --- a/custom_components/alexa_media/.translations/pt_BR.json +++ b/custom_components/alexa_media/.translations/pt_BR.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Chave integrada 2FA inválida", "connection_error": "Erro de conexão; Verifique a sua conexão e tente novamente", - "hass_url_invalid": "Não foi possível conectar a URL do Home Assistant. Por favor verifique a URL interna em Configuração -> Geral", + "hass_url_invalid": "Não foi possível conectar a URL do Home Assistant. Por favor verifique a URL externa em Configuração -> Geral", "identifier_exists": "Email para URL Alexa já registrado", "invalid_credentials": "Credenciais inválidas", "unknown_error": "Erro desconhecido, favor habilitar a depuração avançada e reporte as informações de registro" diff --git a/custom_components/alexa_media/.translations/ru.json b/custom_components/alexa_media/.translations/ru.json index 1cba8a2..b3519b5 100644 --- a/custom_components/alexa_media/.translations/ru.json +++ b/custom_components/alexa_media/.translations/ru.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Ошибка подключения; проверьте сеть и повторите попытку", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Невозможно подключиться к URL-адресу Home Assistant. Пожалуйста, проверьте внешний URL-адрес в разделе \"Конфигурация\" - > Общие\".", "identifier_exists": "Электронная почта для Alexa уже зарегистрирована", "invalid_credentials": "Неверные учетные данные", "unknown_error": "Неизвестная ошибка, пожалуйста, сообщите информацию журнала" diff --git a/custom_components/alexa_media/.translations/zh-Hans.json b/custom_components/alexa_media/.translations/zh-Hans.json index 64aae71..e848d77 100644 --- a/custom_components/alexa_media/.translations/zh-Hans.json +++ b/custom_components/alexa_media/.translations/zh-Hans.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "连接错误;检查网络并重试", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the External Url under Configuration -> General", "identifier_exists": "Alexa URL的电子邮件已注册", "invalid_credentials": "Invalid credentials", "unknown_error": "Unknown error, please report log info" diff --git a/custom_components/alexa_media/__init__.py b/custom_components/alexa_media/__init__.py index 7a7caa7..5bbb7f2 100644 --- a/custom_components/alexa_media/__init__.py +++ b/custom_components/alexa_media/__init__.py @@ -370,6 +370,9 @@ async def async_update_data() -> Optional[AlexaEntityData]: should_get_network = hass.data[DATA_ALEXAMEDIA]["accounts"][email][ "should_get_network" ] + extended_entity_discovery = hass.data[DATA_ALEXAMEDIA]["accounts"][email][ + "options" + ].get(CONF_EXTENDED_ENTITY_DISCOVERY) devices = {} bluetooth = {} @@ -434,7 +437,16 @@ async def async_update_data() -> Optional[AlexaEntityData]: "should_get_network" ] = False - if entities_to_monitor: + # First run is a special case. Get the state of all entities(including disabled) + # This ensures all entities have state during startup without needing to request coordinator refresh + for typeOfEntity, entities in alexa_entities.items(): + if typeOfEntity == "guard" or extended_entity_discovery: + for entity in entities: + entities_to_monitor.add(entity.get("id")) + entity_state = await get_entity_data( + login_obj, list(entities_to_monitor) + ) + elif entities_to_monitor: entity_state = optional_task_results.pop() if new_devices: diff --git a/custom_components/alexa_media/alexa_entity.py b/custom_components/alexa_media/alexa_entity.py index 4a1a65a..780a811 100644 --- a/custom_components/alexa_media/alexa_entity.py +++ b/custom_components/alexa_media/alexa_entity.py @@ -206,15 +206,19 @@ async def get_entity_data( login_obj: AlexaLogin, entity_ids: List[Text] ) -> AlexaEntityData: """Get and process the entity data into a more usable format.""" - raw = await AlexaAPI.get_entity_state(login_obj, entity_ids=entity_ids) + entities = {} - device_states = raw.get("deviceStates") - if device_states: - for device_state in device_states: - entity_id = device_state["entity"]["entityId"] - entities[entity_id] = [] - for cap_state in device_state["capabilityStates"]: - entities[entity_id].append(json.loads(cap_state)) + 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 = device_state.get("entity", {}).get("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 diff --git a/custom_components/alexa_media/const.py b/custom_components/alexa_media/const.py index 5c40046..b508863 100644 --- a/custom_components/alexa_media/const.py +++ b/custom_components/alexa_media/const.py @@ -8,7 +8,7 @@ """ from datetime import timedelta -__version__ = "3.10.2" +__version__ = "3.10.4" PROJECT_URL = "https://github.com/custom-components/alexa_media_player/" ISSUE_URL = f"{PROJECT_URL}issues" diff --git a/custom_components/alexa_media/light.py b/custom_components/alexa_media/light.py index e3f68af..0c418b8 100644 --- a/custom_components/alexa_media/light.py +++ b/custom_components/alexa_media/light.py @@ -101,9 +101,6 @@ async def async_setup_platform(hass, config, add_devices_callback, discovery_inf le["name"], ) - if devices: - await coordinator.async_refresh() - return await add_devices( hide_email(account), devices, diff --git a/custom_components/alexa_media/manifest.json b/custom_components/alexa_media/manifest.json index c52a390..eaaddbb 100644 --- a/custom_components/alexa_media/manifest.json +++ b/custom_components/alexa_media/manifest.json @@ -1,7 +1,7 @@ { "domain": "alexa_media", "name": "Alexa Media Player", - "version": "3.10.2", + "version": "3.10.4", "config_flow": true, "documentation": "https://github.com/custom-components/alexa_media_player/wiki", "issue_tracker": "https://github.com/custom-components/alexa_media_player/issues", diff --git a/custom_components/alexa_media/sensor.py b/custom_components/alexa_media/sensor.py index 05d3bb6..0166ada 100644 --- a/custom_components/alexa_media/sensor.py +++ b/custom_components/alexa_media/sensor.py @@ -166,7 +166,6 @@ async def create_temperature_sensors(account_dict, temperature_entities): account_dict["entities"]["sensor"].setdefault(serial, {}) account_dict["entities"]["sensor"][serial]["Temperature"] = sensor devices.append(sensor) - await coordinator.async_request_refresh() return devices diff --git a/custom_components/alexa_media/translations/de.json b/custom_components/alexa_media/translations/de.json index 1947cbe..3127aa2 100644 --- a/custom_components/alexa_media/translations/de.json +++ b/custom_components/alexa_media/translations/de.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Verbindungsfehler; Netzwerk prüfen und erneut versuchen", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Es kann keine Verbindung zur Home Assistant-URL hergestellt werden. Bitte überprüfen Sie die externe URL unter Konfiguration - > Allgemein", "identifier_exists": "Diese Email ist bereits registriert", "invalid_credentials": "Falsche Zugangsdaten", "unknown_error": "Unbekannter Fehler, bitte Log-Info melden" diff --git a/custom_components/alexa_media/translations/en.json b/custom_components/alexa_media/translations/en.json index cc25c70..4b0ea68 100644 --- a/custom_components/alexa_media/translations/en.json +++ b/custom_components/alexa_media/translations/en.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Error connecting; check network and retry", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the External Url under Configuration -> General", "identifier_exists": "Email for Alexa URL already registered", "invalid_credentials": "Invalid credentials", "unknown_error": "Unknown error, please enable advanced debugging and report log info" diff --git a/custom_components/alexa_media/translations/es.json b/custom_components/alexa_media/translations/es.json index 932a64a..eabeb59 100644 --- a/custom_components/alexa_media/translations/es.json +++ b/custom_components/alexa_media/translations/es.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Error al conectar, verifique la red y vuelva a intentarlo", - "hass_url_invalid": "No se puede conectar a la url de Home Assistant. Compruebe la dirección URL interna en Configuración -> General", + "hass_url_invalid": "No se puede conectar a la url de Home Assistant. Compruebe la dirección URL externa en Configuración -> General", "identifier_exists": "Correo electrónico para la URL de Alexa ya registrado", "invalid_credentials": "Credenciales no válidas", "unknown_error": "Error desconocido, por favor revisa los registros en Home Assistant y reporta el error si es necesario." diff --git a/custom_components/alexa_media/translations/nb.json b/custom_components/alexa_media/translations/nb.json index 0c36c1d..7aa9532 100644 --- a/custom_components/alexa_media/translations/nb.json +++ b/custom_components/alexa_media/translations/nb.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Feil ved tilkobling; sjekk nettverket og prøv på nytt", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Kan ikke koble til nettadressen til hjemmeassistenten. Vennligst sjekk den eksterne nettadressen under Konfigurasjon - > Generelt", "identifier_exists": "E-post for Alexa URL allerede registrert", "invalid_credentials": "ugyldige legitimasjon", "unknown_error": "Ukjent feil, vennligst rapporter logginfo" diff --git a/custom_components/alexa_media/translations/nl.json b/custom_components/alexa_media/translations/nl.json index 902cda4..820662c 100644 --- a/custom_components/alexa_media/translations/nl.json +++ b/custom_components/alexa_media/translations/nl.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Fout bij verbinden; controleer netwerk en probeer opnieuw", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Kan geen verbinding maken met de Home Assistant-URL. Controleer de externe URL onder Configuratie - > Algemeen", "identifier_exists": "Dit e-mailadres is reeds geregistreerd", "invalid_credentials": "Ongeldige inloggegevens", "unknown_error": "Onbekende fout, meld de loggegevens" diff --git a/custom_components/alexa_media/translations/pl.json b/custom_components/alexa_media/translations/pl.json index 1d8c2d9..32d7f3a 100644 --- a/custom_components/alexa_media/translations/pl.json +++ b/custom_components/alexa_media/translations/pl.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Nieprawidłowy klucz z wbudowanej aplikacji uwierzytelniania dwuskładnikowego", "connection_error": "Błąd podczas łączenia; sprawdź sieć i spróbuj ponownie", - "hass_url_invalid": "Nie można połączyć się z adresem URL Home Assistanta. Sprawdź wewnętrzny adres URL w sekcji Konfiguracja -> Ogólne", + "hass_url_invalid": "Nie można połączyć się z adresem URL Home Assistanta. Sprawdź publiczny adres URL w sekcji Konfiguracja -> Ogólne", "identifier_exists": "Adres e-mail dla Alexy już jest zarejestrowany", "invalid_credentials": "Nieprawidłowe dane logowania", "unknown_error": "Nieznany błąd, zgłoś log z tego zdarzenia" diff --git a/custom_components/alexa_media/translations/pt_BR.json b/custom_components/alexa_media/translations/pt_BR.json index 750d1d1..c519b55 100644 --- a/custom_components/alexa_media/translations/pt_BR.json +++ b/custom_components/alexa_media/translations/pt_BR.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Chave integrada 2FA inválida", "connection_error": "Erro de conexão; Verifique a sua conexão e tente novamente", - "hass_url_invalid": "Não foi possível conectar a URL do Home Assistant. Por favor verifique a URL interna em Configuração -> Geral", + "hass_url_invalid": "Não foi possível conectar a URL do Home Assistant. Por favor verifique a URL externa em Configuração -> Geral", "identifier_exists": "Email para URL Alexa já registrado", "invalid_credentials": "Credenciais inválidas", "unknown_error": "Erro desconhecido, favor habilitar a depuração avançada e reporte as informações de registro" diff --git a/custom_components/alexa_media/translations/ru.json b/custom_components/alexa_media/translations/ru.json index 1cba8a2..b3519b5 100644 --- a/custom_components/alexa_media/translations/ru.json +++ b/custom_components/alexa_media/translations/ru.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "Ошибка подключения; проверьте сеть и повторите попытку", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Невозможно подключиться к URL-адресу Home Assistant. Пожалуйста, проверьте внешний URL-адрес в разделе \"Конфигурация\" - > Общие\".", "identifier_exists": "Электронная почта для Alexa уже зарегистрирована", "invalid_credentials": "Неверные учетные данные", "unknown_error": "Неизвестная ошибка, пожалуйста, сообщите информацию журнала" diff --git a/custom_components/alexa_media/translations/zh-Hans.json b/custom_components/alexa_media/translations/zh-Hans.json index 64aae71..e848d77 100644 --- a/custom_components/alexa_media/translations/zh-Hans.json +++ b/custom_components/alexa_media/translations/zh-Hans.json @@ -8,7 +8,7 @@ "error": { "2fa_key_invalid": "Invalid Built-In 2FA key", "connection_error": "连接错误;检查网络并重试", - "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the Internal Url under Configuration -> General", + "hass_url_invalid": "Unable to connect to Home Assistant url. Please check the External Url under Configuration -> General", "identifier_exists": "Alexa URL的电子邮件已注册", "invalid_credentials": "Invalid credentials", "unknown_error": "Unknown error, please report log info"