Opengarage bug fix (#56869)

* Opengarage bug fix

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Opengarage bug fix

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Deprecated open garage config

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Deprecated open garage config

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
Daniel Hjelseth Høyer 2021-10-01 09:12:45 +02:00 committed by GitHub
parent 3f5725c6ea
commit d4201eaa23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -60,13 +60,14 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import(self, import_info):
"""Set the config entry up from yaml."""
import_info[CONF_HOST] = (
f"{'https' if import_info[CONF_SSL] else 'http'}://"
f"{import_info.get(CONF_HOST)}"
)
del import_info[CONF_SSL]
return await self.async_step_user(import_info)
user_input = {
CONF_DEVICE_KEY: import_info[CONF_DEVICE_KEY],
CONF_HOST: f"{'https' if import_info.get(CONF_SSL, False) else 'http'}://{import_info[CONF_HOST]}",
CONF_PORT: import_info.get(CONF_PORT, DEFAULT_PORT),
CONF_VERIFY_SSL: import_info.get(CONF_VERIFY_SSL, False),
}
return await self.async_step_user(user_input)
async def async_step_user(
self, user_input: dict[str, Any] | None = None

View file

@ -50,15 +50,16 @@ COVER_SCHEMA = vol.Schema(
)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
vol.All(
cv.deprecated(DOMAIN),
{vol.Required(CONF_COVERS): cv.schema_with_slug_keys(COVER_SCHEMA)},
),
{vol.Required(CONF_COVERS): cv.schema_with_slug_keys(COVER_SCHEMA)}
)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the OpenGarage covers."""
_LOGGER.warning(
"Open Garage YAML configuration is deprecated, "
"it has been imported into the UI automatically and can be safely removed"
)
devices = config.get(CONF_COVERS)
for device_config in devices.values():
hass.async_create_task(