INNER CODE UNIT · Python

_require_str

3dg1luk43/ha_washdata · custom_components/ha_washdata/__init__.py:149

def _require_str(value: Any, name: str) -> str:
    if not isinstance(value, str) or not value:
        raise ServiceValidationError(
            translation_domain=DOMAIN,
            translation_key=f"{name}_required",
        )
    return value


async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Migrate config entry to the latest version while preserving settings."""
    _log = DeviceLoggerAdapter(_LOGGER, entry.title)
    version = entry.version or 1
    minor_version = entry.minor_version or 1

    if version > CONFIG_ENTRY_VERSION:
        _log.error(
            "Refusing to migrate unsupported future schema %s.%s", version, minor_version

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…