s1711880582 发表于 2023-5-26 21:37:50

NodeRed + Surveillance Station Web API + goCQhttp 监控动检自动推送图...

本帖最后由 s1711880582 于 2023-5-26 21:45 编辑

实现的功能,Surveillance动检之后,通过webHook发送信息给NodeRed,NodeRed调用Surveillance API截图 并将截图发送给QQ


先上干货 NodeRed流程图

NodeRed导出的流程图 需要修改才能使用
[
    {
      "id": "674356d4acd058ab",
      "type": "ha-webhook",
      "z": "4f2e767432fb3000",
      "name": "出租屋动检",
      "server": "e71b8837bc864386",
      "version": 1,
      "outputs": 1,
      "webhookId": "PCH3rdMNIzaGDsTNZMmjOXfWDqTP2Rgk",
      "outputProperties": [
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            },
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "data"
            }
      ],
      "payloadLocation": false,
      "payloadLocationType": false,
      "headersLocation": false,
      "headersLocationType": false,
      "x": 270,
      "y": 280,
      "wires": [
            [
                "c69f8e01de570c8b"
            ]
      ]
    },
    {
      "id": "c69f8e01de570c8b",
      "type": "debug",
      "z": "4f2e767432fb3000",
      "name": "接收到Sur动检告警",
      "active": true,
      "tosidebar": true,
      "console": false,
      "tostatus": false,
      "complete": "payload",
      "targetType": "msg",
      "statusVal": "",
      "statusType": "auto",
      "x": 470,
      "y": 300,
      "wires": []
    },
    {
      "id": "912e6cf4155468e0",
      "type": "www-request",
      "z": "4f2e767432fb3000",
      "name": "登录取sid",
      "method": "GET",
      "ret": "obj",
      "url": "http://192.168.1.68:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=6&account=修改此处为你的用户名&passwd=修改此处为你的密码&session=SurveillanceStation&format=sid",
      "follow-redirects": true,
      "persistent-http": true,
      "tls": "",
      "x": 440,
      "y": 400,
      "wires": [
            [
                "2dc4e10728414abc"
            ]
      ]
    },
    {
      "id": "2dc4e10728414abc",
      "type": "function",
      "z": "4f2e767432fb3000",
      "name": "url_snapshot",
      "func": "var sid;\nsid = msg.payload.data.sid;\nmsg.url = 'http://192.168.1.68:5000/webapi/entry.cgi?version=9&id=32&api=%22SYNO.SurveillanceStation.Camera%22&method=%22GetSnapshot%22&profileType=0&_sid='+sid;\nreturn msg;",
      "outputs": 1,
      "noerr": 0,
      "initialize": "",
      "finalize": "",
      "libs": [],
      "x": 610,
      "y": 400,
      "wires": [
            [
                "4c1546eccfaec3e8"
            ]
      ]
    },
    {
      "id": "4c1546eccfaec3e8",
      "type": "www-request",
      "z": "4f2e767432fb3000",
      "name": "得到实时截图",
      "method": "GET",
      "ret": "bin",
      "url": "",
      "follow-redirects": true,
      "persistent-http": true,
      "tls": "",
      "x": 800,
      "y": 400,
      "wires": [
            [
                "cc63aae2755c199f",
                "c649e6c9e9afd69f"
            ]
      ]
    },
    {
      "id": "cc63aae2755c199f",
      "type": "image viewer",
      "z": "4f2e767432fb3000",
      "name": "",
      "width": 160,
      "data": "payload",
      "dataType": "msg",
      "active": false,
      "x": 710,
      "y": 240,
      "wires": [
            []
      ]
    },
    {
      "id": "ef1b1457f984d90c",
      "type": "inject",
      "z": "4f2e767432fb3000",
      "name": "手动测试",
      "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
      ],
      "repeat": "",
      "crontab": "",
      "once": false,
      "onceDelay": 0.1,
      "topic": "",
      "payload": "",
      "payloadType": "date",
      "x": 280,
      "y": 440,
      "wires": [
            [
                "c69f8e01de570c8b",
                "912e6cf4155468e0"
            ]
      ]
    },
    {
      "id": "9e23495c29e8f18d",
      "type": "jimp-image",
      "z": "4f2e767432fb3000",
      "name": "将图片保存",
      "data": "payload",
      "dataType": "msg",
      "ret": "img",
      "parameter1": "/data/CuZuWu_tmp.jpg",
      "parameter1Type": "str",
      "parameter2": "",
      "parameter2Type": "msg",
      "parameter3": "",
      "parameter3Type": "msg",
      "parameter4": "",
      "parameter4Type": "msg",
      "parameter5": "",
      "parameter5Type": "msg",
      "parameter6": "",
      "parameter6Type": "msg",
      "parameter7": "",
      "parameter7Type": "msg",
      "parameter8": "",
      "parameter8Type": "msg",
      "sendProperty": "payload",
      "sendPropertyType": "msg",
      "parameterCount": 1,
      "jimpFunction": "write",
      "selectedJimpFunction": {
            "name": "write",
            "fn": "write",
            "description": "Write to file. NOTE: You can specify an alternative file extension type to change the type. Currently support types are jpg, png, bmp.",
            "parameters": [
                {
                  "name": "filename",
                  "type": "str",
                  "required": true,
                  "hint": "Name of the file",
                  "defaultType": "str"
                }
            ]
      },
      "x": 590,
      "y": 500,
      "wires": [
            [
                "7bb3e8cd21882f08"
            ]
      ]
    },
    {
      "id": "c649e6c9e9afd69f",
      "type": "base64",
      "z": "4f2e767432fb3000",
      "name": "",
      "action": "",
      "property": "payload",
      "x": 440,
      "y": 500,
      "wires": [
            [
                "9e23495c29e8f18d"
            ]
      ]
    },
    {
      "id": "7bb3e8cd21882f08",
      "type": "http request",
      "z": "4f2e767432fb3000",
      "name": "发送消息给QQ",
      "method": "POST",
      "ret": "txt",
      "paytoqs": "ignore",
      "url": "http://修改此处为你的CQ IP地址:5700/send_private_msg?user_id=修改此处为你的QQ号&message=",
      "tls": "",
      "persist": false,
      "proxy": "",
      "insecureHTTPParser": false,
      "authType": "",
      "senderr": false,
      "headers": [],
      "x": 800,
      "y": 500,
      "wires": [
            []
      ]
    },
    {
      "id": "e71b8837bc864386",
      "type": "server",
      "name": "群晖",
      "version": 5,
      "addon": false,
      "rejectUnauthorizedCerts": true,
      "ha_boolean": "y|yes|true|on|home|open",
      "connectionDelay": true,
      "cacheJson": false,
      "heartbeat": false,
      "heartbeatInterval": "30",
      "areaSelector": "friendlyName",
      "deviceSelector": "friendlyName",
      "entitySelector": "friendlyName",
      "statusSeparator": ": ",
      "statusYear": "hidden",
      "statusMonth": "short",
      "statusDay": "numeric",
      "statusHourCycle": "default",
      "statusTimeFormat": "h:m",
      "enableGlobalContextStore": false
    }
]


s1711880582 发表于 2023-5-26 21:42:56

参考的帖子:
https://docs.go-cqhttp.org/cqcode/#%E5%9B%BE%E7%89%87

参考的文件:


写的API测试文件,使用ApiFox导入查看,或者其他的什么



窗寒轻雨 发表于 2023-5-27 11:53:02

收藏了,有待折腾

jole 发表于 2023-5-27 13:02:19

5000/webapi/entry.cgi?version=9&id=32&api=%22SYNO.SurveillanceStation.Camera%22&method=%22GetSnapshot%22&profileType=0&_sid='+sid;

请问这个链接除了改IP,还要改哪些位置?我截图不成功。麻烦告诉一下:lol:lol

新生活 发表于 2023-5-28 00:08:14

学习学习,谢谢分享,赞

s1711880582 发表于 2023-5-29 13:17:20

jole 发表于 2023-5-27 13:02
5000/webapi/entry.cgi?version=9&id=32&api=%22SYNO.SurveillanceStation.Camera%22&method=%22GetSnapsho ...

id=32,这里的ID是摄像机ID在摄像机文件存储目录的设置文件有ID

jole 发表于 2023-5-29 21:54:10

s1711880582 发表于 2023-5-29 13:17
id=32,这里的ID是摄像机ID在摄像机文件存储目录的设置文件有ID

谢谢,后来截图抓包找到id了:lol,有些摄像头电脑浏览器播放不了好像也不能截图。

aiqienanguatou 发表于 2023-6-3 20:59:28

大佬,这几个值能弄么小白不是很明白怎么获得mp4事件



xddjordon 发表于 2023-12-5 20:55:52

大佬取sid出现错误code 407 ,一直取不到sid,这个是怎么回事?
页: [1]
查看完整版本: NodeRed + Surveillance Station Web API + goCQhttp 监控动检自动推送图...