https://github.com/lkiarest/mqtt-wechat
监听 mqtt 消息并转发到企业微信
https://github.com/lkiarest/mqtt-wechat
Last synced: 12 months ago
JSON representation
监听 mqtt 消息并转发到企业微信
- Host: GitHub
- URL: https://github.com/lkiarest/mqtt-wechat
- Owner: lkiarest
- Created: 2021-11-06T06:39:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-06T06:56:23.000Z (over 4 years ago)
- Last Synced: 2025-01-21T08:45:09.151Z (over 1 year ago)
- Language: JavaScript
- Size: 45.9 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mqtt-wechat
监听并转发 mqtt 消息到企业微信,可用于 IoT 设备通知。
### 准备工作
1. 可用的 mqtt server,自建或蹭别人的
2. 可用的企业微信应用(支持个人申请) [官方文档](https://work.weixin.qq.com/api/doc/90000/90003/90556)
### 配置
创建配置文件:
```
cp config/index.sample.js config/index.js
```
在 config/index.js 中配置 mqtt server 和企业微信。
### 运行
需要服务器 nodejs 环境。
```
// 安装依赖
yarn
// 运行 debug
yarn start
// 运行 server
yarn server
// 访问,端口号可以在 config 文件中配置,也可以在环境变量中增加: PORT=xxx
// http://localhost:9999
// 查看 mqtt 连接状态是否正常
// http://localhost:9999/mqtt/status
```