1
0
Эх сурвалжийг харах

add nonrpi requirements file

tuanchris 3 сар өмнө
parent
commit
44b61269c3

+ 9 - 0
README.md

@@ -109,11 +109,20 @@ The project exposes RESTful APIs for various actions. Here are some key endpoint
    ```
 
 2. **Install dependencies**:
+
+   **On Raspberry Pi (full hardware support):**
    ```bash
    pip install -r requirements.txt
    npm install
    ```
 
+   **On Windows/Linux/macOS (development/testing):**
+   ```bash
+   pip install -r requirements-nonrpi.txt
+   npm install
+   ```
+   > **Note**: The development installation excludes Raspberry Pi GPIO libraries. The application will run fully but DW LED features will be disabled. WLED integration will still work.
+
 3. **Build CSS**:
    ```bash
    npm run build-css

+ 1 - 1
VERSION

@@ -1 +1 @@
-3.4
+3.4.1

+ 17 - 1
modules/led/led_interface.py

@@ -4,7 +4,19 @@ Provides a common abstraction layer for pattern manager integration.
 """
 from typing import Optional, Literal
 from modules.led.led_controller import LEDController, effect_loading as wled_loading, effect_idle as wled_idle, effect_connected as wled_connected, effect_playing as wled_playing
-from modules.led.dw_led_controller import DWLEDController, effect_loading as dw_led_loading, effect_idle as dw_led_idle, effect_connected as dw_led_connected, effect_playing as dw_led_playing
+
+# Try to import DW LED controller - it requires RPi-specific dependencies
+try:
+    from modules.led.dw_led_controller import DWLEDController, effect_loading as dw_led_loading, effect_idle as dw_led_idle, effect_connected as dw_led_connected, effect_playing as dw_led_playing
+    DW_LEDS_AVAILABLE = True
+except ImportError:
+    # Running on non-RPi platform - DW LEDs not available
+    DWLEDController = None
+    dw_led_loading = None
+    dw_led_idle = None
+    dw_led_connected = None
+    dw_led_playing = None
+    DW_LEDS_AVAILABLE = False
 
 
 LEDProviderType = Literal["wled", "dw_leds", "none"]
@@ -25,6 +37,8 @@ class LEDInterface:
         if provider == "wled" and ip_address:
             self._controller = LEDController(ip_address)
         elif provider == "dw_leds":
+            if not DW_LEDS_AVAILABLE:
+                raise ImportError("DW LED controller requires Raspberry Pi GPIO libraries. Install with: pip install -r requirements.txt")
             # DW LEDs uses local GPIO, no IP needed
             num_leds = num_leds or 60
             gpio_pin = gpio_pin or 12
@@ -55,6 +69,8 @@ class LEDInterface:
         if provider == "wled" and ip_address:
             self._controller = LEDController(ip_address)
         elif provider == "dw_leds":
+            if not DW_LEDS_AVAILABLE:
+                raise ImportError("DW LED controller requires Raspberry Pi GPIO libraries. Install with: pip install -r requirements.txt")
             num_leds = num_leds or 60
             gpio_pin = gpio_pin or 12
             pixel_order = pixel_order or "GRB"

+ 24 - 0
requirements-nonrpi.txt

@@ -0,0 +1,24 @@
+# Development dependencies for non-Raspberry Pi platforms (Windows, Linux, macOS)
+# Use this for development, testing, and running the web interface without hardware
+#
+# Install with: pip install -r requirements-nonrpi.txt
+#
+# NOTE: This excludes RPi-specific GPIO/LED libraries. The application will run
+# but DW LED features will be disabled (graceful degradation).
+# For full hardware support on Raspberry Pi, use: pip install -r requirements.txt
+
+pyserial>=3.5
+tqdm>=4.65.0
+paho-mqtt>=1.6.1
+python-dotenv>=1.0.0
+websocket-client>=1.6.1
+fastapi>=0.100.0
+uvicorn>=0.23.0
+pydantic>=2.0.0
+jinja2>=3.1.2
+aiofiles>=23.1.0
+python-multipart>=0.0.6
+websockets>=11.0.3  # Required for FastAPI WebSocket support
+requests>=2.31.0
+Pillow
+aiohttp