remote setup
This commit is contained in:
73
test_controller_setup.py
Normal file
73
test_controller_setup.py
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for controller setup
|
||||
Verifies that the setup is working correctly
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
|
||||
def test_setup():
|
||||
"""Test the controller setup"""
|
||||
print("Testing IR Controller Setup")
|
||||
print("=" * 40)
|
||||
|
||||
# Check if custom protocol decoder exists
|
||||
if os.path.exists("custom_ir_protocol_final.py"):
|
||||
print("✅ Custom protocol decoder found")
|
||||
else:
|
||||
print("❌ Custom protocol decoder not found")
|
||||
return False
|
||||
|
||||
# Check if mapping file exists
|
||||
if os.path.exists("ir_mapping.json"):
|
||||
print("✅ IR mapping file found")
|
||||
|
||||
# Load and display mappings
|
||||
try:
|
||||
with open("ir_mapping.json", 'r') as f:
|
||||
mappings = json.load(f)
|
||||
|
||||
print(f" Found {len(mappings)} command mappings:")
|
||||
for ir_command, mapping in mappings.items():
|
||||
if ir_command.startswith("CUSTOM_"):
|
||||
print(f" - {ir_command} -> {mapping.get('command', 'unknown')}")
|
||||
except Exception as e:
|
||||
print(f" Error reading mappings: {e}")
|
||||
else:
|
||||
print("⚠️ IR mapping file not found (run setup first)")
|
||||
|
||||
# Check if IR listeners exist
|
||||
listeners = ["simple_ir_listener.py", "simple_ir_listener_polling.py"]
|
||||
for listener in listeners:
|
||||
if os.path.exists(listener):
|
||||
print(f"✅ {listener} found")
|
||||
else:
|
||||
print(f"❌ {listener} not found")
|
||||
|
||||
# Check if custom protocol is integrated
|
||||
integration_files = ["ir_remote.py", "simple_ir_listener_polling.py"]
|
||||
for file in integration_files:
|
||||
if os.path.exists(file):
|
||||
try:
|
||||
with open(file, 'r') as f:
|
||||
content = f.read()
|
||||
if "CustomIRProtocol" in content:
|
||||
print(f"✅ Custom protocol integrated in {file}")
|
||||
else:
|
||||
print(f"⚠️ Custom protocol not integrated in {file}")
|
||||
except Exception as e:
|
||||
print(f"❌ Error checking {file}: {e}")
|
||||
|
||||
print("\n" + "=" * 40)
|
||||
print("Setup test complete!")
|
||||
print("\nTo run the controller setup:")
|
||||
print(" ./setup_controller.sh")
|
||||
print("\nTo test IR commands:")
|
||||
print(" python3 simple_ir_listener_polling.py --verbose")
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_setup()
|
||||
Reference in New Issue
Block a user