USER-APPLICATION-HONEYCOMB is a Python-based application designed to fetch, manage, and process IoT device data from ChirpStack. The system dynamically updates the device list and decodes incoming sensor data using predefined codecs.
- Device Management: Fetches and maintains a dictionary (
all_devices) with devices and their codecs. - Event Processing: Listens to MQTT events from ChirpStack and decodes device payloads.
- Automatic Updates: A scheduler ensures newly added devices are fetched periodically.
- Modular Design: Well-structured code for better maintainability.
- Asymmetric Ciphering Support: Supports ECDH ciphering for secure encryption and decryption of device data.
USER-APPLICATION-HONEYCOMB/
🕠 __pycache__/ # Compiled Python files
🕠 .venv/ # Virtual environment (if used)
🕠 old_code/ # Backup of previous versions
🕠 .gitignore # Git ignore rules
🕠 application_fetcher.py # Fetches applications from ChirpStack
🕠 codec_fetcher.py # Retrieves codec information for devices
🕠 config.py # Stores configuration variables
🕠 device_fetcher.py # Fetches devices from ChirpStack
🕠 device_manager.py # Manages device storage and updates
🕠 event_fetcher_parse.py # Listens to MQTT events and decodes data
🕠 main.py # Starts the system (scheduler + MQTT listener)
🕠 README.md # Project documentation
🕠 requirements.txt # Required dependencies
🕠 scheduler.py # Periodically updates device list
🕠 tenant_fetcher.py # Fetches tenants from ChirpStack
Ensure you have:
- Python 3.x
- ChirpStack MQTT broker running
pipinstalled
git clone https://github.com/your-repo/user-application-honeycomb.git
cd user-application-honeycombpython -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activatepip install -r requirements.txtUpdate config.py with your ChirpStack credentials:
CHIRPSTACK_HOST = "localhost:8080" # Update with your host
AUTH_METADATA = {"Authorization": "Bearer YOUR_TOKEN"}device_manager.pyfetches and stores devices inall_devices(key:device_name, value:{euid, codec}).scheduler.pyrefreshes the device list every 10 minutes.
event_fetcher_parse.pysubscribes to ChirpStack MQTT topics.- When an event arrives:
- It extracts
dev_euiand payload data. - It matches
dev_euiwitheuidinall_devices. - It retrieves the correct codec and decodes the data.
- It extracts
Start the application by running:
python main.pyThis will:
- Start the scheduler (to update the device list every 10 minutes).
- Start the MQTT listener (to process incoming sensor events).
Handles fetching and storing device information:
device_manager.fetch_all_devices() # Fetches all devices
device_manager.show_device_names() # Displays the list of devicesRuns every 10 minutes to update all_devices:
schedule.every(10).minutes.do(scheduled_update)Listens for MQTT events and decodes messages:
client.subscribe("application/+/device/+/event/+")Matches dev_eui with euid:
def get_device_codec(dev_eui):
for device_name, device_info in device_manager.all_devices.items():
if device_info.get("euid") == dev_eui:
return device_info.get("codec")
return NoneCheck device updates:
tail -f scheduler.logCheck incoming MQTT messages:
tail -f event_fetcher.log- Real-time WebSocket integration for device updates.
- Database storage for historical events.
- Custom decoders for different device types.
This project is licensed under the MIT License.
Pull requests are welcome! Open an issue for discussions.