Switch to connect→poll→disconnect per cycle (single-connection BMS fix)
The BMS only allows one simultaneous BLE connection. Keeping a persistent connection blocked the mobile app from connecting at all. Changes: - BmsBluetoothHandler: replace connect()/disconnect()/request() public API with a single poll() method that owns the full connect→read→disconnect lifecycle. Connection is held only for the duration of one data fetch. - Coordinator: gutted connection-state management — _async_update_data now just calls handler.poll() and processes results. No reconnect loop needed. - Poll interval defaults: 15s default, 10s min, 300s max. The BLE connect overhead (~2s) makes sub-10s intervals impractical. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,9 @@ DOMAIN = "xiaoxiang_bms"
|
||||
CONF_ADDRESS = "address"
|
||||
CONF_POLL_INTERVAL = "poll_interval"
|
||||
|
||||
DEFAULT_POLL_INTERVAL = 5 # seconds — fast for solar/energy monitoring
|
||||
MIN_POLL_INTERVAL = 2
|
||||
MAX_POLL_INTERVAL = 60
|
||||
DEFAULT_POLL_INTERVAL = 15 # seconds — each poll does a full BLE connect/disconnect
|
||||
MIN_POLL_INTERVAL = 10 # below this the BMS has no breathing room between polls
|
||||
MAX_POLL_INTERVAL = 300
|
||||
|
||||
# GATT UUIDs (Xiaoxiang BMS UART-over-GATT)
|
||||
UART_SERVICE_UUID = "0000ff00-0000-1000-8000-00805f9b34fb"
|
||||
|
||||
Reference in New Issue
Block a user