fl4p / batmon-ha

Add-on for Home Assistant to connect JK, JBD, Daly, ANT, SOK and Supervolt BMS via Bluetooth
MIT License
313 stars 60 forks source link

OverflowError: (34, 'Numerical result out of range') #259

Open ThomasCr opened 1 month ago

ThomasCr commented 1 month ago

I just want to report this Numerical result out of range error. It is gone after a restart of batmon - but maybe its is something we hand handle in the code to catch or get a better output.

Paste log output between BEGIN and END:
BEGIN 
Okt 01 14:39:38 rpitemp python3[1005]: 14:39:38 INFO [bt] BT 54:3A:D6:41:10:C1          54-3A-D6-41-10-C1
Okt 01 14:39:38 rpitemp python3[1005]: 14:39:38 ERROR [main] 1 exceptions occurred fetching BMSs
Okt 01 14:39:38 rpitemp python3[1005]: 14:39:38 ERROR [main] Error (num 10228, max 0) reading BMS: (34, 'Numerical result out of range')
Okt 01 14:39:38 rpitemp python3[1005]: 14:39:38 ERROR [main] Stack: Traceback (most recent call last):
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/sampling.py", line 155, in __call__
Okt 01 14:39:38 rpitemp python3[1005]:     s = await self._sample_inner()
Okt 01 14:39:38 rpitemp python3[1005]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/sampling.py", line 227, in _sample_inner
Okt 01 14:39:38 rpitemp python3[1005]:     async with bms:
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/bt.py", line 345, in __aenter__
Okt 01 14:39:38 rpitemp python3[1005]:     await self.connect()
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/models/jbd.py", line 53, in connect
Okt 01 14:39:38 rpitemp python3[1005]:     await super().connect(**kwargs)
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/bt.py", line 237, in connect
Okt 01 14:39:38 rpitemp python3[1005]:     await self._connect_client(timeout=timeout)
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/bt.py", line 186, in _connect_client
Okt 01 14:39:38 rpitemp python3[1005]:     await asyncio.wait_for(self.client.connect(timeout=timeout), timeout=timeout + 1)
Okt 01 14:39:38 rpitemp python3[1005]:   File "/usr/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
Okt 01 14:39:38 rpitemp python3[1005]:     return fut.result()
Okt 01 14:39:38 rpitemp python3[1005]:            ^^^^^^^^^^^^
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 297, in connect
Okt 01 14:39:38 rpitemp python3[1005]:     raise BleakError(
Okt 01 14:39:38 rpitemp python3[1005]: bleak.exc.BleakError: Device with address 10:A5:62:23:B8:B5 could not be found. Try increasing `timeout` value or moving the device closer.
Okt 01 14:39:38 rpitemp python3[1005]: During handling of the above exception, another exception occurred:
Okt 01 14:39:38 rpitemp python3[1005]: Traceback (most recent call last):
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/main.py", line 36, in fetch_loop
Okt 01 14:39:38 rpitemp python3[1005]:     if await fn():
Okt 01 14:39:38 rpitemp python3[1005]:        ^^^^^^^^^^
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/main.py", line 319, in fn
Okt 01 14:39:38 rpitemp python3[1005]:     raise exceptions[0]
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/main.py", line 314, in fn
Okt 01 14:39:38 rpitemp python3[1005]:     await t()
Okt 01 14:39:38 rpitemp python3[1005]:   File "/opt/batmon-ha/bmslib/sampling.py", line 160, in __call__
Okt 01 14:39:38 rpitemp python3[1005]:     t_wait = min(1.5 ** self._num_errors, 120)
Okt 01 14:39:38 rpitemp python3[1005]:                  ~~~~^^~~~~~~~~~~~~~~~~~
Okt 01 14:39:38 rpitemp python3[1005]: OverflowError: (34, 'Numerical result out of range')
Okt 01 14:39:39 rpitemp python3[1005]: 14:39:39 INFO [sampling] connecting bms JbdBt(10:A5:62:23:B8:B5,BMS1)
Okt 01 14:39:39 rpitemp python3[1005]: 14:39:39 ERROR [bt] Device with address 10:A5:62:23:B8:B5 could not be found. Try increasing `timeout` value or moving the device closer., starting scanner
END