Skip to main content

The iot plugin for nonebot2 framework

Project description

nonebot_plugin_mqtt

pypi python license

功能

  • 将 nonebot 接入 mqtt 网络

开始使用

  • 使用 nb-cli 安装
nb plugin install nonebot-plugin-mqtt
  • 参照下文在 nonebot2 项目的环境文件 .env.* 中添加配置项

配置项

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

MQTT_USER           # MQTT 可选验证项
MQTT_PASSWORD

在其他插件中使用

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

特别感谢

优化建议

可以来抓更多网站的接口 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.2.tar.gz (16.3 kB view hashes)

Uploaded Source

Built Distribution

nonebot_plugin_mqtt-0.1.2-py3-none-any.whl (16.6 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