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:
@@ -0,0 +1,39 @@
|
||||
"""Константы интеграции fglair."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pyfglair import State
|
||||
from pyfglair.provision import REGIONS as _PROVISION_REGIONS
|
||||
|
||||
DOMAIN = "fglair"
|
||||
|
||||
CONF_HOST = "host"
|
||||
CONF_DEVICE_PORT = "device_port"
|
||||
CONF_DSN = "dsn"
|
||||
CONF_LANIP_KEY = "lanip_key"
|
||||
CONF_LANIP_KEY_ID = "lanip_key_id"
|
||||
CONF_MODEL = "model"
|
||||
CONF_TEMPLATE = "template"
|
||||
CONF_NAME = "name"
|
||||
CONF_LISTEN_PORT = "listen_port"
|
||||
CONF_KEEPALIVE_MS = "keepalive_ms"
|
||||
CONF_REGION = "region"
|
||||
CONF_EMAIL = "email"
|
||||
CONF_PASSWORD = "password"
|
||||
CONF_CONFIG_JSON = "config_json"
|
||||
|
||||
DEFAULT_DEVICE_PORT = 80
|
||||
DEFAULT_LISTEN_PORT = 10275
|
||||
DEFAULT_KEEPALIVE_MS = 15000
|
||||
TRIAL_TIMEOUT = 10.0
|
||||
|
||||
REGIONS = sorted(_PROVISION_REGIONS)
|
||||
|
||||
TRIAL_ERRORS = {
|
||||
"no_slots": "no_slots",
|
||||
"key_mismatch": "key_mismatch",
|
||||
"unreachable": "cannot_connect",
|
||||
"timeout": "timeout",
|
||||
"start_failed": "cannot_connect",
|
||||
}
|
||||
|
||||
STATE_FAILED = {State.OFFLINE, State.KEY_ERROR}
|
||||
Reference in New Issue
Block a user