1 Star 1 Fork 0

blackunicorn/node-mongodb-mqtt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

介绍

获取 emqtx 免费版中传感器数据并 webhook 转存

Express,Sequelize 和 MySQL 的 Node.js Rest API

https://cloud.tencent.com/developer/article/1745399

npm install express sequelize mysql2  cors --save

create a new repository on the command line

echo "# node-mongodb-mqtt" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:blaunicorn/node-mongodb-mqtt.git
git remote add github git@github.com:blaunicorn/node-mongodb-mqtt.git
git push -u origin main

push an existing repository from the command line

git remote add origin git@github.com:blaunicorn/node-mongodb-mqtt.git
git remote add github git@github.com:blaunicorn/node-mongodb-mqtt.git
git branch -M main
git push -u origin main

用 nodejs 搭建 webhooks 中转 中转建立在 81.70.104.105 端口号在 8027 mqtx 接收传感器数据 http://81.70.104.105:18083/#/ emqx 服务器 admin/public

历史数据存 mongodb表
"mongodb://admin:123qwe@81.70.104.105:27017/testdb";
// 实时数据,提前每一个device_id最新的一条存入sql表,通过mqtt更新relay状态
// 数据表名/密码gva  gva   2wi7N4AycJ7yGeCB  http://81.70.77.41/ mqtts表
// 数据结构实例
{"device_id":"esp_device001_370098",
"type":"温湿度传感器",
"sun":1,
"temp":2,
"humi":3,
"relay":0
}
// webhook 返回的body数据
  params: {},
  query: {},

  body: {
    username: 'undefined',
    topic: '$sys/370098/esp_device001/dp/post/json',
    timestamp: 1630051806952,
    qos: 0,
    publish_received_at: 1630051806952,
    pub_props: {},
    peerhost: '42.102.115.245',
    payload: '{"device_id":"esp_device001_370098",\n' +
      '"type":"温湿度传感器",\n' +
      '"sun":1,\n' +
      '"temp":2,\n' +
      '"humi":3,\n' +
      '"relay":0\n' +
      '}',
    node: 'emqx@127.0.0.1',
    metadata: { rule_id: 'rule:496560' },
    id: '0005CA8602EB3A89F44E16006CDC0006',
    headers: {
      username: 'undefined',
      protocol: 'mqtt',
      proto_ver: 4,
      properties: {},
      peerhost: '42.102.115.245'
    },
    flags: { retain: false, dup: false },
    event: 'message.publish',
    clientid: 'mqttx_391be81f'
  },

空文件

简介

获取emqtx免费版中传感器数据并webhook转存 mongodb和mysql中 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/blaunicorn/node-mongodb-mqtt.git
git@gitee.com:blaunicorn/node-mongodb-mqtt.git
blaunicorn
node-mongodb-mqtt
node-mongodb-mqtt
main

搜索帮助