MQTTとwebhookによるIoT制御

中級

これはEngineering分野の自動化ワークフローで、6個のノードを含みます。主にSet, Mqtt, Webhookなどのノードを使用。 MQTTとwebhookを使用したIoTデバイスの制御

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)

使用ノード (6)

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "01UHgh673YDyv5xN",
  "meta": {
    "instanceId": "7221598654c32899e94731aab144bdcd338735c2ac218dc0873131caa0be0ef8",
    "templateCredsSetupCompleted": true
  },
  "name": "IOT control via MQTT and webhook",
  "tags": [],
  "nodes": [
    {
      "id": "3d3b2e80-4e4e-43ec-b2fd-7000e7307915",
      "name": "MQTT Publish Topic Node",
      "type": "n8n-nodes-base.mqtt",
      "position": [
        680,
        -20
      ],
      "parameters": {
        "topic": "pin-control",
        "message": "={{ $json.pin }}",
        "options": {},
        "sendInputData": false
      },
      "credentials": {
        "mqtt": {
          "id": "xtd75tjk1hKlQOba",
          "name": "MQTT account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f4444f19-424a-487b-8d7c-3c609a55b913",
      "name": "MQTTメッセージペイロードのデータ設定",
      "type": "n8n-nodes-base.set",
      "position": [
        360,
        -20
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "pin",
              "value": "={{ $json.query.value }}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "id": "3ed996b8-419f-458a-a717-b35e1a52a851",
      "name": "IOT制御 Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        20,
        -20
      ],
      "webhookId": "69036479-fe77-40e1-a700-8a2e2602e0c8",
      "parameters": {
        "path": "pin-control",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "40fa6c2a-c515-412b-93df-eceb993c38c9",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -160
      ],
      "parameters": {
        "height": 120,
        "content": "When the \"on\" or \"off\" button is clicked on the IOT control webpage the webhook gets the selected value and triggers the workflow "
      },
      "typeVersion": 1
    },
    {
      "id": "159f8c6e-285a-443a-bd9d-ae3456b9a6a8",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -140
      ],
      "parameters": {
        "height": 80,
        "content": "The set node prepares the receive data as a message payload for the MQTT topic"
      },
      "typeVersion": 1
    },
    {
      "id": "250140e6-f46c-42c2-b79a-537ec4975b97",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        -160
      ],
      "parameters": {
        "height": 100,
        "content": "Publishes MQTT topic \"pin-control\" with the payload data to control the GPIO on the ESP32 microcontroller"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f5d124a9-c6e1-44f5-b088-cafb8e5bd602",
  "connections": {
    "3ed996b8-419f-458a-a717-b35e1a52a851": {
      "main": [
        [
          {
            "node": "f4444f19-424a-487b-8d7c-3c609a55b913",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f4444f19-424a-487b-8d7c-3c609a55b913": {
      "main": [
        [
          {
            "node": "3d3b2e80-4e4e-43ec-b2fd-7000e7307915",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - エンジニアリング

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

ワークフロー情報
難易度
中級
ノード数6
カテゴリー1
ノードタイプ4
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34