test_hyperion_effects.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python3
  2. """
  3. Test script for Hyperion loading and connected effects
  4. This simulates the startup sequence when LEDs are off
  5. """
  6. import time
  7. import sys
  8. from modules.led.led_interface import LEDInterface
  9. # Configuration
  10. HYPERION_IP = "192.168.2.183"
  11. HYPERION_PORT = 8090
  12. def test_effects():
  13. """Test Hyperion effects with LEDs off"""
  14. print(f"Testing Hyperion effects at {HYPERION_IP}:{HYPERION_PORT}")
  15. print("=" * 60)
  16. # Create LED interface
  17. led = LEDInterface(
  18. provider="hyperion",
  19. ip_address=HYPERION_IP,
  20. port=HYPERION_PORT
  21. )
  22. # Test 1: Loading effect
  23. print("\n1. Testing LOADING effect (orange color)...")
  24. print(" - This should turn on the LEDs")
  25. print(" - Clear any previous effects")
  26. print(" - Show orange color")
  27. result = led.effect_loading()
  28. print(f" Result: {'SUCCESS' if result else 'FAILED'}")
  29. # Wait 5 seconds so you can see the loading effect
  30. print("\n Waiting 5 seconds...")
  31. time.sleep(5)
  32. # Test 2: Connected effect
  33. print("\n2. Testing CONNECTED effect (green flash)...")
  34. print(" - This should flash green twice")
  35. print(" - Then return to idle state (cleared)")
  36. result = led.effect_connected()
  37. print(f" Result: {'SUCCESS' if result else 'FAILED'}")
  38. print("\n" + "=" * 60)
  39. print("Test complete!")
  40. print("\nDid you see:")
  41. print(" 1. Orange color for ~5 seconds?")
  42. print(" 2. Two green flashes?")
  43. print(" 3. LEDs return to default state after?")
  44. if __name__ == "__main__":
  45. try:
  46. test_effects()
  47. except KeyboardInterrupt:
  48. print("\n\nTest interrupted by user")
  49. sys.exit(0)
  50. except Exception as e:
  51. print(f"\n\nERROR: {e}")
  52. import traceback
  53. traceback.print_exc()
  54. sys.exit(1)