1 Star 0 Fork 1

c-527/micropython-mqtt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Introduction

MQTT is an easily used networking protocol designed for IOT (internet of things) applications. It is well suited for controlling hardware devices and for reading sensors across a local network or the internet.

It is a means of communicating between multiple clients. A single server, also known as a broker, manages the network. Clients may include ESP8266, ESP32 and Pyboard D modules and other networked computers. Typical server hardware is a Raspberry Pi or other small Linux machine which may be left running 24/7. Public brokers also exist.

An effective PC client and server is mosquitto.

This repository

This contains two separate projects:

  1. A "resilient" asynchronous non-blocking MQTT driver.
  2. A means of using a cheap ESP8266 module to bring MQTT to MicroPython platforms which lack a WiFi interface.

1. The "resilient" driver

This is an alternative to the official driver. It has been tested on the following platforms.

  1. ESP8266
  2. ESP32
  3. Pyboard D

The principal features of this driver are:

  1. Non-blocking operation for applications using uasyncio.
  2. Automatic recovery from WiFi and broker outages.
  3. True qos == 1 operation with retransmission.
  4. Improved WiFi range because of its tolerance of poor connectivity.

It has the drawback of increased code size which is an issue on the ESP8266. Run as frozen bytecode it uses about 50% of the RAM on the ESP8266. On ESP32 and Pyboard D it may be run as a standard Python module.

mqtt_as documentation.

2. MQTT bridge for generic MicroPython targets

This comprises an ESP8266 firmware image and a MicroPython driver. The target hardware is linked to an ESP8266 running the firmware image using a 5-wire interface. The driver runs on the target which can then access MQTT. The driver is non-blocking and is designed for applications using uasyncio.

The current version of this library is in the bridge directory and is documented

here

It uses the new version of uasyncio.

An old version is archived to the pb_link directory, although I plan to delete this.

Project archive.

The MQTT Bridge replaces this library. It was written a long time ago when the issues around portability were less clear. The client code is substantially revised with API changes. Objectives:

  1. Compatibility with uasyncio V3.
  2. True portability between platforms. In particular:
  3. Tested compatibility with the Raspberry Pi Pico.
  4. A more consistent API with significant simplifications.
  5. Replace the non-portable RTC code with a means of retrieving NTP time.
  6. Enable a choice of time server.
  7. Bugs fixed!

There seems little hope of a portable machine.RTC class, so setting the RTC is now the responsibility of the application (if required).

The ESP8266 code has only minor changes.

MIT License Copyright (c) 2017 Peter Hinch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/c527/micropython-mqtt.git
git@gitee.com:c527/micropython-mqtt.git
c527
micropython-mqtt
micropython-mqtt
master

搜索帮助