'TRMNL Local Web Server' is a local web server designed to serve local content (BMP image) to a TRMNL client e-ink display. It simulates the TRMNL cloud server (https://usetrmnl.app/). The server is built using Flask and supports serving BMP images, logging requests, and updating configuration settings.
Very small change in Firmware of TRMNL needed.
original: #define API_BASE_URL "https://trmnl.app"
change to: #define API_BASE_URL "https://<your_ip>:83"
- Serve BMP Images: Provides endpoints to serve BMP images.
- manipulate BMP Images: provide an adpated new image with the collected data from client (wifi strength, battery state)
- API for Display: Endpoint to retrieve display information and update settings.
- Logging: Logs requests with timestamps and context.
- Configuration Management: Allows updating and retrieving configuration settings via API.
- Firmware Update: Placeholder for firmware update functionality.
-
GET /image/screen.bmp
- Serves the BMP image from the configured path.
- Logs the request with timestamp and context.
-
GET /image/screen1.bmp
- Serves the BMP image from the configured path.
- Logs the request with timestamp and context.
- GET /api/display
- Retrieves display information including image URL, refresh rate, and firmware update status.
- Logs the request with headers and URL.
- Responds with a JSON containing status, image URL, refresh rate, and other settings.
- POST /api/log
- Logs the content of the request.
- Responds with a JSON indicating the log status.
-
GET /settings
- Retrieves the current configuration settings including image path and refresh time.
- Responds with a JSON containing the configuration settings.
-
POST /settings/refreshtime
- Updates the refresh time in the configuration.
- Responds with a JSON indicating the success or error status.
-
POST /settings/imagepath
- Updates the image path in the configuration.
- Responds with a JSON indicating the success or error status.
- GET /server/log
- Retrieves the last 30 lines from the log file.
- Responds with the logs as plain text.
- GET /server/battery
- Retrieves battery data from the client database.
- Supports filtering by date range.
- Responds with a JSON containing the battery data.
The server uses a config.yaml
file for configuration. If the file does not exist, it will be created with default values.
- image_path: Path to the BMP image to be served.
- refresh_time: Refresh time for the display.
-
Clone the repository:
git clone https://github.com/yourusername/trmnlServer.git cd trmnlServer
-
Install dependencies:
pip install -r requirements.txt
-
Run the server:
python trmnlServer.py
To install the server as a system service using the provided install.sh script, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/trmnlServer.git cd trmnlServer
-
Make the script executable:
chmod +x install.sh
-
Run the script to install the service:
sudo bash install.sh -doit
-
Run the script to uninstall the service:
sudo bash install.sh -uninstall
To run the server as a system service, use the provided install.sh script.
-
Start Service
service trmnlServer start
-
Uninstall the Service
service trmnlServer stop
-
Get Status of the Service
service trmnlServer status