Toon translation updates + tweaks (#37043)

This commit is contained in:
Franck Nijhof 2020-06-24 00:04:16 +02:00 committed by GitHub
parent ed89d4869d
commit c289f9f099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 31 deletions

View File

@ -146,14 +146,17 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await hass.data[DOMAIN][entry.entry_id].unregister_webhook() await hass.data[DOMAIN][entry.entry_id].unregister_webhook()
# Unload entities for this entry/device. # Unload entities for this entry/device.
await asyncio.gather( unload_ok = all(
*( await asyncio.gather(
hass.config_entries.async_forward_entry_unload(entry, component) *(
for component in ENTITY_COMPONENTS hass.config_entries.async_forward_entry_unload(entry, component)
for component in ENTITY_COMPONENTS
)
) )
) )
# Cleanup # Cleanup
del hass.data[DOMAIN][entry.entry_id] if unload_ok:
del hass.data[DOMAIN][entry.entry_id]
return True return unload_ok

View File

@ -1,33 +1,23 @@
{ {
"config": { "config": {
"step": { "step": {
"authenticate": { "pick_implementation": {
"title": "Link your Toon account", "title": "Choose your tenant to authenticate with"
"description": "Authenticate with your Eneco Toon account (not the developer account).",
"data": {
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]",
"tenant": "Tenant"
}
}, },
"display": { "agreement": {
"title": "Select display", "title": "Select your agreement",
"description": "Select the Toon display to connect with.", "description": "Select the agreement address you want to add.",
"data": { "data": {
"display": "Choose display" "agreement": "Agreement"
} }
} }
}, },
"error": {
"credentials": "The provided credentials are invalid.",
"display_exists": "The selected display is already configured."
},
"abort": { "abort": {
"client_id": "The client ID from the configuration is invalid.", "already_configured": "The selected agreement is already configured.",
"client_secret": "The client secret from the configuration is invalid.", "authorize_url_fail": "Unknown error generating an authorize url.",
"unknown_auth_fail": "Unexpected error occurred, while authenticating.", "authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_agreements": "This account has no Toon displays.", "missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"no_app": "You need to configure Toon before being able to authenticate with it. [Please read the instructions](https://www.home-assistant.io/components/toon/)." "no_agreements": "This account has no Toon displays."
} }
} }
} }

View File

@ -59,9 +59,7 @@ class ToonSwitch(ToonEntity, SwitchEntity):
def unique_id(self) -> str: def unique_id(self) -> str:
"""Return the unique ID for this binary sensor.""" """Return the unique ID for this binary sensor."""
agreement_id = self.coordinator.data.agreement.agreement_id agreement_id = self.coordinator.data.agreement.agreement_id
# This unique ID is a bit ugly and contains unneeded information. return f"{agreement_id}_{self.key}"
# It is here for legacy / backward compatible reasons.
return f"{DOMAIN}_{agreement_id}_switch_{self.key}"
@property @property
def is_on(self) -> bool: def is_on(self) -> bool: