node-red-contrib-gps (汽车在线和万物在线)

汽车在线和万物在线是一款车载gps定位器,又开放的api接口可以获取机车所在位置,有了这个之后一方面可以做一些关于自身位置的一些自动化也可以用于安防。

当前节点包含位置监控和地理位置逆解析,汽车在线是一个账号下面只有一个设备,但是万物在线设计是根据一个账号有多个设备信息在里面的,所以会存在下面这种情况:

默认 `msg.payload.data` 是第一个设备信息,详细设备可以从 `msg.payload.dataArray` 获取
但是为了方便大家获取自己的指定设备,又在msg.objData添加根据 `imei`为 `key`的结构

监控位置

[
    {
        "id": "d051d0be.653c7",
        "type": "gpsoo-monitor",
        "z": "154a9d7c.580cf3",
        "server": "4107e05d.b419f",
        "name": "",
        "x": 260,
        "y": 160,
        "wires": [
            [
                "d9f004d4.dacce8"
            ],
            []
        ]
    },
    {
        "id": "320ab674.7e9f0a",
        "type": "inject",
        "z": "154a9d7c.580cf3",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 80,
        "y": 140,
        "wires": [
            [
                "d051d0be.653c7"
            ]
        ]
    },
    {
        "id": "d9f004d4.dacce8",
        "type": "debug",
        "z": "154a9d7c.580cf3",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 420,
        "y": 120,
        "wires": []
    },
    {
        "id": "4107e05d.b419f",
        "type": "gpsoo-configurator",
        "z": "",
        "name": "默认账号",
        "phone": "1",
        "password": "1",
        "platform": "1"
    }
]

地理位置逆解析

[
    {
        "id": "66fe670f.15ae08",
        "type": "gpsoo-address",
        "z": "154a9d7c.580cf3",
        "server": "",
        "name": "",
        "longitude": "",
        "latitude": "",
        "x": 420,
        "y": 300,
        "wires": [
            [
                "931cc747.3a9128"
            ],
            []
        ]
    },
    {
        "id": "7aa4e90.4342718",
        "type": "inject",
        "z": "154a9d7c.580cf3",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 260,
        "wires": [
            [
                "49d2a99a.a9efd8"
            ]
        ]
    },
    {
        "id": "931cc747.3a9128",
        "type": "debug",
        "z": "154a9d7c.580cf3",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 550,
        "y": 240,
        "wires": []
    },
    {
        "id": "49d2a99a.a9efd8",
        "type": "function",
        "z": "154a9d7c.580cf3",
        "name": "",
        "func": "msg.latitude = 30.389162\nmsg.longitude = 120.273688\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 220,
        "y": 280,
        "wires": [
            [
                "66fe670f.15ae08"
            ]
        ]
    }
]

串起来的例子,随手写的,自己需要定制适合自己的节点

[{"id":"154a9d7c.580cf3","type":"tab","label":"流程4","disabled":false,"info":""},{"id":"d051d0be.653c7","type":"gpsoo-monitor","z":"154a9d7c.580cf3","server":"","name":"","x":260,"y":160,"wires":[["49d2a99a.a9efd8"],[]]},{"id":"320ab674.7e9f0a","type":"inject","z":"154a9d7c.580cf3","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":140,"wires":[["d051d0be.653c7"]]},{"id":"66fe670f.15ae08","type":"gpsoo-address","z":"154a9d7c.580cf3","server":"","name":"","longitude":"","latitude":"","x":580,"y":160,"wires":[["e6bafac.b0e1a08"],[]]},{"id":"49d2a99a.a9efd8","type":"function","z":"154a9d7c.580cf3","name":"数据处理","func":"const data = msg.objData['2222']\n//用于地理位置逆解析\nmsg.latitude = data.lat\nmsg.longitude = data.lng\n//缓存位置信息\nmsg.data = data\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":160,"wires":[["66fe670f.15ae08"]]},{"id":"e6bafac.b0e1a08","type":"function","z":"154a9d7c.580cf3","name":"推送信息整理","func":"//0:正常数据 1:设备未上线 2:设备已过期 \n// 3:设备离线 4:设备静止\n// 设备信息\nconst data = msg.data\n//机车位置\nconst location = msg.payload.data.address\n//机车状态\nlet status = ''\n\nswitch(data.device_info_new) {\n    case 0:\n        status = '行驶中'\n        break\n    case 3:\n        status = '熄火'\n        break\n    case 4:\n        status = '静止'\n        break\n    default:\n        status = '设备异常,请检查'\n}\n\nconst message = `当前位置:${location},\n状态是: ${status}`\n\n\nmsg.payload = message\n\nreturn msg;","outputs":1,"noerr":0,"x":480,"y":300,"wires":[["2f4e1558.cb9f7a"]]},{"id":"2f4e1558.cb9f7a","type":"debug","z":"154a9d7c.580cf3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":640,"y":300,"wires":[]},{"id":"4e9df4a5.1203ac","type":"comment","z":"154a9d7c.580cf3","name":"获取指定设备信息","info":"","x":450,"y":100,"wires":[]}]

我用的汽车在线,看来不用更新

好好学习 天天向上

觉得之前的没问题,不更新也可以,这次属于优化,没有添加新功能,万物个汽车二合一了

大佬 这几天用不了 万物在线了

1656083274386
1656083290008
花神大佬,汽车在线节点现在还能用吗?一直返回Error: [GPS api Token]no permission

升级到最新的节点了吗?

萝卜大佬,设备号是啥,imei还是iccid 还有密码是啥

萝卜不在家。默认是imei号

请问新节点叫什么名字

新节点?是原来节点升级到最新版本

我也是这样的情况,怎么解决呢?

已经最新节点了。。。