# OTAUpdateManager
Implementation of OTA for remote monitoring and control of IoT devices
[![micropython](https://img.shields.io/badge/micropython-Ok-purple.svg)](https://micropython.org)
[![ESP8266](https://img.shields.io/badge/ESP-8266-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp8266)
[![ESP32](https://img.shields.io/badge/ESP-32-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32)
[![ESP32](https://img.shields.io/badge/ESP-32S2-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32-s2)
[![ESP32](https://img.shields.io/badge/ESP-32C3-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32-c3)
## Contents
- [How it works](#how-it-works)
- [Quick start](#quick-start)
- [Installing](#installing)
- [Arduino - Through Library Manager](#install-through-library-manager)
- [Arduino - From Github](#checkout-from-github)
- [Using](#using)
- [Documentation](#documentation)
- [Server connection configuration](#Server-connection-configuration)
## How It Works
### User Connection:
- Manually enter the network name (SSID) and password.
### MQTT Connection:
- The ESP can connect to an MQTT server to check for updates and maintain a live connection.
- This connection allows for monitoring the live online state and managing updates.
- Use the web application to check the live online state.
- Upload new code to the ESP board through the update section.
## How It Looks
ESP8266/ESP32 modules OTA update and monitoring using [website](https://ota.serveo.net/).
![Homepage](https://i.imgur.com/3LIUSZR.png) ![user dashboard](https://i.imgur.com/sccSpXp.png) ![program editor](https://i.imgur.com/DLfxktF.png)
## Quick Start
### Installing
#### Installing with mip
Py-file
```python
import mip
mip.install('github:raghulrajg/MicroPython-OTAUpdateManager/OTAUpdateManager.py')
```
To install using mpremote
```bash
mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager
```
To install directly using a WIFI capable board
```bash
mip.install("github:raghulrajg/MicroPython-OTAUpdateManager")
```
#### Installing Library Examples
If you want to install library examples:
```bash
mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager/examples.json
```
To install directly using a WIFI capable board
```bash
mip.install("github:raghulrajg/MicroPython-OTAUpdateManager/examples.json")
```
#### Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/MicroPython-OTAUpdateManager/>`_.
To install for current user:
```bash
pip3 install MicroPython-OTAUpdateManager
```
To install system-wide (this may be required in some cases):
```bash
sudo pip3 install MicroPython-OTAUpdateManager
```
To install in a virtual environment in your current project:
```bash
mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install MicroPython-OTAUpdateManager
```
Also see [examples](https://github.com/raghulrajg/OTAUpdateManager/tree/main/test).
## Using
This library provides a OTA update
1. handling code updates during boot (OTAUpdateManager)
Put the file name is called main.py
```python
import OTAUpdateManager
#Avoid the GPIO pin number 2 because of predefine pin
#create your User ID and Token in https://ota.serveo.net/
#server connection config
User = b"YOUR_USER_ID"
Token = b"YOUR_TOKEN"
#WiFI Network connection config
SSID = "YOUR_APN_NAME"
Password = "YOUR_APN_PASSWORD"
OTAUpdate = OTAUpdateManager.espFOTA(User, Token, SSID, Password)
def loop():
while True:
#Put your code here
OTAUpdate.run()
if __name__ == '__main__':
loop()
```
Here's the provided `main.py` file, which includes configuration details for connecting to a Wi-Fi network and checking for OTA (Over-the-Air) updates using a user ID and token. You need to fill in your actual Wi-Fi credentials, user ID, and token.
## Documentation
### Server connection configuration
#### Connecting to the Web Application:
- Go to the website: https://ota.serveo.net/.
- Log in to the web application.
#### Token Configuration:
- In the Token section, a default token is created.
- Copy the UserID and Token from this section.
#### Example Code Integration:
- Paste the UserID and Token into your example code.
- Set your connection method to either manual WiFi or APN.
#### Upload Program:
- Upload the program to the ESP.
- The ESP will connect to the MQTT server and send packets to keep the connection alive.
### OTA Update Process
#### Update Detection:
- The server will notify the ESP when an update is available.
- The ESP receives a payload to prepare for the update.
#### Update Execution:
- Once the update process is initiated, the ESP will start updating.
- The update status can be monitored on the website in the status section.
Raw data
{
"_id": null,
"home_page": null,
"name": "micropython-OTAUpdateManager",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "OTA, OTAUpdateManager, Update, Microcontroller, Micropython",
"author": "Raghul Raj G",
"author_email": "raghulrajatmega328@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/50/b1/1e385fcdb26e29ca065b406cc22d4183958ec3c435b725a78388f15ec017/micropython-OTAUpdateManager-1.0.0.tar.gz",
"platform": null,
"description": "# OTAUpdateManager\r\nImplementation of OTA for remote monitoring and control of IoT devices\r\n\r\n[![micropython](https://img.shields.io/badge/micropython-Ok-purple.svg)](https://micropython.org)\r\n\r\n[![ESP8266](https://img.shields.io/badge/ESP-8266-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp8266)\r\n\r\n[![ESP32](https://img.shields.io/badge/ESP-32-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32)\r\n[![ESP32](https://img.shields.io/badge/ESP-32S2-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32-s2)\r\n[![ESP32](https://img.shields.io/badge/ESP-32C3-000000.svg?longCache=true&style=flat&colorA=CC101F)](https://www.espressif.com/en/products/socs/esp32-c3)\r\n\r\n\r\n## Contents\r\n - [How it works](#how-it-works)\r\n - [Quick start](#quick-start)\r\n - [Installing](#installing)\r\n - [Arduino - Through Library Manager](#install-through-library-manager)\r\n - [Arduino - From Github](#checkout-from-github)\r\n - [Using](#using)\r\n - [Documentation](#documentation)\r\n - [Server connection configuration](#Server-connection-configuration)\r\n\r\n## How It Works\r\n\r\n### User Connection:\r\n- Manually enter the network name (SSID) and password.\r\n\r\n### MQTT Connection:\r\n- The ESP can connect to an MQTT server to check for updates and maintain a live connection.\r\n- This connection allows for monitoring the live online state and managing updates.\r\n\r\n- Use the web application to check the live online state.\r\n- Upload new code to the ESP board through the update section.\r\n\r\n## How It Looks\r\nESP8266/ESP32 modules OTA update and monitoring using [website](https://ota.serveo.net/).\r\n![Homepage](https://i.imgur.com/3LIUSZR.png) ![user dashboard](https://i.imgur.com/sccSpXp.png) ![program editor](https://i.imgur.com/DLfxktF.png)\r\n\r\n## Quick Start\r\n\r\n### Installing\r\n\r\n#### Installing with mip\r\n\r\nPy-file\r\n```python\r\nimport mip\r\nmip.install('github:raghulrajg/MicroPython-OTAUpdateManager/OTAUpdateManager.py')\r\n```\r\n\r\nTo install using mpremote\r\n\r\n```bash\r\n mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager\r\n```\r\n\r\nTo install directly using a WIFI capable board\r\n\r\n```bash\r\n mip.install(\"github:raghulrajg/MicroPython-OTAUpdateManager\")\r\n```\r\n\r\n#### Installing Library Examples\r\n\r\nIf you want to install library examples:\r\n\r\n```bash\r\n mpremote mip install github:raghulrajg/MicroPython-OTAUpdateManager/examples.json\r\n```\r\n\r\nTo install directly using a WIFI capable board\r\n\r\n```bash\r\n mip.install(\"github:raghulrajg/MicroPython-OTAUpdateManager/examples.json\")\r\n```\r\n\r\n#### Installing from PyPI\r\n\r\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\r\nPyPI <https://pypi.org/project/MicroPython-OTAUpdateManager/>`_.\r\nTo install for current user:\r\n\r\n```bash\r\n pip3 install MicroPython-OTAUpdateManager\r\n```\r\n\r\nTo install system-wide (this may be required in some cases):\r\n\r\n\r\n```bash\r\nsudo pip3 install MicroPython-OTAUpdateManager\r\n```\r\nTo install in a virtual environment in your current project:\r\n\r\n```bash\r\n mkdir project-name && cd project-name\r\n python3 -m venv .venv\r\n source .env/bin/activate\r\n pip3 install MicroPython-OTAUpdateManager\r\n```\r\n\r\nAlso see [examples](https://github.com/raghulrajg/OTAUpdateManager/tree/main/test).\r\n\r\n## Using\r\nThis library provides a OTA update\r\n 1. handling code updates during boot (OTAUpdateManager)\r\n\r\nPut the file name is called main.py\r\n```python\r\nimport OTAUpdateManager\r\n\r\n#Avoid the GPIO pin number 2 because of predefine pin\r\n#create your User ID and Token in https://ota.serveo.net/\r\n\r\n#server connection config\r\nUser = b\"YOUR_USER_ID\"\r\nToken = b\"YOUR_TOKEN\"\r\n\r\n#WiFI Network connection config\r\nSSID = \"YOUR_APN_NAME\"\r\nPassword = \"YOUR_APN_PASSWORD\"\r\n\r\nOTAUpdate = OTAUpdateManager.espFOTA(User, Token, SSID, Password)\r\n\r\ndef loop():\r\n while True:\r\n #Put your code here\r\n OTAUpdate.run()\r\n\r\nif __name__ == '__main__':\r\n loop()\r\n```\r\nHere's the provided `main.py` file, which includes configuration details for connecting to a Wi-Fi network and checking for OTA (Over-the-Air) updates using a user ID and token. You need to fill in your actual Wi-Fi credentials, user ID, and token.\r\n\r\n## Documentation\r\n\r\n### Server connection configuration\r\n\r\n#### Connecting to the Web Application:\r\n- Go to the website: https://ota.serveo.net/.\r\n- Log in to the web application.\r\n\r\n#### Token Configuration:\r\n- In the Token section, a default token is created.\r\n- Copy the UserID and Token from this section.\r\n\r\n#### Example Code Integration:\r\n- Paste the UserID and Token into your example code.\r\n- Set your connection method to either manual WiFi or APN.\r\n\r\n#### Upload Program:\r\n- Upload the program to the ESP.\r\n- The ESP will connect to the MQTT server and send packets to keep the connection alive.\r\n\r\n### OTA Update Process\r\n\r\n#### Update Detection:\r\n- The server will notify the ESP when an update is available.\r\n- The ESP receives a payload to prepare for the update.\r\n\r\n#### Update Execution:\r\n- Once the update process is initiated, the ESP will start updating.\r\n- The update status can be monitored on the website in the status section.\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Implementation of OTA for remote monitoring and controlling of IoT devices",
"version": "1.0.0",
"project_urls": {
"Source": "https://github.com/raghulrajg/MicroPython-OTAUpdateManager"
},
"split_keywords": [
"ota",
" otaupdatemanager",
" update",
" microcontroller",
" micropython"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2754f75b0fd06a0b75d30a0a94ecd1a54912d9d7320e501507dfa356313725f6",
"md5": "4803c00c6c3b1aae955c267a19fa84f0",
"sha256": "0ac8728a4e197ec5edc82b471c38124f08e4755ff812353bcdb513152a7f55f0"
},
"downloads": -1,
"filename": "micropython_OTAUpdateManager-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4803c00c6c3b1aae955c267a19fa84f0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 18392,
"upload_time": "2024-06-14T15:51:20",
"upload_time_iso_8601": "2024-06-14T15:51:20.915464Z",
"url": "https://files.pythonhosted.org/packages/27/54/f75b0fd06a0b75d30a0a94ecd1a54912d9d7320e501507dfa356313725f6/micropython_OTAUpdateManager-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "50b11e385fcdb26e29ca065b406cc22d4183958ec3c435b725a78388f15ec017",
"md5": "97e4f879bced6fdec81a2271e4841e88",
"sha256": "43c232b5bb51ceb3bc297f129b7e11aa3c31b7f7854ee97e380c8673b0b64734"
},
"downloads": -1,
"filename": "micropython-OTAUpdateManager-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "97e4f879bced6fdec81a2271e4841e88",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6184,
"upload_time": "2024-06-14T15:51:23",
"upload_time_iso_8601": "2024-06-14T15:51:23.464433Z",
"url": "https://files.pythonhosted.org/packages/50/b1/1e385fcdb26e29ca065b406cc22d4183958ec3c435b725a78388f15ec017/micropython-OTAUpdateManager-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-14 15:51:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "raghulrajg",
"github_project": "MicroPython-OTAUpdateManager",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "micropython-otaupdatemanager"
}