#!/usr/bin/env python3 """ Test script to verify patterns are using the selected palette color """ import asyncio import aiohttp import json async def test_pattern_with_color(): """Test sending a pattern and verifying the color""" # Connect to WebSocket session = aiohttp.ClientSession() try: async with session.ws_connect('http://localhost:8765/ws') as ws: print("āœ… Connected to WebSocket at ws://localhost:8765/ws") # Send pattern change to 'on' msg = { "type": "pattern_change", "data": {"pattern": "on"} } print(f"\nšŸ“¤ Sending: {json.dumps(msg, indent=2)}") await ws.send_json(msg) # Wait a moment await asyncio.sleep(1) # Send alternating pattern msg = { "type": "pattern_change", "data": {"pattern": "alternating"} } print(f"\nšŸ“¤ Sending: {json.dumps(msg, indent=2)}") await ws.send_json(msg) await asyncio.sleep(2) print("\nāœ… Patterns sent successfully!") print("Check the LED bar to see if it's using purple RGB(128, 0, 128)") except Exception as e: print(f"āŒ Error: {e}") finally: await session.close() if __name__ == "__main__": asyncio.run(test_pattern_with_color())