Verify Ecovacs mqtt config (#109306)
parent
fe0228139e
commit
cb5be4901b
|
@ -74,11 +74,16 @@ class EcovacsController:
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
"""Init controller."""
|
"""Init controller."""
|
||||||
|
mqtt_config_verfied = False
|
||||||
try:
|
try:
|
||||||
devices = await self._api_client.get_devices()
|
devices = await self._api_client.get_devices()
|
||||||
credentials = await self._authenticator.authenticate()
|
credentials = await self._authenticator.authenticate()
|
||||||
for device_config in devices:
|
for device_config in devices:
|
||||||
if isinstance(device_config, DeviceInfo):
|
if isinstance(device_config, DeviceInfo):
|
||||||
|
# MQTT device
|
||||||
|
if not mqtt_config_verfied:
|
||||||
|
await self._mqtt.verify_config()
|
||||||
|
mqtt_config_verfied = True
|
||||||
device = Device(device_config, self._authenticator)
|
device = Device(device_config, self._authenticator)
|
||||||
await device.initialize(self._mqtt)
|
await device.initialize(self._mqtt)
|
||||||
self.devices.append(device)
|
self.devices.append(device)
|
||||||
|
|
Loading…
Reference in New Issue