Public
Like
terminal-jon-bo
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A Val.town HTTP endpoint that serves as a backend for TRMNL e-paper displays, providing weather information for Boulder, CO.
Device setup endpoint that returns configuration for the TRMNL display.
Headers:
ID: Device MAC address
Response:
{ "status": 200, "api_key": "test-key-123", "friendly_id": "WEATHER1", "image_url": "", "filename": "setup" }
Main display endpoint that generates weather display images.
Headers:
ID: Device MAC addressAccess-Token: API key from setupRefresh-Rate: Refresh interval in seconds (default: 900)
Response:
{ "status": 0, "image_url": "data:image/bmp;base64,<base64-encoded-bmp>", "filename": "weather", "refresh_rate": 900 }
The image is a 800x480 pixel, 1-bit BMP showing:
- Current temperature (large font)
- Weather condition
- City name (Boulder, CO)
- Current time (Mountain Time)
Logging endpoint for device telemetry.
Body: Any JSON object
Response:
{ "status": 200 }
- Weather Data: Fetches current weather for Boulder, CO using wttr.in API
- BMP Generation: Creates properly formatted 1-bit BMP images (800x480)
- Text Rendering: Custom bitmap font rendering for weather information
- Time Display: Shows current time in Mountain Time zone
- CORS Enabled: Ready for cross-origin requests
- Image Format: 1-bit BMP with 62-byte header + 48000 bytes pixel data
- Color Depth: Black and white only (1-bit per pixel)
- Refresh Rate: Configurable, defaults to 15 minutes (900 seconds)
- Weather Source: wttr.in (no API key required)
- Time Zone: America/Denver (Mountain Time)
The endpoint is ready to use with TRMNL e-paper displays. Simply configure your device to point to this backend URL and it will automatically fetch and display weather information for Boulder, CO.
You can test the endpoints using curl:
# Setup curl -H "ID: AA:BB:CC:DD:EE:FF" https://your-val-url/api/setup # Display curl -H "ID: AA:BB:CC:DD:EE:FF" -H "Access-Token: test-key-123" https://your-val-url/api/display # Log curl -X POST -H "Content-Type: application/json" -d '{"test": "data"}' https://your-val-url/api/log
