nonebot-plugin-mqtt


Namenonebot-plugin-mqtt JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/synodriver/nonebot_plugin_mqtt
SummaryThe iot plugin for nonebot2 framework
upload_time2023-09-06 16:06:17
maintainer
docs_urlNone
authorsynodriver
requires_python>=3.7
licenseGPLv3
keywords nonebot mqtt iot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nonebot_plugin_mqtt

[![pypi](https://img.shields.io/pypi/v/nonebot-plugin-mqtt.svg)](https://pypi.org/project/nonebot-plugin-mqtt/)
![python](https://img.shields.io/pypi/pyversions/nonebot-plugin-mqtt)
[![license](https://img.shields.io/github/license/synodriver/nonebot_plugin_mqtt.svg)](https://raw.githubusercontent.com/synodriver/nonebot_plugin_mqtt/main/LICENSE)

- 基于[nonebot2](https://github.com/nonebot/nonebot2) 和 [gmqtt](https://github.com/wialon/gmqtt)

## 功能

- 将 nonebot 接入 mqtt 网络

## 开始使用

- 使用 nb-cli 安装

```bash
nb plugin install nonebot-plugin-mqtt
```

- 参照下文在 nonebot2 项目的环境文件 .env.\* 中添加配置项

## 配置项

```text
MQTT_TOPIC          # MQTT 订阅 Topic
MQTT_CLIENT_ID      # MQTT 订阅 Client ID
MQTT_HOST           # MQTT Broker 地址
MQTT_PORT           # MQTT Broker 端口

MQTT_USER           # MQTT 可选验证项
MQTT_PASSWORD
```

## 在其他插件中使用

```python
from nonebot import require

require("nonebot_plugin_mqtt")
from nonebot_plugin_mqtt import mqtt_client

mqtt_client.publish(topic, payload=payload, qos=0, retain=False)
mqtt_client.subscribe(topic, qos=1)

# 自定义回调
mqtt_client.on_message = on_message
mqtt_client.on_connect = on_connect
```

## 特别感谢

- [Mrs4s/go-cqhttp](https://github.com/Mrs4s/go-cqhttp)
- [nonebot/nonebot2](https://github.com/nonebot/nonebot2)

## 优化建议

可以来抓更多网站的接口 or 汇报 bug or pr
![](https://i.pixiv.cat/img-original/img/2019/09/01/05/00/42/76563606_p0.png "呐呐呐,来pr的话~就给大哥哥透噢")

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/synodriver/nonebot_plugin_mqtt",
    "name": "nonebot-plugin-mqtt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nonebot,mqtt,iot",
    "author": "synodriver",
    "author_email": "diguohuangjiajinweijun@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/69/de/15329e1e42149cb4688dfa0c700ec326c153a52ab18c1ea509471def1af6/nonebot-plugin-mqtt-0.1.2.tar.gz",
    "platform": null,
    "description": "# nonebot_plugin_mqtt\n\n[![pypi](https://img.shields.io/pypi/v/nonebot-plugin-mqtt.svg)](https://pypi.org/project/nonebot-plugin-mqtt/)\n![python](https://img.shields.io/pypi/pyversions/nonebot-plugin-mqtt)\n[![license](https://img.shields.io/github/license/synodriver/nonebot_plugin_mqtt.svg)](https://raw.githubusercontent.com/synodriver/nonebot_plugin_mqtt/main/LICENSE)\n\n- \u57fa\u4e8e[nonebot2](https://github.com/nonebot/nonebot2) \u548c [gmqtt](https://github.com/wialon/gmqtt)\n\n## \u529f\u80fd\n\n- \u5c06 nonebot \u63a5\u5165 mqtt \u7f51\u7edc\n\n## \u5f00\u59cb\u4f7f\u7528\n\n- \u4f7f\u7528 nb-cli \u5b89\u88c5\n\n```bash\nnb plugin install nonebot-plugin-mqtt\n```\n\n- \u53c2\u7167\u4e0b\u6587\u5728 nonebot2 \u9879\u76ee\u7684\u73af\u5883\u6587\u4ef6 .env.\\* \u4e2d\u6dfb\u52a0\u914d\u7f6e\u9879\n\n## \u914d\u7f6e\u9879\n\n```text\nMQTT_TOPIC          # MQTT \u8ba2\u9605 Topic\nMQTT_CLIENT_ID      # MQTT \u8ba2\u9605 Client ID\nMQTT_HOST           # MQTT Broker \u5730\u5740\nMQTT_PORT           # MQTT Broker \u7aef\u53e3\n\nMQTT_USER           # MQTT \u53ef\u9009\u9a8c\u8bc1\u9879\nMQTT_PASSWORD\n```\n\n## \u5728\u5176\u4ed6\u63d2\u4ef6\u4e2d\u4f7f\u7528\n\n```python\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_mqtt\")\nfrom nonebot_plugin_mqtt import mqtt_client\n\nmqtt_client.publish(topic, payload=payload, qos=0, retain=False)\nmqtt_client.subscribe(topic, qos=1)\n\n# \u81ea\u5b9a\u4e49\u56de\u8c03\nmqtt_client.on_message = on_message\nmqtt_client.on_connect = on_connect\n```\n\n## \u7279\u522b\u611f\u8c22\n\n- [Mrs4s/go-cqhttp](https://github.com/Mrs4s/go-cqhttp)\n- [nonebot/nonebot2](https://github.com/nonebot/nonebot2)\n\n## \u4f18\u5316\u5efa\u8bae\n\n\u53ef\u4ee5\u6765\u6293\u66f4\u591a\u7f51\u7ad9\u7684\u63a5\u53e3 or \u6c47\u62a5 bug or pr\n![](https://i.pixiv.cat/img-original/img/2019/09/01/05/00/42/76563606_p0.png \"\u5450\u5450\u5450,\u6765pr\u7684\u8bdd~\u5c31\u7ed9\u5927\u54e5\u54e5\u900f\u5662\")\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "The iot plugin for nonebot2 framework",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/synodriver/nonebot_plugin_mqtt"
    },
    "split_keywords": [
        "nonebot",
        "mqtt",
        "iot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2934ab24ce8aa1488828c3a09714607d189ef6458c7f81a8d0de8794ab01e28",
                "md5": "04f97904ecf40d822bc62942121fe567",
                "sha256": "80a3ca25bb3f1dbc700201f5dca811ef96096d062ec2353453f6949a2727115b"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_mqtt-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04f97904ecf40d822bc62942121fe567",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16602,
            "upload_time": "2023-09-06T16:06:14",
            "upload_time_iso_8601": "2023-09-06T16:06:14.974473Z",
            "url": "https://files.pythonhosted.org/packages/a2/93/4ab24ce8aa1488828c3a09714607d189ef6458c7f81a8d0de8794ab01e28/nonebot_plugin_mqtt-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "69de15329e1e42149cb4688dfa0c700ec326c153a52ab18c1ea509471def1af6",
                "md5": "1d94b40274765489b26e4f665ee87732",
                "sha256": "e6f256840c77796d7f26f2d2e03e28bfa4b78cf672729748913076d755bf5c5b"
            },
            "downloads": -1,
            "filename": "nonebot-plugin-mqtt-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1d94b40274765489b26e4f665ee87732",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16336,
            "upload_time": "2023-09-06T16:06:17",
            "upload_time_iso_8601": "2023-09-06T16:06:17.826770Z",
            "url": "https://files.pythonhosted.org/packages/69/de/15329e1e42149cb4688dfa0c700ec326c153a52ab18c1ea509471def1af6/nonebot-plugin-mqtt-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-06 16:06:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "synodriver",
    "github_project": "nonebot_plugin_mqtt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nonebot-plugin-mqtt"
}
        
Elapsed time: 0.11193s