Browse Source

fix (device_config): allow range in mapping to override

Previous code would override default range with one in a conditional mapping,
but not in a simple mapping. I guess there was not much point in that
before now, but with a value_redirect it does make sense to be able
to change the range of a dp in a simple mapping.

Issue #3779
Jason Rumney 5 months ago
parent
commit
aad8bef806
1 changed files with 1 additions and 0 deletions
  1. 1 0
      custom_components/tuya_local/helpers/device_config.py

+ 1 - 0
custom_components/tuya_local/helpers/device_config.py

@@ -626,6 +626,7 @@ class TuyaDpsConfig:
         mapping = self._find_map_for_dps(device.get_property(self.id), device)
         r = self._config.get("range")
         if mapping:
+            r = mapping.get("range", r)
             cond = self._active_condition(mapping, device)
             if cond:
                 r = cond.get("range", r)