Skip to content

Commit

Permalink
Device config: reduce log verbosity
Browse files Browse the repository at this point in the history
Even in debug logs we do not need to know that mappings are being "considered",
only what the final result of the mapping is.

Maybe in the early days this was relevant, to debug the mapping logic,
but now it is just noise in the debug log that hides real information.

Inspired by issue #2722
  • Loading branch information
make-all committed Jan 6, 2025
1 parent f9e649f commit 4ea3d30
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions custom_components/tuya_local/helpers/device_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@ def range(self, device, scaled=True):
mapping = self._find_map_for_dps(device.get_property(self.id), device)
r = self._config.get("range")
if mapping:
_LOGGER.debug("Considering mapping for range of %s", self.name)
cond = self._active_condition(mapping, device)
if cond:
r = cond.get("range", r)
Expand Down Expand Up @@ -628,13 +627,11 @@ def step(self, device, scaled=True):
scale = self.scale(device) if scaled else 1
mapping = self._find_map_for_dps(device.get_property(self.id), device)
if mapping:
_LOGGER.debug("Considering mapping for step of %s", self.name)
step = mapping.get("step", 1)

cond = self._active_condition(mapping, device)
if cond:
constraint = mapping.get("constraint", self.name)

Check failure on line 634 in custom_components/tuya_local/helpers/device_config.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F841)

custom_components/tuya_local/helpers/device_config.py:634:17: F841 Local variable `constraint` is assigned to but never used
_LOGGER.debug("Considering condition on %s", constraint)
step = cond.get("step", step)
if step != 1 or scale != 1:
_LOGGER.debug(
Expand Down

0 comments on commit 4ea3d30

Please sign in to comment.