Удаление файла
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Генератор JSON-экспорта Open WebUI из home_assistant_tools.py.
|
||||
|
||||
Запуск:
|
||||
1. Скачайте оба файла в одну папку
|
||||
2. python3 make_export.py
|
||||
3. Получите home_assistant_tool.json
|
||||
|
||||
Или одной командой (Linux/macOS/TrueNAS/Proxmox):
|
||||
curl -sSL https://gitea.nasweb.ru/host/home-assistant-tools/raw/branch/main/make_export.py | python3
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SRC = Path(__file__).parent / "home_assistant_tools.py"
|
||||
OUT = Path(__file__).parent / "home_assistant_tool.json"
|
||||
|
||||
# Если запущен из stdin (через curl | python3) — качаем .py сами
|
||||
if not SRC.exists():
|
||||
print("home_assistant_tools.py не найден рядом, скачиваю...", file=sys.stderr)
|
||||
url = "https://gitea.nasweb.ru/host/home-assistant-tools/raw/branch/main/home_assistant_tools.py"
|
||||
try:
|
||||
SRC.write_text(urllib.request.urlopen(url, timeout=15).read().decode("utf-8"), encoding="utf-8")
|
||||
print("OK: скачан", SRC, file=sys.stderr)
|
||||
except Exception as e:
|
||||
print("ОШИБКА скачивания:", e, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
content = SRC.read_text(encoding="utf-8")
|
||||
|
||||
payload = {
|
||||
"type": "tool",
|
||||
"name": "Home Assistant Smart Control",
|
||||
"version": "2.2.2",
|
||||
"description": (
|
||||
"Управление умным домом через Home Assistant REST API с интерпретацией "
|
||||
"естественного языка. Управление светом/климатом/шторами/медиа и мониторинг "
|
||||
"(окна, свет, температура, батарейки, присутствие)."
|
||||
),
|
||||
"author": "ChatGPT (refactored by MiniMax-M3)",
|
||||
"license": "MIT",
|
||||
"content": content,
|
||||
"metadata": {
|
||||
"ha_default_url": "https://ha.nasweb.ru",
|
||||
"ha_default_verify_ssl": False,
|
||||
"source_repo": "https://gitea.nasweb.ru/host/home-assistant-tools",
|
||||
},
|
||||
}
|
||||
|
||||
OUT.write_text(
|
||||
json.dumps(payload, ensure_ascii=False, indent=2),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
print("OK: создан", OUT)
|
||||
print("Размер:", OUT.stat().st_size, "байт")
|
||||
print()
|
||||
print("Дальше:")
|
||||
print(" 1. Открой Open WebUI -> Workspace -> Tools -> Импорт")
|
||||
print(" 2. В поле URL вставь путь к этому JSON или загрузи файл")
|
||||
print(" 3. Укажи HA Token в Valves")
|
||||
Reference in New Issue
Block a user