Add request retries and nominal capacity override number entity

Retries (bluetooth_handler):
- request() now retries up to 3× with 0.5s pause between attempts
- Tries Write With Response first, falls back to Write Without Response
  automatically if the characteristic rejects it — handles both BMS variants

Number entity (number.py):
- "Nominal Capacity (Override)" lets user correct a stale BMS capacity value
  (e.g. after a cell upgrade) without PC software
- Value is restored across HA restarts via RestoreEntity
- Immediately patches coordinator.data so the sensor reflects it without
  waiting for the next poll

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-11 19:57:22 +02:00
parent 5d527168e2
commit 03b63c476a
3 changed files with 158 additions and 16 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ from homeassistant.core import HomeAssistant
from .const import CONF_ADDRESS, CONF_POLL_INTERVAL, DEFAULT_POLL_INTERVAL, DOMAIN
from .coordinator import BmsCoordinator
PLATFORMS = ["sensor", "binary_sensor"]
PLATFORMS = ["sensor", "binary_sensor", "number"]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: