From 7fba155b5c2abdbc7b781814b1eacd83835fe604 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Tue, 23 Jun 2026 11:38:02 +0200 Subject: [PATCH] Derive override_current max from device current_max MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The override current number was hardcoded to native_max_value=16, so a SmartEVSE configured for a higher charge current (e.g. 32 A) could not be driven above 16 A from Home Assistant — no device setting, reload, restart or re-pair could lift it. Make native_max_value for smartevse_override_current follow the device's reported settings.current_max (already polled every cycle), falling back to the static description value when unavailable. --- custom_components/smartevse/manifest.json | 2 +- custom_components/smartevse/number.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) 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."""