The core module of the Espark ESP32-based IoT device management framework.
Project description
Espark
Espark is a lightweight framework for building scalable and efficient ESP32-based IoT applications. It provides a modular architecture, easy-to-use APIs, and built-in support for common IoT protocols.
Project Goals
- Simplify the development of ESP32 applications.
- Provide a modular and extensible architecture.
- Support common IoT protocols like MQTT.
- Ensure efficient resource management for low-power devices.
- Provide a clean and easy-to-use API.
- Provide an user-friendly UI for configuration and monitoring.
Features
- Device Provisioning: Easy setup and configuration of ESP32 devices.
- Telemetry Collection: Built-in support for collecting and sending telemetry data.
- Scalable Architecture: Designed to handle a large number of devices efficiently.
- Seamless Communication: Support for MQTT protocol.
Hardware Requirements
- ESP32 Development Board
- USB Cable for programming and power
- Optional: Sensors and triggers for specific applications
Project Structure
espark/
├── espark-core/
│ ├── esparkcore/ # FastAPI backend framework
│ │ ├── data/ # Models, repositories
│ │ ├── routers/ # API endpoints
│ │ ├── schedules/ # Background tasks
│ │ ├── services/ # Business logic, MQTT handling
│ │ └── utils/ # Utility functions
│ └── Makefile
├── espark-node/
│ ├── esparknode/ # MicroPython application framework
│ │ ├── actions/ # Action handlers
│ │ ├── data/ # Data storage
│ │ ├── libraries/ # External libraries
│ │ ├── networks/ # Network management
│ │ ├── sensors/ # Sensor interfaces
│ │ ├── triggers/ # Trigger interfaces
│ │ ├── utils/ # Utility functions
│ │ └── base_node.py # Main application file
│ └── Makefile
└── espark-react/ # React frontend application
├── src/
│ ├── data/ # Data models and data providers
│ ├── i18n/ # Internationalization files
│ ├── pages/ # Application pages
│ ├── routes/ # Application routing
│ ├── utils/ # Utility functions
│ ├── App.tsx # Main application component
│ └── index.tsx # Application entry point
└── package.json
Development Workflows
Setting up the backend
- Add espark-core as a dependency in your FastAPI project.
- Configure database connections and MQTT settings as environment variables.
- Implement additional data models, repositories, routers, and business logic if needed.
- Add the
DeviceRouter,TelemetryRouter, and other additional routers to your FastAPI app.
Setting up the ESP32 application
- Clone the espark-node repository to your local machine.
- Copy
espark-core/Makefile.templatetoMakefileand customize it for your device. - Run
make upgradeto copy the espark-core library to your device project. - Implement device-specific actions, sensors, and triggers as needed.
- Run
make flashto upload the firmware to your ESP32 device. - Run
make deployto upload the application to the device.
Setting up the frontend
- Add espark-react as a dependency in your React project.
- Render
<EsparkApp />in your main application file.
Configurations
- espark-core: Use environment variables, or
.envfile, for database and MQTT configurations. - espark-node: Use
esparknode.configsfor device-specific configurations. - espark-react: Customise
EsparkAppprops for application settings.
Examples and Patterns
- Router Example:
device_router.pyinespark-core/esparkcore/routers/demonstrates how to create API endpoints for device management. - Respository Example:
device_repository.pyinespark-core/esparkcore/data/repositories/shows how to implement data access logic for devices. - Action Example:
esp32_relay.pyinespark-node/esparknode/actions/illustrates how to define actions for ESP32 devices. - Sensor Example:
sht20_sensor.pyinespark-node/esparknode/sensors/demonstrates how to read data from a SHT20 sensor. - Trigger Example:
gpio_trigger.pyinespark-node/esparknode/triggers/shows how to create GPIO-based triggers for device actions. - List, Show, Edit Screens Example:
DeviceList,DeviceShow, andDeviceEditcomponents inespark-react/src/pages/devices/demonstrate how to create CRUD screens for device management.
Example Projects
- Espartan: A smart thermostat and open-door alert automation system using ESP32-C3 devices, leveraging espark for device management and telemetry, available at https://github.com/ayltai/Espartan.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
espark_core-0.4.4.tar.gz
(11.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file espark_core-0.4.4.tar.gz.
File metadata
- Download URL: espark_core-0.4.4.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6708627b9ce7e6ed9e4f4175e1fdcb1598d980ac1ce04f034eaedf13bc7d9bcf
|
|
| MD5 |
41f75da56d25ffe74ff68b2f719b96ad
|
|
| BLAKE2b-256 |
760ad0898cf25e4a12b4f75cc8a0e23ce5733a8a17cf22945746a098d7274b5a
|
File details
Details for the file espark_core-0.4.4-py3-none-any.whl.
File metadata
- Download URL: espark_core-0.4.4-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa551347e1a1a2b21a758c8a059d1ef5364be895b90537ebcc5ee27b30b02bdd
|
|
| MD5 |
ce782a090ffd986e3272e48b7358429b
|
|
| BLAKE2b-256 |
8f06ca56d0b775cbad6910481684ae85b7f0c4f9b218776449dcc7766dfd4510
|