📝 🚀 Improved calendar and printer functionalities, refactored logs, and updated tests. 🖥️📅
This commit is contained in:
@ -12,7 +12,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from app import app
|
||||
from models import init_database, Printer, User, get_db_session
|
||||
from utils.tapo_status_manager import tapo_status_manager
|
||||
from utils.hardware_integration import printer_monitor
|
||||
from utils.logging_config import get_logger
|
||||
|
||||
logger = get_logger("test_printer_setup")
|
||||
@ -126,7 +126,7 @@ def test_printer_status():
|
||||
|
||||
with app.app_context():
|
||||
# Status aller Drucker abrufen
|
||||
all_status = tapo_status_manager.get_all_printer_status()
|
||||
all_status = printer_monitor.get_all_printer_status()
|
||||
|
||||
logger.info(f"📊 Status für {len(all_status)} Drucker abgerufen:\n")
|
||||
|
||||
@ -148,7 +148,7 @@ def test_printer_status():
|
||||
logger.info(f" 🔌 Steckdosen-IP: {status.get('plug_ip', 'Keine')}")
|
||||
|
||||
if status.get("has_plug"):
|
||||
status_text = tapo_status_manager.STATUS_DISPLAY.get(plug_status, {}).get("text", "Unbekannt")
|
||||
status_text = printer_monitor.STATUS_DISPLAY.get(plug_status, {}).get("text", "Unbekannt")
|
||||
logger.info(f" ⚡ Status: {status_text}")
|
||||
|
||||
if status.get("plug_reachable"):
|
||||
@ -194,7 +194,7 @@ def test_plug_control():
|
||||
logger.info(f"🎯 Teste Steuerung für: {printer.name}")
|
||||
|
||||
# Aktuellen Status abrufen
|
||||
current_status = tapo_status_manager.get_printer_status(printer.id)
|
||||
current_status = printer_monitor.get_printer_status(printer.id)
|
||||
logger.info(f"📊 Aktueller Status: {current_status.get('plug_status', 'unknown')}")
|
||||
|
||||
if not current_status.get("can_control"):
|
||||
@ -209,13 +209,13 @@ def test_plug_control():
|
||||
action = "on" if current_status.get("plug_status") == "off" else "off"
|
||||
logger.info(f"🔄 Versuche Steckdose zu '{action}' zu schalten...")
|
||||
|
||||
success, msg = tapo_status_manager.control_plug(printer.id, action)
|
||||
success, msg = printer_monitor.control_plug(printer.id, action)
|
||||
|
||||
if success:
|
||||
logger.info(f"✅ {msg}")
|
||||
|
||||
# Neuen Status abrufen
|
||||
new_status = tapo_status_manager.get_printer_status(printer.id)
|
||||
new_status = printer_monitor.get_printer_status(printer.id)
|
||||
logger.info(f"📊 Neuer Status: {new_status.get('plug_status', 'unknown')}")
|
||||
else:
|
||||
logger.error(f"❌ Fehler: {msg}")
|
||||
|
Reference in New Issue
Block a user