ha(H2): компонент fglair — manifest, config flow (облако/ручной/импорт), пробная сессия

- custom_components/fglair: manifest (config_flow, local_push, requirements),
  const, trial (start -> ONLINE <=10 c -> GET базовых свойств), FglairClient
  (сессия pyfglair в executor, колбэки в loop, --runtime_data),
  __init__ (setup/unload, рефкаунт глобального лог-пампа)
- config flow: меню cloud/manual/import_json + import-source; discover через
  pyfglair.provision; пробное подключение с диагностикой (cannot_connect,
  no_slots, key_mismatch, timeout, invalid_auth, invalid_import); unique_id=dsn
- strings.json + translations/{en,ru}.json
- тесты HA (pytest-homeassistant-custom-component): меню/шаги/ошибки/импорт/
  облако (discover замокан), setup/unload, занятый порт; trial против
  mock_ac.py (online/key_mismatch/unreachable/no_slots)
- pytest.ini (общий), tests/conftest перенесён на уровень tests/,
  scripts/py-ci.sh: --setup-ha и прогон tests/components
This commit is contained in:
2026-09-29 12:03:44 +03:00
parent 397be6236d
commit 26d1d6d64f
21 changed files with 1400 additions and 20 deletions
@@ -0,0 +1,77 @@
{
"config": {
"step": {
"user": {
"title": "FGLair",
"menu_options": {
"cloud": "Cloud sign-in (FGLair account)",
"manual": "Manual setup",
"import_json": "Import config_*.json"
}
},
"cloud": {
"title": "FGLair cloud sign-in",
"description": "Used once for provisioning: fetches the static LAN key of the device.",
"data": {
"email": "Email",
"password": "Password",
"region": "Region"
},
"data_description": {
"region": "FGLair/Ayla account region"
}
},
"cloud_device": {
"title": "Select air conditioner",
"data": {
"dsn": "Device"
}
},
"manual": {
"title": "Device parameters",
"data": {
"host": "Host (IP or DNS name)",
"device_port": "Device port",
"dsn": "DSN",
"lanip_key": "LAN IP key",
"lanip_key_id": "LAN IP key ID",
"name": "Name (optional)",
"model": "Model / oem_model (optional)"
},
"data_description": {
"device_port": "Default 80; change only for port-forwarding setups",
"lanip_key": "From cloud discovery or ESPHome diagnostics"
}
},
"import_json": {
"title": "Import config_*.json",
"data": {
"config_json": "config JSON"
},
"data_description": {
"config_json": "Paste a JSON object produced by fglair-discover or fglctl"
}
}
},
"error": {
"cannot_connect": "Could not connect to the device",
"no_slots": "Both LAN slots are busy (FGLair app or ESPHome connected). Close one and retry",
"key_mismatch": "LAN key does not match the device; re-run discovery or re-import the config",
"timeout": "Timed out waiting for the device to come online",
"invalid_auth": "Invalid email or password",
"invalid_import": "Invalid config JSON",
"no_devices": "No devices found in the account",
"unknown": "Unexpected error"
},
"abort": {
"already_configured": "This device is already configured",
"invalid_import": "Invalid config JSON",
"cannot_connect": "Could not connect to the device",
"no_slots": "Both LAN slots are busy",
"key_mismatch": "LAN key does not match the device",
"timeout": "Timed out waiting for the device",
"start_failed": "Could not start the local FGLair server",
"unknown": "Unexpected error"
}
}
}
@@ -0,0 +1,77 @@
{
"config": {
"step": {
"user": {
"title": "FGLair",
"menu_options": {
"cloud": "Вход в облако FGLair",
"manual": "Ввод параметров вручную",
"import_json": "Импорт config_*.json"
}
},
"cloud": {
"title": "Вход в облако FGLair",
"description": "Нужен однократно для провижинига: получает статический LAN-ключ устройства.",
"data": {
"email": "E-mail",
"password": "Пароль",
"region": "Регион"
},
"data_description": {
"region": "Регион аккаунта FGLair/Ayla"
}
},
"cloud_device": {
"title": "Выбор кондиционера",
"data": {
"dsn": "Устройство"
}
},
"manual": {
"title": "Параметры устройства",
"data": {
"host": "Хост (IP или DNS-имя)",
"device_port": "Порт модуля",
"dsn": "DSN",
"lanip_key": "LAN IP key",
"lanip_key_id": "LAN IP key ID",
"name": "Имя (необязательно)",
"model": "Модель / oem_model (необязательно)"
},
"data_description": {
"device_port": "По умолчанию 80; меняйте только для проброса портов",
"lanip_key": "Из облачного discovery или диагностики ESPHome"
}
},
"import_json": {
"title": "Импорт config_*.json",
"data": {
"config_json": "JSON конфигурации"
},
"data_description": {
"config_json": "Вставьте объект JSON, созданный fglair-discover или fglctl"
}
}
},
"error": {
"cannot_connect": "Не удалось подключиться к устройству",
"no_slots": "Оба LAN-слота заняты (приложение FGLair или ESPHome). Освободите один и повторите",
"key_mismatch": "LAN-ключ не совпадает с устройством; повторите discovery или импортируйте config заново",
"timeout": "Устройство не вышло на связь за отведённое время",
"invalid_auth": "Неверный e-mail или пароль",
"invalid_import": "Некорректный config JSON",
"no_devices": "В аккаунте не найдено устройств",
"unknown": "Неожиданная ошибка"
},
"abort": {
"already_configured": "Устройство уже настроено",
"invalid_import": "Некорректный config JSON",
"cannot_connect": "Не удалось подключиться к устройству",
"no_slots": "Оба LAN-слота заняты",
"key_mismatch": "LAN-ключ не совпадает с устройством",
"timeout": "Устройство не вышло на связь за отведённое время",
"start_failed": "Не удалось запустить локальный сервер FGLair",
"unknown": "Неожиданная ошибка"
}
}
}