diff --git a/custom_components/smartevse/manifest.json b/custom_components/smartevse/manifest.json index 1a51d77..c9e5646 100644 --- a/custom_components/smartevse/manifest.json +++ b/custom_components/smartevse/manifest.json @@ -6,6 +6,6 @@ "documentation": "https://github.com/dingo35/ha-SmartEVSEv3", "iot_class": "local_polling", "issue_tracker": "https://github.com/dingo35/ha-SmartEVSEv3/issues", - "version": "1.1.4", + "version": "1.1.5", "zeroconf": ["_http._tcp.local."] } diff --git a/custom_components/smartevse/number.py b/custom_components/smartevse/number.py index d5e05d6..214eea2 100644 --- a/custom_components/smartevse/number.py +++ b/custom_components/smartevse/number.py @@ -52,6 +52,26 @@ def __init__( if entity_description.native_step is not None: self._attr_native_step = entity_description.native_step + @property + def native_max_value(self) -> float: + """Return the maximum settable value. + + For the override current, follow the SmartEVSE's own reported maximum + (settings.current_max) rather than a fixed cap, so a controller configured + for e.g. 32 A can actually be driven to 32 A. Falls back to the static + description value when the device max is unavailable. + """ + if self.entity_description.key == "smartevse_override_current": + data = self.coordinator.data + if data: + device_max = data.get("smartevse_current_max") + if device_max is not None: + try: + return float(device_max) + except (TypeError, ValueError): + pass + return self._attr_native_max_value + @property def native_value(self) -> float | None: """Return the entity value to represent the entity state."""