diff --git a/homeassistant/components/ecovacs.py b/homeassistant/components/ecovacs.py index 2e51b048d15e43203cf69f31b8ec58ca67b593a8..53761a1013fa51b730403eb18ce842afe3ef879f 100644 --- a/homeassistant/components/ecovacs.py +++ b/homeassistant/components/ecovacs.py @@ -59,8 +59,9 @@ def setup(hass, config): _LOGGER.debug("Ecobot devices: %s", devices) for device in devices: - _LOGGER.info("Discovered Ecovacs device on account: %s", - device['nick']) + _LOGGER.info( + "Discovered Ecovacs device on account: %s with nickname %s", + device['did'], device['nick']) vacbot = VacBot(ecovacs_api.uid, ecovacs_api.REALM, ecovacs_api.resource, @@ -74,7 +75,7 @@ def setup(hass, config): """Shut down open connections to Ecovacs XMPP server.""" for device in hass.data[ECOVACS_DEVICES]: _LOGGER.info("Shutting down connection to Ecovacs device %s", - device.vacuum['nick']) + device.vacuum['did']) device.disconnect() # Listen for HA stop to disconnect. diff --git a/homeassistant/components/vacuum/ecovacs.py b/homeassistant/components/vacuum/ecovacs.py index b92ae598f805e63425145cc844ffdc07a8e977ef..927362ac9db268eb019870b79c1de11c16a319ca 100644 --- a/homeassistant/components/vacuum/ecovacs.py +++ b/homeassistant/components/vacuum/ecovacs.py @@ -43,9 +43,9 @@ class EcovacsVacuum(VacuumDevice): """Initialize the Ecovacs Vacuum.""" self.device = device self.device.connect_and_wait_until_ready() - try: + if self.device.vacuum.get('nick', None) is not None: self._name = '{}'.format(self.device.vacuum['nick']) - except KeyError: + else: # In case there is no nickname defined, use the device id self._name = '{}'.format(self.device.vacuum['did'])