42 lines
1.2 KiB
Python
Executable File
42 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify the unknown device toggling functionality.
|
|
This script will process a single device by IP address or hostname.
|
|
"""
|
|
|
|
import sys
|
|
import logging
|
|
from TasmotaManager import TasmotaDiscovery
|
|
|
|
# Configure logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
)
|
|
|
|
def main():
|
|
"""Main function to test the unknown device toggling functionality."""
|
|
if len(sys.argv) < 2:
|
|
print("Usage: python test_unknown_device_toggle.py <device_identifier>")
|
|
print(" <device_identifier> can be an IP address or hostname")
|
|
sys.exit(1)
|
|
|
|
device_identifier = sys.argv[1]
|
|
print(f"Testing unknown device toggling for: {device_identifier}")
|
|
|
|
# Initialize TasmotaDiscovery with debug mode
|
|
discovery = TasmotaDiscovery(debug=True)
|
|
|
|
# Load configuration
|
|
discovery.load_config()
|
|
|
|
# Process the single device
|
|
result = discovery.process_single_device(device_identifier)
|
|
|
|
if result:
|
|
print(f"Successfully processed device: {device_identifier}")
|
|
else:
|
|
print(f"Failed to process device: {device_identifier}")
|
|
|
|
if __name__ == "__main__":
|
|
main() |