Add a server option for the Bluetooth read interval

The server read each Bluetooth device every 60 seconds, and each read is one scan and one connection. An adapter that fails after many connections had no way to get fewer of them.

--bluetooth-interval sets the wait after a good Bluetooth read, and the default stays at 60 seconds. Clients receive the last read during the wait. A failed read still tries again after 60 seconds, or after the interval for a shorter one.
This commit is contained in:
tim
2026-10-10 18:03:09 +02:00
parent e32d3a8e22
commit 99bb321e3b
3 changed files with 96 additions and 18 deletions
+10 -5
View File
@@ -95,11 +95,16 @@ device named `all`, not all devices. To include a serial BMS, add a server argum
such as `-d network:/dev/ttyUSB0`.
The server reads each device in its own background thread, so a slow or offline
device does not delay the other devices or the clients. It reads one Bluetooth
device at a time and waits 60 seconds after each Bluetooth read, including a
failed one. It reads a serial BMS every 5 seconds and retries a failed serial
read after 1 second. Unavailable devices are omitted from the response. Only the
first request after startup waits, until each device completes one read attempt.
device does not delay the other devices or the clients. It reads a serial BMS
every 5 seconds and retries a failed serial read after 1 second. Unavailable
devices are omitted from the response. Only the first request after startup
waits, until each device completes one read attempt.
The server reads one Bluetooth device at a time and waits 60 seconds after each
good Bluetooth read. To change that wait, add `--bluetooth-interval SECONDS` to
the server command. During the wait, clients receive the last read. After a
failed Bluetooth read, the server tries again after 60 seconds. An interval
below 60 seconds also applies after a failed read.
The server answers each client in its own thread, so a slow client does not
delay the other clients. It closes a connection that stays silent for 5 seconds.