Compare commits
28 Commits
Add-more-i
...
v0.1.9
| Author | SHA1 | Date | |
|---|---|---|---|
| 8284ae9695 | |||
| c575f52ebb | |||
| 4d2ee85cbe | |||
| d6364fc975 | |||
| 7ff39ea252 | |||
| b61de80e8a | |||
| c53f6a3f77 | |||
| 7fe92790d7 | |||
| 3b9d5bc984 | |||
| a73f171102 | |||
| 157dc0e6cf | |||
| df6428550f | |||
| f1d4a7c1bc | |||
| 485453bc7d | |||
| 661fe4dfd6 | |||
| 0207899f1b | |||
| 359a1359f5 | |||
| 62fbdf3d5a | |||
| ec02f17089 | |||
| a164c0059b | |||
| a45f60c09e | |||
| 93ad7ba411 | |||
| 592b44ee43 | |||
| 1f78fedcb3 | |||
| 58858700d9 | |||
| 2c86c7741d | |||
| fc52024d5a | |||
| d768b8ae3f |
102
.github/workflows/build.yml
vendored
102
.github/workflows/build.yml
vendored
@@ -3,7 +3,7 @@ name: Build and Deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master # Change to your default branch if different
|
||||
- master
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
@@ -28,7 +28,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||
runs-on: self-hosted
|
||||
environment: ${{ github.event.inputs.environment || 'prod' }}
|
||||
steps:
|
||||
- name: Get Current User
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '9.0' # Change to your required .NET version
|
||||
dotnet-version: '9.0'
|
||||
|
||||
- name: Restore .NET Dependencies
|
||||
run: dotnet restore ./HomeApi.sln
|
||||
@@ -75,6 +75,24 @@ jobs:
|
||||
Write-Host "ChromeHeadlessShell not found in published output"
|
||||
}
|
||||
|
||||
# Check wwwroot and manually copy if missing
|
||||
- name: Ensure wwwroot is Included
|
||||
run: |
|
||||
if (-not (Test-Path -Path "./output/dotnet/wwwroot")) {
|
||||
Write-Host "wwwroot folder not found in published output, manually copying..."
|
||||
|
||||
# Check if wwwroot exists in project directory
|
||||
$sourceWwwroot = "./HomeApi/wwwroot"
|
||||
|
||||
if (Test-Path -Path $sourceWwwroot) {
|
||||
Write-Host "Found wwwroot directory in source, copying..."
|
||||
New-Item -ItemType Directory -Path "./output/dotnet/wwwroot" -Force
|
||||
Copy-Item -Path "$sourceWwwroot/*" -Destination "./output/dotnet/wwwroot" -Recurse -Force
|
||||
} else {
|
||||
Write-Host "WARNING: Could not find wwwroot in source directory!"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Generate SemVer version
|
||||
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||
id: semver
|
||||
@@ -82,10 +100,11 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: master
|
||||
patchAll: true # Always increment patch number
|
||||
patchAll: true
|
||||
|
||||
- name: Create GitHub Release
|
||||
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -95,6 +114,61 @@ jobs:
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Create placeholder appsettings for release
|
||||
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||
run: |
|
||||
$appSettings = @{
|
||||
Logging = @{
|
||||
LogLevel = @{
|
||||
Default = "Information"
|
||||
"Microsoft.AspNetCore" = "Warning"
|
||||
}
|
||||
}
|
||||
ApiConfiguration = @{
|
||||
EspConfiguration = @{
|
||||
InformationBoardImageUrl = "http://server_ip:port/home/default.jpg"
|
||||
UpdateIntervalMinutes = [int]"${{ vars.ESP_UPDATE_INTERVAL }}"
|
||||
BlackTextThreshold = [int]"${{ vars.ESP_BLACK_TEXT_THRESHOLD }}"
|
||||
EnableDithering = [System.Convert]::ToBoolean("${{ vars.ESP_ENABLE_DITHERING }}")
|
||||
DitheringStrength = [int]"${{ vars.ESP_DITHERING_STRENGTH }}"
|
||||
EnhanceContrast = [System.Convert]::ToBoolean("${{ vars.ESP_ENHANCE_CONTRAST }}")
|
||||
ContrastStrength = [int]"${{ vars.ESP_CONTRAST_STRENGTH }}"
|
||||
IsHighContrastMode = [System.Convert]::ToBoolean("${{ vars.ESP_HIGH_CONTRAST_MODE }}")
|
||||
}
|
||||
Keys = @{
|
||||
Weather = "SET THIS TO YOUR KEY"
|
||||
ResRobot = "SET THIS TO YOUR KEY"
|
||||
}
|
||||
BaseUrls = @{
|
||||
Nominatim = "${{ vars.NOMINATIM_URL }}"
|
||||
Aurora = "${{ vars.AURORA_URL }}"
|
||||
Weather = "${{ vars.WEATHER_URL }}"
|
||||
ResRobot = "${{ vars.RES_ROBOT_URL }}"
|
||||
}
|
||||
DefaultCity = "CITY ADDRESS"
|
||||
DefaultStation = "YOUR STATION"
|
||||
}
|
||||
AllowedHosts = "*"
|
||||
}
|
||||
|
||||
$appSettings | ConvertTo-Json -Depth 10 | Set-Content -Path "./output/dotnet/appsettings.json"
|
||||
Write-Host "Created placeholder appsettings.json successfully"
|
||||
|
||||
- name: Zip the build for github release
|
||||
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||
run: Compress-Archive -Path './output/*' -DestinationPath './output/HomeScreen_Build_${{ steps.semver.outputs.next }}.zip' -CompressionLevel Optimal -Force
|
||||
|
||||
- name: Upload Release Asset
|
||||
if: ${{ github.event.inputs.create_release != 'false' }}
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./output/HomeScreen_Build_${{ steps.semver.outputs.next }}.zip
|
||||
asset_name: HomeScreen_Build_${{ steps.semver.outputs.next }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Generate appsettings.json
|
||||
run: |
|
||||
$appSettings = @{
|
||||
@@ -134,24 +208,6 @@ jobs:
|
||||
$appSettings | ConvertTo-Json -Depth 10 | Set-Content -Path "./output/dotnet/appsettings.json"
|
||||
Write-Host "Generated appsettings.json successfully"
|
||||
|
||||
# Check wwwroot and manually copy if missing
|
||||
- name: Ensure wwwroot is Included
|
||||
run: |
|
||||
if (-not (Test-Path -Path "./output/dotnet/wwwroot")) {
|
||||
Write-Host "wwwroot folder not found in published output, manually copying..."
|
||||
|
||||
# Check if wwwroot exists in project directory
|
||||
$sourceWwwroot = "./HomeApi/wwwroot"
|
||||
|
||||
if (Test-Path -Path $sourceWwwroot) {
|
||||
Write-Host "Found wwwroot directory in source, copying..."
|
||||
New-Item -ItemType Directory -Path "./output/dotnet/wwwroot" -Force
|
||||
Copy-Item -Path "$sourceWwwroot/*" -Destination "./output/dotnet/wwwroot" -Recurse -Force
|
||||
} else {
|
||||
Write-Host "WARNING: Could not find wwwroot in source directory!"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -159,7 +215,7 @@ jobs:
|
||||
path: ./output/dotnet
|
||||
|
||||
deploy:
|
||||
runs-on: self-hosted # Ensure your self-hosted runner is configured
|
||||
runs-on: self-hosted
|
||||
needs: build
|
||||
environment: ${{ github.event.inputs.environment || 'prod' }}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -7,6 +7,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HomeApi", "HomeApi\HomeApi.csproj", "{0F340BDE-7B8E-4ACD-8A24-5B5BFFB424F4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ESP32_CODE", "ESP32_CODE", "{B3BCE85B-5021-4D4D-8758-CA7AAFF86C2D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Esp32_Code\ESPSCREEN\ESPSCREEN.ino = Esp32_Code\ESPSCREEN\ESPSCREEN.ino
|
||||
Esp32_Code\INFOSCREEN_WITH_INTERVAL\INFOSCREEN_WITH_INTERVAL.ino = Esp32_Code\INFOSCREEN_WITH_INTERVAL\INFOSCREEN_WITH_INTERVAL.ino
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -20,5 +26,6 @@ Global
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{0F340BDE-7B8E-4ACD-8A24-5B5BFFB424F4} = {FF03E920-D5E9-4BE0-AA6F-DB2E9287D3E4}
|
||||
{B3BCE85B-5021-4D4D-8758-CA7AAFF86C2D} = {FF03E920-D5E9-4BE0-AA6F-DB2E9287D3E4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\README.md" />
|
||||
<Content Include="..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace HomeApi.Models.Response;
|
||||
|
||||
public class TrafikLabsApiResponse
|
||||
{
|
||||
public List<Departure> Departure { get; set; }
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
145
README.md
145
README.md
@@ -1,4 +1,145 @@
|
||||
# This [](https://github.com/Myxelium/HomeScreen/actions/workflows/build.yml)
|
||||
Core api and Esp32 code for displaying weather data and public transport information on a e-ink display.
|
||||
[](https://github.com/myxelium/Wireless_Eink_HomeScreen "Go to GitHub repo")
|
||||
[](https://github.com/myxelium/Wireless_Eink_HomeScreen)
|
||||
[](https://github.com/myxelium/Wireless_Eink_HomeScreen)
|
||||
[](https://github.com/myxelium/Wireless_Eink_HomeScreen/releases/)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
[](https://github.com/myxelium/Wireless_Eink_HomeScreen/issues)
|
||||
[](https://github.com/Myxelium/Wireless_Eink_HomeScreen/actions/workflows/build.yml)
|
||||
# What why how
|
||||
This is a project I created that pulls weather data from the internet, transforms it into custom images, and displays them on an e-ink screen powered by an ESP32.
|
||||
|
||||
## What This Project Does
|
||||
|
||||
I wanted a low-power way to see weather information at a glance, so I built this system that:
|
||||
|
||||
- Fetches real-time weather data from online APIs
|
||||
- Processes and converts the data into visual images (temperature graphs, forecast icons, etc.)
|
||||
- Sends these images wirelessly to an ESP32 microcontroller
|
||||
- Displays the information on an energy-efficient e-ink screen
|
||||
- Updates periodically while consuming minimal power
|
||||
|
||||
<img width="800" height="480" alt="image" src="https://github.com/user-attachments/assets/ef5af0c6-ea3a-494d-b2af-3de6e70b3e6a" />
|
||||
|
||||
# How do I get to use this without programming knowledge?
|
||||
Check in the wiki for the guide how to get everything working!
|
||||
### 😺 [Wiki Get Started Guide](https://github.com/Myxelium/Wireless_Eink_HomeScreen/wiki/)
|
||||
|
||||
## Git Notes
|
||||
All commits has to follow this [Conventional Commits style](https://www.conventionalcommits.org/) to pass the pipeline.
|
||||
## Features 😺
|
||||
- Display current weather data
|
||||
- Display public transport information
|
||||
- Display time and date
|
||||
|
||||
## Requirements 🫥
|
||||
- [ESP32 board](https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board)
|
||||
- [E-ink display (e.g. Waveshare 7.5 inch)](https://www.waveshare.com/7.5inch-e-paper-hat.htm)
|
||||
|
||||
# Installation
|
||||
|
||||
This section provides instructions for setting up and running the HomeApi project.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [.NET 9.0 SDK](https://dotnet.microsoft.com/download/dotnet/9.0) or later
|
||||
- Docker (optional, for containerized deployment)
|
||||
- Git (to clone the repository)
|
||||
|
||||
## Option 1: Local Development Setup
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/Myxelium/HomeScreen.git
|
||||
cd HomeApi
|
||||
```
|
||||
|
||||
2. Restore dependencies:
|
||||
```bash
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
3. Build the project:
|
||||
```bash
|
||||
dotnet build
|
||||
```
|
||||
|
||||
4. Run the application:
|
||||
```bash
|
||||
dotnet run
|
||||
```
|
||||
|
||||
The API will be available at `http://localhost:5000`.
|
||||
|
||||
## Option 2: Docker Deployment
|
||||
|
||||
1. Build the Docker image:
|
||||
```bash
|
||||
docker build -t homeapi .
|
||||
```
|
||||
|
||||
2. Run the container:
|
||||
```bash
|
||||
docker run -d -p 5000 --name homeapi homeapi
|
||||
```
|
||||
|
||||
The API will be accessible at `http://localhost:5000`.
|
||||
|
||||
## Configuration
|
||||
|
||||
The application uses the standard .NET configuration system. You can modify settings in:
|
||||
|
||||
- `appsettings.json` - Default configuration
|
||||
- `appsettings.Development.json` - Development environment configuration
|
||||
|
||||
API endpoints:
|
||||
- Weather data: GET `/home`
|
||||
- Generated image: GET `/home/default.jpg`
|
||||
- Configuration data: GET `/home/configuration`
|
||||
- Departure board: GET `/home/departure-board`
|
||||
|
||||
## API Documentation
|
||||
|
||||
When running, API documentation is available through Scalar at `/scalar`.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
subgraph ESP32 Device
|
||||
ESP[ESP32 E-Ink Display]
|
||||
ESP -->|HTTP GET /home/configuration| API
|
||||
ESP -->|HTTP GET /home/default.jpg| API
|
||||
end
|
||||
|
||||
subgraph HomeApi
|
||||
API[HomeControllerAPI]
|
||||
API -->|MediatR| Handlers
|
||||
Handlers -->|Service Calls| Services
|
||||
Services -->|Refit Http Clients| Clients
|
||||
Clients -->|External APIs| ExtAPIs
|
||||
API -->|Returns JSON/JPEG| ESP
|
||||
end
|
||||
|
||||
subgraph ExternalAPIs
|
||||
WeatherAPI[Weather API]
|
||||
AuroraAPI[Aurora API]
|
||||
NominatimAPI[Nominatim API]
|
||||
ResRobotAPI[ResRobot API]
|
||||
end
|
||||
|
||||
ExtAPIs -.-> WeatherAPI
|
||||
ExtAPIs -.-> AuroraAPI
|
||||
ExtAPIs -.-> NominatimAPI
|
||||
ExtAPIs -.-> ResRobotAPI
|
||||
```
|
||||
|
||||
# ESP32 configuration and building
|
||||
<img width="4096" height="1842" alt="image" src="https://github.com/user-attachments/assets/5acf1b3b-f9bb-48bd-b310-a2852544eaba" />
|
||||
|
||||
Best way of getting the ESP32 ready for code upload is to follow this guide [WAVESHARE ESP32 GUIDE](https://web.archive.org/web/20250706150325/https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board).
|
||||
Once you have it ready so you can upload code to it copy my code in: Esp32_Code/INFOSCREEN_WITH_INTERVAL from this repo.
|
||||
|
||||
Install following libraries (if more is needed search for them and install them too):
|
||||
* ArduinoJson
|
||||
* GUI_Paint
|
||||
* JPEGDEC
|
||||
|
||||
You need the Waveshare examples installed since it uses code from them download them here [Download](https://files.waveshare.com/upload/5/50/E-Paper_ESP32_Driver_Board_Code.7z) or check above link.
|
||||
|
||||
20
compose.yaml
20
compose.yaml
@@ -1,13 +1,15 @@
|
||||
services:
|
||||
homeapi:
|
||||
image: homeapi
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
version: '3.8'
|
||||
|
||||
homeapi-1:
|
||||
image: homeapi-1
|
||||
services:
|
||||
homeapi:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: HomeApi/Dockerfile
|
||||
|
||||
image: homeapi:latest
|
||||
ports:
|
||||
- "5000:5000"
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
volumes:
|
||||
- ./HomeApi/appsettings.Development.json:/app/appsettings.Development.json:ro
|
||||
restart: unless-stopped
|
||||
Reference in New Issue
Block a user