はじめに
最適な製品を選ぶ
Edge、Cloud、Enterprise から適切な Tier0 エディションを選びます。
各製品の詳しい機能は料金ページで確認し、用途に合うエディションを選んでください。
- UNS 上でアプリを構築 — Enterprise に Tier0 アプリを構築・デプロイします。
- インストール — 選んだエディションのセットアップ手順に従います。
Edge、Cloud、Enterprise から適切な Tier0 エディションを選びます。
各製品の詳しい機能は料金ページで確認し、用途に合うエディションを選んでください。
エディション別に Tier0 をインストールします。
Tier0 には 3 つのエディションがあります。
要件に最も合うエディションを選ぶには、最適なバージョンを選ぶ を参照してください。
Tier0 Cloud を試す前に、トライアルアカウントを申請してください。
sha256sum -c tier0-enterprise-offline-standard-YYYYmmddTHHMMSS.tar.gz.sha256tar -xzf tier0-enterprise-offline-standard-YYYYmmddTHHMMSS.tar.gzcd tier0-enterprise-offline-standard-YYYYmmddTHHMMSSinstall.env を編集し、デプロイを開始します。
vi install.envbash install.sh./install.sh --check-only./full-cleanup.sh --env install.env --yesこのコマンドは、VM、OS、インストール済み Docker ソフトウェアを残したまま、Tier0 のランタイムデータとデータベースバックアップを削除します。
runtime/install-reports/<timestamp>/deployment-report.mdレポートに FAIL 項目がある場合は、プロジェクトを引き渡さず、先にサポートに連絡してください。
Tier0 を使い始めるための推奨手順。
flowchart TD app["アプリを構築"] namespace["Namespace を作成"] external["外部データを接続(任意)"] use["アプリで統合データを利用"] app --> namespace --> external --> use namespace -.->|"任意の手順を省略"| use classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717 class use t0accent
| 操作 | 担当 | エディション | 説明 |
|---|---|---|---|
| アプリを構築 | あなた | Cloud | Agent と対話してカスタムアプリを作成します。 |
| Namespace を作成 | Agent | Cloud | アプリの業務ロジックに基づいて Namespace とデータモデルを作成します。 |
| 外部データを接続(任意) | あなた | Cloud、Enterprise | 必要に応じて、接続する既存の業務システムやデバイスの情報を Agent に提供します。 |
| データを統合 | Agent | Cloud、Enterprise | 外部データを既存のアプリのモデルにマッピング、変換、統合します。 |
アプリ向けの外部データを接続し、Tier0 でモデル化・統合します。
Tier0 はカスタムアプリのデータ基盤を作ります。アプリから業務データを受け取り、既存のシステムやデバイスに接続し、アプリで使える統一モデルにデータを統合します。
すべてのデータは Namespace 配下の Tables にモデル化され、データ型に応じて整理されます。
flowchart TB namespace["Namespace"] --> table["Table"] table --> record["Record テーブル<br/>リレーショナルデータ"] table --> sample["Sample テーブル<br/>時系列データ"] classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717 class table t0accent
業務データはアプリの利用または外部システムから取得します。時系列データは主に接続したデバイスから取得します。
flowchart LR app["アプリ"] -->|"業務データ"| record["Record"] stream["Stream"] -->|"デバイスデータ"| sample["Sample"] classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717 class record,sample t0accent
flowchart LR source["Source<br/>サーバーに接続"] --> stream["Stream<br/>収集と処理"] classDef t0accent fill:#B2ED1D,stroke:#73B200,color:#171717 class source,stream t0accent
プロンプトで明示しない限り、Agent がアプリの業務ロジックからデータモデルを自動生成します。
Enterprise のデータ基盤構築手順は今後追加します。
Edge のデータ基盤構築手順は今後追加します。
MQTT と API で UNS データを操作し、API リファレンスを参照します。
MQTT と API を通じて UNS データを操作できます。
Tier0 で生成した認証情報を使って MQTT クライアントを UNS broker に接続できます。
Connect > Source > MQTT Device で MQTT 認証情報を生成し、記録します。
{ "Host": "mqtt.tier0.dev", "Port": 1883, "Client ID": "<generated client ID>", "Username": "<generated username>", "Password": "<generated password>"}{ "Protocol": "mqtt://", "Host": "mqtt.tier0.dev", "Port": 1883, "Username": "<generated username>", "Password": "<generated password>"}mqtt in ノードに次の情報でサーバーを追加します。
{ {/* under Connection */} "Server": "mqtt://mqtt.tier0.dev", "Port": 1883, "Client ID": "<generated clientId>", {/* under Security */} "Username": "<generated username>", "Password": "<generated password>"}https://<your-tier0-host>/openapi/v2x-api-key ヘッダーに指定します。POST /uns/metadata:find — Tables を一覧表示して Table ID を取得
const base = "https://your-tier0-host/openapi/v2";const response = await fetch(`${base}/uns/metadata:find`, { method: "POST", headers: { "content-type": "application/json", "x-api-key": "your-api-key" }, body: JSON.stringify({"kind": "collection", "filter": {}, "page": {"mode": "offset", "page": 1, "size": 20}}),});const result = await response.json();if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);console.log(result.data.items);import requests
response = requests.post( "https://your-tier0-host/openapi/v2/uns/metadata:find", headers={"x-api-key": "your-api-key"}, json={"kind": "collection", "filter": {}, "page": {"mode": "offset", "page": 1, "size": 20}}, timeout=30,)response.raise_for_status()result = response.json()if result["code"] != 0: raise RuntimeError(result.get("error", result.get("msg")))print(result["data"]["items"])curl --fail-with-body -X POST "https://your-tier0-host/openapi/v2/uns/metadata:find" \ -H "content-type: application/json" \ -H "x-api-key: your-api-key" \ -d '{"kind": "collection", "filter": {}, "page": {"mode": "offset", "page": 1, "size": 20}}'POST /uns/collections/{collectionId}/records:find — Records を一覧表示して Record ID を取得
const base = "https://your-tier0-host/openapi/v2";const collectionId = "your-collection-id";const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/records:find`, { method: "POST", headers: { "content-type": "application/json", "x-api-key": "your-api-key" }, body: JSON.stringify({"limit": 20}),});const result = await response.json();if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);console.log(result.data);import requests
response = requests.post( "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/records:find", headers={"x-api-key": "your-api-key"}, json={"limit": 20}, timeout=30,)response.raise_for_status()result = response.json()if result["code"] != 0: raise RuntimeError(result.get("error", result.get("msg")))print(result["data"])curl --fail-with-body -X POST "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/records:find" \ -H "content-type: application/json" \ -H "x-api-key: your-api-key" \ -d '{"limit": 20}'POST /uns/collections/{collectionId}/samples:latest — Record の最新 Sample を取得
const base = "https://your-tier0-host/openapi/v2";const collectionId = "your-collection-id";const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/samples:latest`, { method: "POST", headers: { "content-type": "application/json", "x-api-key": "your-api-key" }, body: JSON.stringify({"recordIds": ["record_123"]}),});const result = await response.json();if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);console.log(result.data);import requests
response = requests.post( "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/samples:latest", headers={"x-api-key": "your-api-key"}, json={"recordIds": ["record_123"]}, timeout=30,)response.raise_for_status()result = response.json()if result["code"] != 0: raise RuntimeError(result.get("error", result.get("msg")))print(result["data"])curl --fail-with-body -X POST "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/samples:latest" \ -H "content-type: application/json" \ -H "x-api-key: your-api-key" \ -d '{"recordIds": ["record_123"]}'POST /uns/collections/{collectionId}/samples:find — 指定期間の Samples を取得
const base = "https://your-tier0-host/openapi/v2";const collectionId = "your-collection-id";const response = await fetch(`${base}/uns/collections/${encodeURIComponent(collectionId)}/samples:find`, { method: "POST", headers: { "content-type": "application/json", "x-api-key": "your-api-key" }, body: JSON.stringify({"recordIds": ["record_123"], "from": 1792454400000, "to": 1792540800000, "filter": {"temperature": {"$gt": 20}}, "limit": 20}),});const result = await response.json();if (!response.ok || result.code !== 0) throw new Error(result.error?.code || result.msg);console.log(result.data);import requests
response = requests.post( "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/samples:find", headers={"x-api-key": "your-api-key"}, json={"recordIds": ["record_123"], "from": 1792454400000, "to": 1792540800000, "filter": {"temperature": {"$gt": 20}}, "limit": 20}, timeout=30,)response.raise_for_status()result = response.json()if result["code"] != 0: raise RuntimeError(result.get("error", result.get("msg")))print(result["data"])curl --fail-with-body -X POST "https://your-tier0-host/openapi/v2/uns/collections/your-collection-id/samples:find" \ -H "content-type: application/json" \ -H "x-api-key: your-api-key" \ -d '{"recordIds": ["record_123"], "from": 1792454400000, "to": 1792540800000, "filter": {"temperature": {"$gt": 20}}, "limit": 20}'MCP を介して AI Agent を Tier0 に接続します。
MCP を介して AI Agent を Tier0 に接続します。Agent は付与された権限の範囲でプラットフォーム API を検索して使用できます。
{ "Authorization": "Bearer <your-personal-api-key>" }whoami を実行させ、接続を確認します。codex mcp add tier0 --url https://your-tier0-url/mcp --oauth-client-registration dcrcodex mcp login tier0 --oauth-client-registration dcrwhoami を実行させ、接続を確認します。| MCP ツール | 用途 |
|---|---|
whoami |
ID と権限を確認します。 |
docs |
API ドキュメントを読みます。 |
search |
API 操作を探します。 |
execute |
API 操作を呼び出します。 |
まず docs と search で操作を探し、次に execute で呼び出します。例:
Workspace の `Plant/Line1/Metric/Temperature` の現在値を読み取ってください。工場データの操作 — Tier0 が工場データを整理、提供する方法を確認します。
Tier0 は OPC UA、Modbus、MQTT など、さまざまな産業用プロトコルへの接続に対応しています。
{ "name": "ua", "description": "", "protocol": "opcua", "endpoint": "opc.tcp://220.184.175.73:4841/demo/", "runtimeLocation": "local", "opcua": { "securityMode": "None", "securityPolicy": "None" }}サーバーアドレスとユニット ID のみが必要です。
{ "name": "modbus", "description": "", "protocol": "modbus-tcp", "endpoint": "tcp://220.184.175.73:1502", "runtimeLocation": "local", "modbus": { "unitId": 1 }}Tier0 は、デバイスからデータを受信する MQTT Broker としても、外部 MQTT Broker に接続するクライアントとしても使用できます。
Broker として:
クライアントとして:サードパーティーの Broker に接続します。
{"name": "111","description": "","protocol": "mqtt","endpoint": "mqtt://220.184.175.73:1883","runtimeLocation": "local","mqtt": { "clientId": "tier0UxxxxxxxxuwQVfi"}}Tier0 は、外部からアクセスできる HTTP サーバーとしても、他の HTTP サーバーの API を呼び出すクライアントとしても使用できます。
サーバーとして:
クライアントとして:サードパーティーの HTTP サーバーに接続します。
{ "name": "222", "description": "", "protocol": "http-api", "endpoint": "http://220.184.175.73:8088/api/telemetry", "runtimeLocation": "local", "role": "client", "http": { "authentication": "none" }}{ "name": "eee", "description": "", "protocol": "edge-sql", "endpoint": "mysql://hzoffice.tier0.dev:3307/demo_factory", "runtimeLocation": "local", "sql": { "queries": { "query1": "SELECT * FROM telemetry ORDER BY id DESC LIMIT 5" }, "tlsMode": "verify-full" }, "credentialRef": "ref_9ce47b8778xxxxxxxx7dad49a86dbad"}