"Refactor job scheduling and printer monitoring"

This commit is contained in:
2025-05-29 22:27:10 +02:00
parent 2a1489b438
commit a02f382607
3 changed files with 105 additions and 68 deletions

View File

@@ -21,7 +21,7 @@ from config.settings import PRINTERS, TAPO_USERNAME, TAPO_PASSWORD, DEFAULT_TAPO
# TP-Link Tapo P110 Unterstützung hinzufügen
try:
from PyP100 import PyP110
from PyP100 import PyP100
TAPO_AVAILABLE = True
except ImportError:
TAPO_AVAILABLE = False
@@ -139,13 +139,13 @@ class PrinterMonitor:
return False
try:
# TP-Link Tapo P110 Verbindung herstellen
p110 = PyP110.P110(ip_address, username, password)
p110.handshake() # Authentifizierung
p110.login() # Login
# TP-Link Tapo P100 Verbindung herstellen (P100 statt P110 verwenden)
p100 = PyP100.P100(ip_address, username, password)
p100.handshake() # Authentifizierung
p100.login() # Login
# Steckdose ausschalten
p110.turnOff()
p100.turnOff()
monitor_logger.debug(f"✅ Tapo-Steckdose {ip_address} erfolgreich ausgeschaltet")
return True
@@ -403,13 +403,14 @@ class PrinterMonitor:
monitor_logger.debug(f"🔧 Verwende globale Tapo-Anmeldedaten für {ip_address}")
try:
# TP-Link Tapo P110 Verbindung herstellen
p110 = PyP110.P110(ip_address, username, password)
p110.handshake() # Authentifizierung
p110.login() # Login
# TP-Link Tapo P100 Verbindung herstellen (P100 statt P110 verwenden)
from PyP100 import PyP100
p100 = PyP100.P100(ip_address, username, password)
p100.handshake() # Authentifizierung
p100.login() # Login
# Geräteinformationen abrufen
device_info = p110.getDeviceInfo()
device_info = p100.getDeviceInfo()
# Status auswerten
device_on = device_info.get('device_on', False)
@@ -489,10 +490,10 @@ class PrinterMonitor:
# Tapo-Verbindung testen
if TAPO_AVAILABLE:
try:
p110 = PyP110.P110(ip, TAPO_USERNAME, TAPO_PASSWORD)
p110.handshake()
p110.login()
device_info = p110.getDeviceInfo()
p100 = PyP100.P100(ip, TAPO_USERNAME, TAPO_PASSWORD)
p100.handshake()
p100.login()
device_info = p100.getDeviceInfo()
# Steckdose gefunden und verbunden
nickname = device_info.get('nickname', f"Tapo P110 ({ip})")