デバイスの属性¶
属性は、firmware_version、polling_interval_seconds、fleet_tier など、モノに添付されるキー/値ファクトです。すべての属性は、誰が書き込むか、デバイスと同期するかどうかが異なる 3 つの バケット の 1 つに存在します。デバイス インテグレーターは、3 つのうち 2 つと連携します。
3つのバケツ¶
区分 |
誰が書くのか |
デバイスの同期 |
キーの例 |
|---|---|---|---|
CLIENT |
デバイスのみ |
デバイスがレポートをアップします。クラウドが読み取ります |
|
SHARED |
クラウドとデバイス |
両方向 |
|
SERVER |
クラウドのみ |
デバイスに送信されることはありません |
テナント側組織のみ |
デバイスのファームウェアは CLIENT (報告する事実) と SHARED (受信して確認する設定) にアクセスします。 SERVER バケットはクラウド側の組織であり、デバイスに到達することはありません。無視してかまいません。
キーはあなたが定義します。キーは ^[a-zA-Z_][a-zA-Z0-9_]{0,62}$ と一致する必要があります。値には、文字列、数値、ブール値、小さなオブジェクト、または配列を指定できます。
クライアント — 事実を報告する¶
デバイスは、CLIENT 属性の信頼できる情報源です。接続時および変更があったときにレポートします。クラウドはそれらを読み取ることはできますが、書き込むことはできません。 CLIENT レポートは、デバイスの既存のレポート状態チャネルに基づいて行われます。構築するための個別のワイヤー メッセージはありません。
同じキーに対する 2 つのレポートが順番どおりに到着しない場合、プラットフォームは 後のデバイス タイムスタンプ (デバイス時間による最後の書き込み者が勝ち) を持つレポートを保持するため、遅延または再生されたレポートが新しい値を上書きすることはありません。
ワイヤートピック¶
CLIENT と SHARED は、デバイス独自のサブツリーで次のトピックを使用します (デバイス MQTT トピック アクセス を参照)。
トピック |
方向 |
伝送内容 |
|---|---|---|
|
デバイス→クラウド |
報告された CLIENT 属性 (報告された状態のワイヤー) |
|
クラウド→デバイス |
影響を与える SHARED 値 |
|
デバイス→クラウド |
影響を受けた値の承認 |
凍結されたワイヤー メッセージ (DeviceAttributeSharedPush、DeviceAttributeSharedAck) は、DDI-1 契約 で定義されています。手動でエンコードするのではなく、以下の SDK を使用してください。
Python SDK¶
デバイス側の DDI SDK (SiriusVoyager/ddi、Python) は両方向を処理します。クライアントを構築し、SHARED コールバックを登録し、CLIENT 属性を報告します。
from fgai_mqtt import FGAIDeviceClient, DeviceConfig
client = FGAIDeviceClient(DeviceConfig(device_id="my-thing-id", ...))
# Receive SHARED-bucket pushes from the cloud. The SDK effects the value into a
# local shadow and publishes the ack for you — your callback just applies it.
def apply_shared(key, value):
print(f"cloud set {key} = {value}")
client.set_shared_attribute_callback(apply_shared)
client.connect()
# Report CLIENT-bucket facts up to the cloud.
client.report_client_attribute({"firmware_version": "8.4.2", "boot_count": 12})
# The last SHARED values the device received + effected:
print(client.shared_attribute_shadow)
呼び出し |
区分 |
何をするのか |
|---|---|---|
|
CLIENT |
デバイス所有の事実を報告する |
|
SHARED |
|
|
SHARED |
デバイスの最後に有効な SHARED 値 ( |
SDK はコールバックの実行後に常に SHARED 確認応答を発行するため、コールバックが発生した場合でも、クラウドの実効値の記録はデバイスと同期したままになります。
Did my change reach the device?¶
A cloud write to the SHARED bucket is sent over the device's live session, or
queued for its next connection. The /attribute-pushes/v1/things/{thing_id}
capability reports the dispatch status of those writes — per attribute key,
what the platform did with each request:
|
何をするのか |
|---|---|
|
the device was offline; the request is queued and will be sent on its next connection ( |
|
the request was published on a live device session |
|
the request was abandoned — the retry budget was spent, or it aged out of the queue — and will not be retried |
fgai attribute-pushes things-get --thing <thing-id> # newest first, every attribute key
Reading this surface requires a grant. The caller's principal must hold
ThingIoAttributePushReadAccess (attach it to a service principal with
fgai identity policy attach --account <id> --policy <policy-id>). A caller
without it is refused with a policy error whose body names the missing
action (thingio:AttributePush:Read) — read the action field rather than
assuming a generic denial. Error bodies are converging to RFC 7807
application/problem+json across Thing* services (PLT-0095); consult the
response body, not just the status code.
What this surface is not:
pusheddoes not mean applied. It means the platform published the down-channel message to a live session — not that the device received it, and not that the device applied it. Nothing here claims a configuration is in effect on a device.It never reports a device acknowledgement. The device's SHARED-bucket ACK (see the SDK's auto-ack above) is recorded in the attribute audit —
GET /attributes/v1/things/{thing_id}/auditshows the wire change whose source is the device. An acknowledgement is evidence the device received the value, which is still not the same claim as "applied".SERVER-bucket values have no dispatch status at all — they never touch a device.
The attribute audit is not the platform audit chain.
GET /attributes/v1/things/{thing_id}/auditreads the attribute-change audit (attribute_audit); business events such as enrollment are in the audit chain and do not appear here. A tenant read of the chain by target FRN is tracked in trustmint#525.
Each row carries the attribute key, the version the request was made at,
attempts (delivery attempts spent), superseded (a later request exists for
the same key — the device drains in order, so the newer request wins),
retry_pending, and created_at / updated_at timestamps. Attribute values
are not repeated here; read those through the attribute API, where your normal
permissions apply.