8
n8n 中文网amn8n.com

太阳能发电监测预警工作流

中级

这是一个Engineering, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 If, Code, Gmail, Slack, HttpRequest 等节点。 监控太阳能发电并通过Gmail、Google表格和Slack发送警报

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "xJ07Z5jW0ZtOFRRn",
  "meta": {
    "instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
    "templateCredsSetupCompleted": true
  },
  "name": "太阳能发电监测预警工作流",
  "tags": [],
  "nodes": [
    {
      "id": "39adba14-16e8-4a0d-bf52-5fa72a2db102",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        -240
      ],
      "parameters": {
        "width": 1440,
        "height": 440,
        "content": "## 太阳能发电监测预警工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "6a3798bc-bcd7-4b63-baad-be18c170d2de",
      "name": "触发器:每2小时运行",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        -60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 2
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fee7d77b-1e95-4b93-9251-a9e4f1136b57",
      "name": "获取太阳能发电数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -420,
        -60
      ],
      "parameters": {
        "url": "",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0e2e4a6e-e4cf-4987-85e0-ac34aa69ca76",
      "name": "筛选低发电量记录",
      "type": "n8n-nodes-base.code",
      "position": [
        -200,
        -60
      ],
      "parameters": {
        "jsCode": "const inputArray = $input.first().json.records;\n\nconst alerts = [];\n\nfor (const data of inputArray) {\n  if (data.TotalCon < 1000) {\n    alerts.push({\n      json: {\n        ...data,\n        alert: `⚠️ TotalCon too low: ${data.TotalCon}`\n      }\n    });\n  }\n}\n\nreturn alerts;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "3163b670-6b90-4c67-8e6b-f027010c9c8d",
      "name": "检查低发电量情况",
      "type": "n8n-nodes-base.if",
      "position": [
        20,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6c5b6428-1b08-45d7-8ee8-9fb17f47e89a",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.TotalCon }}",
              "rightValue": 1000
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "86160f80-56e9-4049-ba79-5301fe042e47",
      "name": "发送邮件预警(低发电量)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        240,
        -160
      ],
      "webhookId": "6d6ef4be-c6aa-42e8-87fa-dc0ce6e5cffe",
      "parameters": {
        "sendTo": "",
        "message": "=Dear Team,  This is to inform you that the emergency power production has dropped below the acceptable threshold as of {{ $json.HourUTC }}.  Details:  Production Level: {{ $json.TotalCon }} MW  Threshold Level: 1000 MW  This could potentially impact dependent systems or operations. Please take immediate action to investigate and restore power production to safe levels.  If you require assistance or further diagnostics, kindly escalate to the relevant maintenance or energy management team.  Stay safe, [Your System Name / Monitoring Service]",
        "options": {},
        "subject": "Critical Alert: Emergency Power Generation Below Threshold"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YqeBbKp4FvFiADc0",
          "name": "Gmail account 7"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ff45f4cb-f910-4d3d-ae20-9395761543e5",
      "name": "记录有效发电数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        40
      ],
      "parameters": {
        "columns": {
          "value": {
            "alert": "={{ $json.alert }}",
            "HourDK": "={{ $json.HourDK }}",
            "HourUTC": "={{ $json.HourUTC }}",
            "TotalCon": "={{ $json.TotalCon }}",
            "PriceArea": "={{ $json.PriceArea }}",
            "ConsumerType_DE35": "={{ $json.ConsumerType_DE35 }}"
          },
          "schema": [
            {
              "id": "HourUTC",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "HourUTC",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "HourDK",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "HourDK",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "PriceArea",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "PriceArea",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ConsumerType_DE35",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ConsumerType_DE35",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TotalCon",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "TotalCon",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "alert",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "alert",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "HourUTC"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1111398960,
          "cachedResultUrl": "",
          "cachedResultName": "energy_production"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1cQ-TBf3-dqo7njDYzYpxpASYFvEp8lIzH7vpIqTLcwc",
          "cachedResultUrl": "",
          "cachedResultName": "N8N_Email_Attachment"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets account 6"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "ebcb1b27-011c-4f82-816a-a0ba3b157325",
      "name": "在 Slack 发布摘要",
      "type": "n8n-nodes-base.slack",
      "position": [
        460,
        40
      ],
      "webhookId": "6aad9533-f27d-40d3-a566-3e3df9707410",
      "parameters": {
        "text": "={{ $json.TotalCon }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "",
          "name": "Interview_feedback_Slack"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "99700ad8-ab8c-45a2-a37a-f6d7b0f761fa",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        240
      ],
      "parameters": {
        "width": 1440,
        "height": 480,
        "content": "## **节点详解与说明:**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9874b516-8f7f-47a9-a12a-fc2d48cf9751",
  "connections": {
    "Trigger: Every 2 Hours": {
      "main": [
        [
          {
            "node": "Fetch Solar Production Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Low Production": {
      "main": [
        [
          {
            "node": "Send Email Alert (Low Production)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Valid Production Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Valid Production Data": {
      "main": [
        [
          {
            "node": "Post Summary to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Solar Production Data": {
      "main": [
        [
          {
            "node": "Filter Low Production Entries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Low Production Entries": {
      "main": [
        [
          {
            "node": "Check for Low Production",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 工程, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量9
分类2
节点类型8
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
WeblineIndia

WeblineIndia

@weblineindia

A Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.

外部链接
在 n8n.io 查看

分享此工作流