An open API service indexing awesome lists of open source software.

https://github.com/lkiarest/mqtt-wechat

监听 mqtt 消息并转发到企业微信
https://github.com/lkiarest/mqtt-wechat

Last synced: 12 months ago
JSON representation

监听 mqtt 消息并转发到企业微信

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
```