# On-Demand Display - Quick Start Guide ## ๐ฏ What Is It? On-Demand Display lets users **manually trigger** specific plugins to show on the LED matrix - perfect for "Show Now" buttons in your web interface! > **2025 update:** The LEDMatrix web interface now ships with first-class on-demand controls. You can trigger plugins directly from the Plugin Management page or by calling the new `/api/v3/display/on-demand/*` endpoints described below. The legacy quick-start steps are still documented for bespoke integrations. ## โ Built-In Controls ### Web Interface (no-code) - Navigate to **Settings โ Plugin Management**. - Each installed plugin now exposes a **Run On-Demand** button: - Choose the display mode (when a plugin exposes multiple views). - Optionally set a fixed duration (leave blank to use the plugin default or `0` to run until you stop it). - Pin the plugin so rotation stays paused. - The dashboard shows real-time status and lets you stop the session. **Shift+click** the stop button to stop the display service after clearing the plugin. - The status card refreshes automatically and indicates whether the display service is running. ### REST Endpoints All endpoints live under `/api/v3/display/on-demand`. | Endpoint | Method | Description | |----------|--------|-------------| | `/status` | GET | Returns the current on-demand state plus display service health. | | `/start` | POST | Requests a plugin/mode to run. Automatically starts the display service (unless `start_service: false`). | | `/stop` | POST | Clears on-demand mode. Include `{"stop_service": true}` to stop the systemd service. | Example `curl` calls: ```bash # Start the default mode for football-scoreboard for 45 seconds curl -X POST http://localhost:5000/api/v3/display/on-demand/start \ -H "Content-Type: application/json" \ -d '{ "plugin_id": "football-scoreboard", "duration": 45, "pinned": true }' # Start by mode name (plugin id inferred automatically) curl -X POST http://localhost:5000/api/v3/display/on-demand/start \ -H "Content-Type: application/json" \ -d '{ "mode": "football_live" }' # Stop on-demand and shut down the display service curl -X POST http://localhost:5000/api/v3/display/on-demand/stop \ -H "Content-Type: application/json" \ -d '{ "stop_service": true }' # Check current status curl http://localhost:5000/api/v3/display/on-demand/status | jq ``` **Notes** - The display controller will honour the pluginโs configured `display_duration` when no duration is provided. - When you pass `duration: 0` (or omit it) and `pinned: true`, the plugin stays active until you issue `/stop`. - The service automatically resumes normal rotation after the on-demand session expires or is cleared. ## ๐ Quick Implementation (3 Steps) > The steps below describe a lightweight custom implementation that predates the built-in API. You generally no longer need this unless you are integrating with a separate control surface. ### Step 1: Add API Endpoint ```python # In web_interface/blueprints/api_v3.py @api_v3.route('/display/show', methods=['POST']) def show_on_demand(): data = request.json mode = data.get('mode') duration = data.get('duration', 30) # Default 30 seconds # Get display controller (implementation depends on your setup) controller = get_display_controller() success = controller.show_on_demand(mode, duration=duration) return jsonify({'success': success}) @api_v3.route('/display/clear', methods=['POST']) def clear_on_demand(): controller = get_display_controller() controller.clear_on_demand() return jsonify({'success': True}) ``` ### Step 2: Add UI Button ```html ``` ### Step 3: Done! ๐ Users can now click the button to show weather immediately! ## ๐ Complete Web UI Example ```html