{
  "name": "IOT device control with MQTT and webhook",
  "nodes": [
    {
      "id": "3d3b2e80-4e4e-43ec-b2fd-7000e7307915",
      "name": "MQTT Publish Topic Node",
      "type": "n8n-nodes-base.mqtt",
      "position": [
        680,
        -20
      ]
    },
    {
      "id": "f4444f19-424a-487b-8d7c-3c609a55b913",
      "name": "Set data for MQTT message payload",
      "type": "n8n-nodes-base.set",
      "position": [
        360,
        -20
      ]
    },
    {
      "id": "3ed996b8-419f-458a-a717-b35e1a52a851",
      "name": "IOT control Webhook ",
      "type": "n8n-nodes-base.webhook",
      "position": [
        20,
        -20
      ]
    },
    {
      "id": "40fa6c2a-c515-412b-93df-eceb993c38c9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -160
      ],
      "parameters": {
        "width": null,
        "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 "
      }
    },
    {
      "id": "159f8c6e-285a-443a-bd9d-ae3456b9a6a8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -140
      ],
      "parameters": {
        "width": null,
        "height": 80,
        "content": "The set node prepares the receive data as a message payload for the MQTT topic"
      }
    },
    {
      "id": "250140e6-f46c-42c2-b79a-537ec4975b97",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        -160
      ],
      "parameters": {
        "width": null,
        "height": 100,
        "content": "Publishes MQTT topic \"pin-control\" with the payload data to control the GPIO on the ESP32 microcontroller"
      }
    }
  ],
  "connections": {
    "IOT control Webhook ": {
      "main": [
        [
          {
            "node": "Set data for MQTT message payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set data for MQTT message payload": {
      "main": [
        [
          {
            "node": "MQTT Publish Topic Node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}