Skip to main content

The iot plugin for nonebot2 framework

Project description

nonebot_plugin_mqtt

pypi implementation wheel python license

功能

  • 将nonebot接入mqtt网络

开始使用

使用 pip

  • 通过 pip 从 PyPI 安装
pip install nonebot-plugin-mqtt
  • 在 nonebot2 项目中设置 load_plugin()
nonebot.load_plugin('nonebot_plugin_mqtt')
  • 参照下文在 nonebot2 项目的环境文件 .env.* 中添加配置项

配置项

MQTT_TOPIC   # mqtt订阅topic
MQTT_CLIENT_ID # mqtt订阅clientid
MQTT_HOST # mqtt broker地址
MQTT_PORT # mqtt broker端口

MQTT_USER # mqtt 可选验证项
MQTT_PASSWORD

导出给其他插件

export = nonebot.require("nonebot_plugin_mqtt")
export.mqtt_client.publish(topic,msg)
export.mqtt_client.subscribe(TOPIC, qos=1)

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

特别感谢

优化建议

可以来抓更多网站的接口or汇报bug or pr

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot-plugin-mqtt-0.1.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

nonebot_plugin_mqtt-0.1.0-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page