{"id":24020910,"url":"https://github.com/ohAnd/trmnlServer","last_synced_at":"2025-09-14T20:32:20.138Z","repository":{"id":262516836,"uuid":"887481292","full_name":"ohAnd/trmnlServer","owner":"ohAnd","description":"TRMNL local server to simulate the cloud service locally to serve own BMP's directly","archived":false,"fork":false,"pushed_at":"2025-04-04T04:56:14.000Z","size":837,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T11:35:35.293Z","etag":null,"topics":["localserver","trmnl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ohAnd.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-12T20:23:37.000Z","updated_at":"2025-05-14T14:23:40.000Z","dependencies_parsed_at":"2024-11-12T21:30:59.178Z","dependency_job_id":"2519989b-858b-4a1e-83eb-d8f03f6871bb","html_url":"https://github.com/ohAnd/trmnlServer","commit_stats":null,"previous_names":["ohand/trmnlserver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ohAnd/trmnlServer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohAnd%2FtrmnlServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohAnd%2FtrmnlServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohAnd%2FtrmnlServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohAnd%2FtrmnlServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohAnd","download_url":"https://codeload.github.com/ohAnd/trmnlServer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohAnd%2FtrmnlServer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275161941,"owners_count":25416092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["localserver","trmnl"],"created_at":"2025-01-08T12:19:06.075Z","updated_at":"2025-09-14T20:32:20.119Z","avatar_url":"https://github.com/ohAnd.png","language":"Python","funding_links":[],"categories":["👾 Extra's"],"sub_categories":[],"readme":"# TRMNL - Local Web Server \u003c!-- omit in toc --\u003e\n\n## TOC \u003c!-- omit in toc --\u003e\n- [Overview](#overview)\n- [Features](#features)\n- [Endpoints](#endpoints)\n  - [Serve BMP Images](#serve-bmp-images)\n  - [API for Display](#api-for-display)\n  - [Logging](#logging)\n  - [Configuration Management](#configuration-management)\n  - [Server Logs](#server-logs)\n  - [Battery Data](#battery-data)\n- [Configuration](#configuration)\n- [Installation](#installation)\n  - [Running in Home Assistant as an Add-On](#running-in-home-assistant-as-an-add-on)\n  - [Manual Installation](#manual-installation)\n  - [Installation Using install.sh](#installation-using-installsh)\n    - [Running as a System Service](#running-as-a-system-service)\n\n\n## Overview\n\n'TRMNL Local Web Server' is a local web server designed to serve local content (BMP image) to a [TRMNL client e-ink display](https://www.kickstarter.com/projects/usetrmnl/trmnl-the-e-ink-display-for-your-favorite-apps-and-news?lang=de). 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.\n\nTo enable the usage of TRMNL with this self hosted server there are 2 options:\n1. Firmware post https://github.com/usetrmnl/firmware/issues/61 supports self-hosted servers out of the box.\n    - there is a possibilty mentioned for using http and https - due to legacy compatibility https have to used with trmnl_server\n3. For older firmware a small change is required in [Firmware of TRMNL](https://github.com/usetrmnl/firmware/blob/e3db8c37990c2333ec90b1be10749f9d37620a18/include/config.h#L49)\n    - original: ```#define API_BASE_URL \"https://trmnl.app\" ```\n    - change to: ```#define API_BASE_URL \"https://\u003cyour_ip\u003e:\u003cconfigured_port\u003e\" ``` (e.g. https://192.178.1.10:83)\n\n\n## Features\n\n- **Serve BMP Images**: Provides endpoints to serve BMP images.\n- **manipulate BMP Images**: provide an adpated new image with the collected data from client (wifi strength, battery state)\n- **API for Display**: Endpoint to retrieve display information and update settings.\n- **Logging**: Logs requests with timestamps and context.\n- **Configuration Management**: Allows updating and retrieving configuration settings via API.\n- **Firmware Update**: Placeholder for firmware update functionality.\n\n\u003cimg src=\"doc/home.png\" alt=\"Home Screen\" width=\"500\" height=\"300\"\u003e\n\u003cimg src=\"doc/client.png\" alt=\"Home Screen\" width=\"500\" height=\"300\"\u003e\n\n\u003cimg src=\"doc/server.png\" alt=\"Home Screen\" width=\"500\" height=\"300\"\u003e\n\u003cimg src=\"doc/settings.png\" alt=\"Home Screen\" width=\"500\" height=\"300\"\u003e\n\n## Endpoints\n\n### Serve BMP Images\n\n- **GET /image/screen.bmp**\n  - Serves the BMP image from the configured path.\n  - Logs the request with timestamp and context.\n\n- **GET /image/screen1.bmp**\n  - Serves the BMP image from the configured path.\n  - Logs the request with timestamp and context.\n\n### API for Display\n\n- **GET /api/display**\n  - Retrieves display information including image URL, refresh rate, and firmware update status.\n  - Logs the request with headers and URL.\n  - Responds with a JSON containing status, image URL, refresh rate, and other settings.\n\n### Logging\n\n- **POST /api/log**\n  - Logs the content of the request.\n  - Responds with a JSON indicating the log status.\n\n### Configuration Management\n\n- **GET /settings**\n  - Retrieves the current configuration settings including image path and refresh time.\n  - Responds with a JSON containing the configuration settings.\n\n- **POST /settings/refreshtime**\n  - Updates the refresh time in the configuration.\n  - Responds with a JSON indicating the success or error status.\n\n- **POST /settings/imagepath**\n  - Updates the image path in the configuration.\n  - Responds with a JSON indicating the success or error status.\n\n### Server Logs\n\n- **GET /server/log**\n  - Retrieves the last 30 lines from the log file.\n  - Responds with the logs as plain text.\n\n### Battery Data\n\n- **GET /server/battery**\n  - Retrieves battery data from the client database.\n  - Supports filtering by date range.\n  - Responds with a JSON containing the battery data.\n\n## Configuration\n\nThe server uses a `config.yaml` file for configuration. If the file does not exist, it will be created with default values.\n\n- **image_path**: Path to the BMP image to be served.\n- **refresh_time**: Refresh time for the display.\n\n## Installation\n\n### Running in Home Assistant as an Add-On\n\nYou can find the HA addon here [`https://github.com/ohAnd/ha_addons`](https://github.com/ohAnd/ha_addons)\n\n---\n\n1. **Add the Repository**:\n   - Open Home Assistant.\n   - Navigate to **Settings** \u003e **Add-ons** \u003e **Add-on Store**.\n   - Click on the **⋮ (three dots)** in the top-right corner and select **Repositories**.\n   - Add the repository URL:  \n     `https://github.com/ohAnd/ha_addons`.\n     \n    or press the button:\n\n     [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fohand%2Fha_addons)\n\n\n2. **Install the Add-On**:\n   - Search for **TRMNL Server** in the Add-on Store.\n   - Click on the add-on and select **Install**.\n\n3. **Configure the Add-On**:\n   - After installation, go to the **Configuration** tab of the add-on.\n   - Adjust the settings (e.g., image path, refresh time) as needed.\n\n4. **Start the Add-On**:\n   - Go to the **Info** tab of the add-on.\n   - Click **Start** to launch the TRMNL Server.\n\n5. **Access the Server**:\n   - The server will be accessible at `http://\u003cyour_home_assistant_ip\u003e:8081`.\n\n6. **Logs and Debugging**:\n   - Check the **Log** tab for any issues or to monitor the server's activity.\n\n\n### Manual Installation\n1. **Clone the repository**:\n   ```sh\n   git clone https://github.com/yourusername/trmnlServer.git\n   cd trmnlServer\n   ```\n2. Install dependencies:\n\n    ```pip install -r requirements.txt```\n\n3. Run the server:\n    ```python trmnlServer.py```\n\n### Installation Using install.sh\nTo install the server as a system service using the provided install.sh script, follow these steps:\n\n1. Clone the repository:\n    ```\n    git clone https://github.com/yourusername/trmnlServer.git\n    cd trmnlServer\n    ```\n2. Make the script executable:\n\n    ```chmod +x install.sh```\n\n3. Run the script to install the service:\n\n    ``` sudo bash install.sh -doit ```\n\n4. Run the script to uninstall the service:\n\n    ``` sudo bash install.sh -uninstall```\n\n#### Running as a System Service\nTo run the server as a system service, use the provided install.sh script.\n\n1. Start Service\n\n    ``` service trmnlServer start```\n\n2. Uninstall the Service\n\n    ``` service trmnlServer stop```\n\n2. Get Status of the Service\n\n    ``` service trmnlServer status```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FohAnd%2FtrmnlServer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FohAnd%2FtrmnlServer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FohAnd%2FtrmnlServer/lists"}