diff --git a/homeassistant/components/neato/camera.py b/homeassistant/components/neato/camera.py index dc6e8d0d8d4..4d7c4129d81 100644 --- a/homeassistant/components/neato/camera.py +++ b/homeassistant/components/neato/camera.py @@ -60,18 +60,20 @@ class NeatoCleaningMap(Camera): def update(self): """Check the contents of the map list.""" if self.neato is None: - _LOGGER.error("Error while updating camera") + _LOGGER.error("Error while updating '%s'", self.entity_id) self._image = None self._image_url = None self._available = False return - _LOGGER.debug("Running camera update") + _LOGGER.debug("Running camera update for '%s'", self.entity_id) try: self.neato.update_robots() except NeatoRobotException as ex: if self._available: # Print only once when available - _LOGGER.error("Neato camera connection error: %s", ex) + _LOGGER.error( + "Neato camera connection error for '%s': %s", self.entity_id, ex + ) self._image = None self._image_url = None self._available = False @@ -81,14 +83,18 @@ class NeatoCleaningMap(Camera): map_data = self._mapdata[self._robot_serial]["maps"][0] image_url = map_data["url"] if image_url == self._image_url: - _LOGGER.debug("The map image_url is the same as old") + _LOGGER.debug( + "The map image_url for '%s' is the same as old", self.entity_id + ) return try: image = self.neato.download_map(image_url) except NeatoRobotException as ex: if self._available: # Print only once when available - _LOGGER.error("Neato camera connection error: %s", ex) + _LOGGER.error( + "Neato camera connection error for '%s': %s", self.entity_id, ex + ) self._image = None self._image_url = None self._available = False diff --git a/homeassistant/components/neato/sensor.py b/homeassistant/components/neato/sensor.py index 5573e280a99..17973df06bd 100644 --- a/homeassistant/components/neato/sensor.py +++ b/homeassistant/components/neato/sensor.py @@ -48,7 +48,9 @@ class NeatoSensor(Entity): self._state = self.robot.state except NeatoRobotException as ex: if self._available: - _LOGGER.error("Neato sensor connection error: %s", ex) + _LOGGER.error( + "Neato sensor connection error for '%s': %s", self.entity_id, ex + ) self._state = None self._available = False return diff --git a/homeassistant/components/neato/switch.py b/homeassistant/components/neato/switch.py index 54149630ff2..a6aa19abe26 100644 --- a/homeassistant/components/neato/switch.py +++ b/homeassistant/components/neato/switch.py @@ -49,12 +49,14 @@ class NeatoConnectedSwitch(ToggleEntity): def update(self): """Update the states of Neato switches.""" - _LOGGER.debug("Running switch update") + _LOGGER.debug("Running Neato switch update for '%s'", self.entity_id) try: self._state = self.robot.state except NeatoRobotException as ex: if self._available: # Print only once when available - _LOGGER.error("Neato switch connection error: %s", ex) + _LOGGER.error( + "Neato switch connection error for '%s': %s", self.entity_id, ex + ) self._state = None self._available = False return @@ -67,7 +69,9 @@ class NeatoConnectedSwitch(ToggleEntity): self._schedule_state = STATE_ON else: self._schedule_state = STATE_OFF - _LOGGER.debug("Schedule state: %s", self._schedule_state) + _LOGGER.debug( + "Schedule state for '%s': %s", self.entity_id, self._schedule_state + ) @property def name(self): @@ -103,7 +107,9 @@ class NeatoConnectedSwitch(ToggleEntity): try: self.robot.enable_schedule() except NeatoRobotException as ex: - _LOGGER.error("Neato switch connection error: %s", ex) + _LOGGER.error( + "Neato switch connection error '%s': %s", self.entity_id, ex + ) def turn_off(self, **kwargs): """Turn the switch off.""" @@ -111,4 +117,6 @@ class NeatoConnectedSwitch(ToggleEntity): try: self.robot.disable_schedule() except NeatoRobotException as ex: - _LOGGER.error("Neato switch connection error: %s", ex) + _LOGGER.error( + "Neato switch connection error '%s': %s", self.entity_id, ex + ) diff --git a/homeassistant/components/neato/vacuum.py b/homeassistant/components/neato/vacuum.py index 90b52aab073..2f5703615b6 100644 --- a/homeassistant/components/neato/vacuum.py +++ b/homeassistant/components/neato/vacuum.py @@ -157,18 +157,20 @@ class NeatoConnectedVacuum(StateVacuumEntity): def update(self): """Update the states of Neato Vacuums.""" - _LOGGER.debug("Running Neato Vacuums update") + _LOGGER.debug("Running Neato Vacuums update for '%s'", self.entity_id) try: if self._robot_stats is None: self._robot_stats = self.robot.get_general_info().json().get("data") except NeatoRobotException: - _LOGGER.warning("Couldn't fetch robot information of %s", self._name) + _LOGGER.warning("Couldn't fetch robot information of %s", self.entity_id) try: self._state = self.robot.state except NeatoRobotException as ex: if self._available: # print only once when available - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) self._state = None self._available = False return @@ -241,25 +243,31 @@ class NeatoConnectedVacuum(StateVacuumEntity): and self._robot_maps[self._robot_serial] ): allmaps = self._robot_maps[self._robot_serial] - _LOGGER.debug("Found the following maps for '%s': %s", self._name, allmaps) + _LOGGER.debug( + "Found the following maps for '%s': %s", self.entity_id, allmaps + ) self._robot_boundaries = [] # Reset boundaries before refreshing boundaries for maps in allmaps: try: robot_boundaries = self.robot.get_map_boundaries(maps["id"]).json() except NeatoRobotException as ex: - _LOGGER.error("Could not fetch map boundaries: %s", ex) + _LOGGER.error( + "Could not fetch map boundaries for '%s': %s", + self.entity_id, + ex, + ) return _LOGGER.debug( "Boundaries for robot '%s' in map '%s': %s", - self._name, + self.entity_id, maps["name"], robot_boundaries, ) self._robot_boundaries += robot_boundaries["data"]["boundaries"] _LOGGER.debug( "List of boundaries for '%s': %s", - self._name, + self.entity_id, self._robot_boundaries, ) @@ -346,14 +354,18 @@ class NeatoConnectedVacuum(StateVacuumEntity): elif self._state["state"] == 3: self.robot.resume_cleaning() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def pause(self): """Pause the vacuum.""" try: self.robot.pause_cleaning() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def return_to_base(self, **kwargs): """Set the vacuum cleaner to return to the dock.""" @@ -363,28 +375,36 @@ class NeatoConnectedVacuum(StateVacuumEntity): self._clean_state = STATE_RETURNING self.robot.send_to_base() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def stop(self, **kwargs): """Stop the vacuum cleaner.""" try: self.robot.stop_cleaning() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def locate(self, **kwargs): """Locate the robot by making it emit a sound.""" try: self.robot.locate() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def clean_spot(self, **kwargs): """Run a spot cleaning starting from the base.""" try: self.robot.start_spot_cleaning() except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + ) def neato_custom_cleaning(self, mode, navigation, category, zone=None, **kwargs): """Zone cleaning service call.""" @@ -395,7 +415,7 @@ class NeatoConnectedVacuum(StateVacuumEntity): boundary_id = boundary["id"] if boundary_id is None: _LOGGER.error( - "Zone '%s' was not found for the robot '%s'", zone, self._name + "Zone '%s' was not found for the robot '%s'", zone, self.entity_id ) return @@ -403,4 +423,6 @@ class NeatoConnectedVacuum(StateVacuumEntity): try: self.robot.start_cleaning(mode, navigation, category, boundary_id) except NeatoRobotException as ex: - _LOGGER.error("Neato vacuum connection error: %s", ex) + _LOGGER.error( + "Neato vacuum connection error for '%s': %s", self.entity_id, ex + )