Fix Issue #3: Add delay after MQTT configuration before console settings

- Add 1-second delay after MQTT changes to allow device to process
- Only delays when MQTT settings were actually updated
- Prevents intermittent failures when applying console settings
- Device needs time to process MQTT reconnection before accepting new commands
This commit is contained in:
Mike Geppert 2025-10-28 08:54:17 +00:00
parent 4d510688ab
commit bc384f6b9c

View File

@ -1640,10 +1640,15 @@ class TasmotaDiscovery:
self.logger.error(f"{name}: Failed to set {setting}")
except requests.exceptions.RequestException as e:
self.logger.error(f"{name}: Error updating {setting}: {str(e)}")
# Add delay after MQTT configuration to allow device to process changes
if mqtt_updated:
self.logger.debug(f"{name}: Waiting for device to process MQTT changes...")
time.sleep(1.0)
# Apply console settings
console_updated = self.apply_console_settings(ip, name, with_retry)
# Reboot the device if requested
if reboot:
save_url = f"http://{ip}/cm?cmnd=Restart%201"