This project is a Python-based MQTT device updater designed to manage firmware updates and status monitoring for IoT devices. It communicates with devices over MQTT, checks their firmware versions, and triggers over-the-air (OTA) updates when necessary.
- Connects to an MQTT broker and subscribes to device response topics.
- Publishes commands to devices to query their firmware version.
- Compares device firmware versions to the latest version and initiates OTA updates if outdated.
- Maintains JSON records for each device, including update status.
- Logs all operations to
updater.logfor traceability.
update.py: Main script containing all logic for MQTT communication, device version checking, and update management.requirements.txt: List of required Python packages.devices/: Directory where per-device JSON files are stored (created at runtime).data/devices.json: JSON file containing the list of device serial numbers to manage (must be present at runtime).
- Python 3.x
paho-mqttlibrary
Install dependencies with:
pip install -r requirements.txt- Ensure your MQTT broker is running and accessible (default:
127.0.0.1:1883). - Place a
devices.jsonfile in adata/directory, listing the serial numbers of devices to manage (as a JSON array). - Run the updater:
python update.pyAll actions and warnings are logged to updater.log in the project directory.
- Update the
brokerandportvariables inupdate.pyto match your MQTT broker settings. - Adjust the
latestVervariable to set the required firmware version.
MIT License (add your license details here)