📚 Improved blueprint management & database structure (#123) 🔧
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -1539,8 +1539,8 @@ def tapo_configuration_wizard():
|
||||
try:
|
||||
printers_logger.debug(f"Teste IP: {ip}")
|
||||
|
||||
# Ping-Test
|
||||
if not tapo_controller.ping_address(ip, timeout=3):
|
||||
# Ping-Test mit 5 Sekunden Timeout
|
||||
if not tapo_controller.ping_address(ip, timeout=5):
|
||||
discovery_results["errors"].append(f"{ip}: Nicht erreichbar (Ping fehlgeschlagen)")
|
||||
continue
|
||||
|
||||
|
BIN
backend/database/myp.db-shm
Normal file
BIN
backend/database/myp.db-shm
Normal file
Binary file not shown.
BIN
backend/database/myp.db-wal
Normal file
BIN
backend/database/myp.db-wal
Normal file
Binary file not shown.
73
backend/docs/TAPO_PING_TIMEOUT_FIX.md
Normal file
73
backend/docs/TAPO_PING_TIMEOUT_FIX.md
Normal file
@ -0,0 +1,73 @@
|
||||
# Tapo Ping-Timeout Standardisierung
|
||||
|
||||
## Problem
|
||||
Die Ping-Implementierungen für Tapo-Geräte verwendeten unterschiedliche Timeout-Werte:
|
||||
- Standard `ping_address()` Methode: 3 Sekunden (zu kurz)
|
||||
- Auto-Discovery: 2 Sekunden (zu kurz)
|
||||
- Discovery in Blueprint: 3 Sekunden (zu kurz)
|
||||
- Validation: 5 Sekunden (korrekt)
|
||||
|
||||
## Lösung
|
||||
Alle Ping-Operationen wurden auf den einheitlichen **5-Sekunden-Timeout** standardisiert.
|
||||
|
||||
## Geänderte Dateien
|
||||
|
||||
### 1. `/utils/hardware_integration.py`
|
||||
- **Zeile 406**: `ping_address()` Default-Timeout von 3→5 Sekunden
|
||||
- **Zeile 465**: Auto-Discovery Timeout von 2→5 Sekunden
|
||||
|
||||
### 2. `/blueprints/printers.py`
|
||||
- **Zeile 1543**: Discovery Timeout von 3→5 Sekunden
|
||||
- **Zeile 1744**: Validation behält korrekten 5-Sekunden-Timeout
|
||||
|
||||
## Begründung für 5-Sekunden-Timeout
|
||||
|
||||
1. **Netzwerk-Latenz**: Mercedes-Benz Unternehmensnetzwerk kann höhere Latenzen haben
|
||||
2. **Tapo-Gerät Antwortzeit**: TP-Link Tapo Geräte benötigen Zeit für TCP-Handshake
|
||||
3. **Zuverlässigkeit**: Vermeidet falsch-negative Ergebnisse bei temporären Netzwerkproblemen
|
||||
4. **Konsistenz**: Einheitlicher Timeout-Wert in der gesamten Anwendung
|
||||
|
||||
## Auswirkungen
|
||||
|
||||
### Positive Effekte:
|
||||
- ✅ Zuverlässigere Erkennung von Tapo-Geräten
|
||||
- ✅ Weniger falsch-negative Ping-Tests
|
||||
- ✅ Einheitliches Verhalten in der gesamten Anwendung
|
||||
- ✅ Bessere Kompatibilität mit Unternehmensnetzwerken
|
||||
|
||||
### Mögliche Nachteile:
|
||||
- ⚠️ Geringfügig langsamere Discovery-Prozesse
|
||||
- ⚠️ Längere Wartezeiten bei nicht erreichbaren Geräten
|
||||
|
||||
## Implementierte Timeout-Hierarchie
|
||||
|
||||
```
|
||||
Socket-Verbindungstest: 5 Sekunden (ping_address)
|
||||
├── Auto-Discovery: 5 Sekunden
|
||||
├── Manual Discovery: 5 Sekunden
|
||||
└── Validation Tests: 5 Sekunden
|
||||
|
||||
PyP100 API-Calls: 10 Sekunden (TAPO_TIMEOUT Konfiguration)
|
||||
├── Handshake & Login
|
||||
├── Status-Abfragen
|
||||
└── Ein/Aus-Schalten
|
||||
```
|
||||
|
||||
## Verifikation
|
||||
|
||||
```bash
|
||||
# Alle ping_address Aufrufe überprüfen
|
||||
grep -n "ping_address" utils/hardware_integration.py blueprints/printers.py
|
||||
|
||||
# Ergebnis: Alle verwenden timeout=5
|
||||
utils/hardware_integration.py:406: def ping_address(self, ip: str, timeout: int = 5) -> bool:
|
||||
utils/hardware_integration.py:465: if self.ping_address(ip, timeout=5):
|
||||
blueprints/printers.py:1543: if not tapo_controller.ping_address(ip, timeout=5):
|
||||
blueprints/printers.py:1744: ping_success = tapo_controller.ping_address(printer.plug_ip, timeout=5)
|
||||
```
|
||||
|
||||
## Datum
|
||||
16. Juni 2025
|
||||
|
||||
## Autor
|
||||
Till Tomczak - MYP Team
|
Binary file not shown.
@ -403,7 +403,7 @@ class TapoController:
|
||||
|
||||
return result
|
||||
|
||||
def ping_address(self, ip: str, timeout: int = 3) -> bool:
|
||||
def ping_address(self, ip: str, timeout: int = 5) -> bool:
|
||||
"""
|
||||
Führt einen Konnektivitätstest zu einer IP-Adresse durch
|
||||
Verwendet TCP-Verbindung statt Ping für bessere Kompatibilität
|
||||
@ -461,8 +461,8 @@ class TapoController:
|
||||
try:
|
||||
tapo_logger.info(f"🔍 teste ip {i+1}/{len(self.default_ips)}: {ip}")
|
||||
|
||||
# Schneller Ping-Test
|
||||
if self.ping_address(ip, timeout=2):
|
||||
# Ping-Test mit 5 Sekunden Timeout
|
||||
if self.ping_address(ip, timeout=5):
|
||||
tapo_logger.info(f"✅ steckdose mit ip {ip} ist erreichbar")
|
||||
|
||||
# Tapo-Verbindung testen
|
||||
|
Reference in New Issue
Block a user