Open nightcat91 opened 7 months ago
I get similar errors.
ERROR:
bleak.exc.BleakError: Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not found!
[..]
status_discharging=(self.workingState & 0x0002 > 0),
~~~~~~~~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
HA Core: 2024.5.3 HA Supervisor: 2024.05.1 HA OS: 12.3 Bluetooth: Home Assistant Yellow / Raspberry Pi Compute Module 4 Battery: Supervolt SX-100 (2024 version) Batmon Version: 1.78 Batmon Configuration:
- address: XX:XX:XX:XX:XX:XX
type: supervolt
alias: battery_sx100
verbose: true
Without knowing any better I suspect that Batmons supervolt type needs to be updated for the 2024 version of the batteries. The new batteries have a blue top and the old batteries have a black top. The new 2024 version might have changes in the BMS / BLE communication.
Some more information just to show that the battery is visible via BLE and is generally accessible:
The BMS is accessible via the Supervolt companion app. When searching for the battery with the ESPHome Bluetooth Low Energy Tracker the battery shows up:
address: XX:XX:XX:XX:XX:XX name: SX100-B230019 advertised service UUID: 0xFF00 advertised service data: \<empty> advertised manufacturer data: 0x007B
According to Bluetooth-Company-Identifiers.csv 0x007B stands for Hanlynn Technologies. I could confirm this with the android app BLE Radar.
@OP (nightcat91):
How to get the complete batmon add-on log
ha host logs identifiers | grep batmon
- addon_xxxxxxxx_batmon
ha host logs --identifier addon_xxxxxxxx_batmon -n 1000
xxxxxxxx
obviously should be the value returned by the previous command--follow
option described at ha host logs --help
Start of log:
Paste log output between BEGIN and END:
BEGIN
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
16:41:36 INFO [bt] BT Discovery:
16:41:41 INFO [bt] BT XX:XX:XX:XX:XX:XX SX100-B230019
16:41:41 INFO [main] Bleak version 0.13.1a1, BtBackend version bluez-v5.70
16:41:41 INFO [main] connecting mqtt batmon2ha@core-mosquitto
/app/main.py:196: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
mqtt_client = paho.Client(paho.CallbackAPIVersion.VERSION1) 16:41:41 INFO [main] Fetching 1 BMS + 0 virtual + 0 others serially, period=1.00s, keep_alive=True 16:41:41 INFO [sampling] connecting bms SuperVoltBt(XX:XX:XX:XX:XX:XX,battery_sx100) 16:41:41 INFO [main] mqtt watchdog loop started with timeout 300.0s 16:41:43 ERROR [sampling] SuperVoltBt(XX:XX:XX:XX:XX:XX,battery_sx100) device not found, retry in 1 seconds 16:41:43 ERROR [supervolt] (<class 'bleak.exc.BleakError'>, BleakError('Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not fTraceback (most recent call last):
File "/app/bmslib/models/supervolt.py", line 113, in requestData
await self.requestRealtimeData()
File "/app/bmslib/models/supervolt.py", line 95, in requestRealtimeData
ret = await self.client.write_gatt_char(char_specifier=handle, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 904, in write_gatt_char
raise BleakError("Characteristic {0} was not found!".format(char_specifier))
bleak.exc.BleakError: Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not found!
16:41:43 ERROR [sampling] battery_sx100 error (#2): unsupported operand type(s) for &: 'NoneType' and 'int'
Traceback (most recent call last):
File "/app/bmslib/sampling.py", line 155, in __call__
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 237, in _sample_inner
sample = await bms.fetch()
^^^^^^^^^^^^^^^^^
File "/app/bmslib/models/supervolt.py", line 397, in fetch
status_discharging=(self.workingState & 0x0002 > 0),
~~~~~~~~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
16:41:43 INFO [sampling] Bleak version 0.13.1a1
16:41:43 ERROR [main] 1 exceptions occurred fetching BMSs
16:41:43 ERROR [main] Error (num 1, max 200) reading BMS: unsupported operand type(s) for &: 'NoneType' and 'int'
16:41:43 ERROR [main] Stack: Traceback (most recent call last):
File "/app/main.py", line 36, in fetch_loop
if await fn():
^^^^^^^^^^
File "/app/main.py", line 319, in fn
raise exceptions[0]
File "/app/main.py", line 314, in fn
await t()
File "/app/bmslib/sampling.py", line 155, in __call__
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 237, in _sample_inner
sample = await bms.fetch()
^^^^^^^^^^^^^^^^^
File "/app/bmslib/models/supervolt.py", line 397, in fetch
status_discharging=(self.workingState & 0x0002 > 0),
~~~~~~~~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
The error repeats itself every second ( probably because of period=1.00s
). That's why I shortened the log in this part considerably.
End of log:
16:45:05 ERROR [supervolt] (<class 'bleak.exc.BleakError'>, BleakError('Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not fTraceback (most recent call last):
File "/app/bmslib/models/supervolt.py", line 113, in requestData
await self.requestRealtimeData()
File "/app/bmslib/models/supervolt.py", line 95, in requestRealtimeData
ret = await self.client.write_gatt_char(char_specifier=handle, data=data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/venv/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 904, in write_gatt_char
raise BleakError("Characteristic {0} was not found!".format(char_specifier))
bleak.exc.BleakError: Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not found!
16:45:05 ERROR [sampling] battery_sx100 error (#202): unsupported operand type(s) for &: 'NoneType' and 'int'
Traceback (most recent call last):
File "/app/bmslib/sampling.py", line 155, in __call__
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 237, in _sample_inner
sample = await bms.fetch()
^^^^^^^^^^^^^^^^^
File "/app/bmslib/models/supervolt.py", line 397, in fetch
status_discharging=(self.workingState & 0x0002 > 0),
~~~~~~~~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
16:45:05 INFO [sampling] Bleak version 0.13.1a1
16:45:05 WARNING [sampling] battery_sx100 disconnect because no data has been flowing for some time
16:45:05 ERROR [main] 1 exceptions occurred fetching BMSs
16:45:05 ERROR [main] Error (num 201, max 200) reading BMS: Characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e not found!
16:45:05 ERROR [main] Stack: Traceback (most recent call last):
File "/app/bmslib/sampling.py", line 155, in __call__
s = await self._sample_inner()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/bmslib/sampling.py", line 237, in _sample_inner
sample = await bms.fetch()
^^^^^^^^^^^^^^^^^
File "/app/bmslib/models/supervolt.py", line 397, in fetch
status_discharging=(self.workingState & 0x0002 > 0),
~~~~~~~~~~~~~~~~~~^~~~~~~~
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/main.py", line 36, in fetch_loop
if await fn():
^^^^^^^^^^
File "/app/main.py", line 319, in fn
raise exceptions[0]
File "/app/main.py", line 314, in fn
await t()
File "/app/bmslib/sampling.py", line 187, in __call__
await bms.disconnect()
File "/app/bmslib/models/supervolt.py", line 84, in disconnect
await self.client.stop_notify(self.UUID_RX)
File "/app/venv/lib/python3.11/site-packages/bleak/backends/bluezdbus/client.py", line 1099, in stop_notify
raise BleakError("Characteristic {} not found!".format(char_specifier))
bleak.exc.BleakError: Characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e not found!
16:45:05 WARNING [main] too many errors, abort
16:45:05 INFO [main] fetch_loop <function main.<locals>.fn at 0x7faf4d6020> ends
16:45:05 INFO [main] All fetch loops ended. shutdown is already False
16:45:05 INFO [main] Disconnecting SuperVoltBt(XX:XX:XX:XX:XX:XX,battery_sx100)
16:45:05 INFO [main] exit signal handler... (), {}, shutdown was True
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
END
Hi, apparently they changed the BLE characteristic UID. Someone needs with this BMS needs to run service_explorer.py
I got these documents from Supervolt in March 2024 via an email contact. Maybe they are useful?
At least in the bt-protocol PDF there are some UUIDs on the last page and a lot more info about the full BT protocol in general.
bt_protocol.pdf https://support.supervolt.de/attachments/token/VsJUkKGbW5zPzOdH5dM5MZbqt/?name=%5BB%5D+bt+protocol.pdf
rs485_protocol.docx https://support.supervolt.de/attachments/token/rCajBS0UYSQo4cwcP0ugLNWxF/?name=%5BB%5D+rs485+protocol.docx
Executing service_explorer.py confirmed that the UUIDs near the end of the PDF [B] bt protocol.pdf are correct.
$ python3 service_explorer.py
INFO:__main__:Connecting XX:XX:XX:XX:XX:XX
INFO:__main__:Connected: True
INFO:__main__:[Service] 00002600-0000-1000-8000-00805f9b34fb (Handle: 23): Vendor specific
INFO:__main__: [Characteristic] 00007000-0000-1000-8000-00805f9b34fb (Handle: 24): Vendor specific (write,indicate), Value: None
INFO:__main__: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 26): Client Characteristic Configuration) | Value: b'\x00\x00'
INFO:__main__: [Characteristic] 00007001-0000-1000-8000-00805f9b34fb (Handle: 27): Vendor specific (read,write-without-response), Value: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
INFO:__main__:[Service] 0000ff00-0000-1000-8000-00805f9b34fb (Handle: 14): Vendor specific
INFO:__main__: [Characteristic] 0000ff01-0000-1000-8000-00805f9b34fb (Handle: 17): Vendor specific (notify), Value: None
INFO:__main__: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 19): Client Characteristic Configuration) | Value: b'\x01\x00'
INFO:__main__: [Characteristic] 0000ff02-0000-1000-8000-00805f9b34fb (Handle: 15): Vendor specific (write-without-response), Value: None
INFO:__main__:[Service] 0000180a-0000-1000-8000-00805f9b34fb (Handle: 20): Device Information
INFO:__main__: [Characteristic] 00002a23-0000-1000-8000-00805f9b34fb (Handle: 21): System ID (read), Value: b'\xc7AP,\x0e\xe3'
INFO:__main__:[Service] 00001801-0000-1000-8000-00805f9b34fb (Handle: 6): Generic Attribute Profile
INFO:__main__: [Characteristic] 00002b2a-0000-1000-8000-00805f9b34fb (Handle: 12): Database Hash (read), Value: b'\xd2\xa3w\x8d\xd7\n\xf5T\x91\xd9d\xc88i\xd1\x8b'
INFO:__main__: [Characteristic] 00002a05-0000-1000-8000-00805f9b34fb (Handle: 7): Service Changed (indicate), Value: None
INFO:__main__: [Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 9): Client Characteristic Configuration) | Value: b'\x02\x00'
INFO:__main__: [Characteristic] 00002b29-0000-1000-8000-00805f9b34fb (Handle: 10): Client Supported Features (read,write), Value: b'\x01'
@fl4p Will it be possible to fix the Supervolt integration with the new UUIDs?
I would love to test it once available. Thanks
I guess supervolt.py would have to be modified to hopefully get the newer (v3) BMS versions connected... likely breaking connection to previous (v2?) BMS version(s).
supervolt.py in line 19 and 20 today:
UUID_RX = '6e400003-b5a3-f393-e0a9-e50e24dcca9e' # std uart TX (tx on device side, rx on host)
UUID_TX = '6e400002-b5a3-f393-e0a9-e50e24dcca9e' # std uart RX
bt_protocol.pdf states:
SERVICE UUID: 0000ff00-0000-1000-8000-00805f9b34fb write characteristic UUID: 0000ff02-0000-1000-8000-00805f9b34fb read characteristic UUID: 0000ff01-0000-1000-8000-00805f9b34fb
supervolt.py change request:
UUID_RX = '0000ff02-0000-1000-8000-00805f9b34fb' # std uart TX (tx on device side, rx on host)
UUID_TX = '0000ff01-0000-1000-8000-00805f9b34fb' # std uart RX
Is there somehow a way for us to do this change just locally with the already installed version?
I wouldnt mind changing the file and testing it, but I dont have the knowledge to make a pull request on github or clone the repository and be able to install another version in my HomeAssistant...
Otherwise I think only @fl4p can make that change and push a new version.
You can run the stand-alone setup for testing at least, outside of Home Assistant, see https://github.com/fl4p/batmon-ha/blob/master/doc/Standalone.md. I was able to set it up and edit supervolt.py on Ubuntu. I ran out of time when I came to installing a local mqtt instance. This will have to wait for a few more days unfortunately...
This is running as a HomeAssistant addon in my camper. I can´t run another standalone linux there sadly. Thats why I asked about beeing able to change that one file locally inside the installed HomeAssistant Addon?
It was meant for testing only. In theory, you should be able to fork this project and get your modified version installed through your own repository... but it will take time, as always in software development. Sorry that I can't help more, lacking experience on that particular problem.
Hi.
please do not change the old Supervolt code. Please add a new type Supervolt 2024 Edition in a seperate code.
Thanks
BR Andreas
Hello, I also have a Supervolt from 2024, which writes the error below in the log. Regarding the installation, I have the Batmon Version of @nightcat91. In this version line 19/20 of supervolt.py is already fixed.
It would be really great, if someone can let me know, how i can read out the Supervolt battery.
Thanks for your help, Joerg
address: CB:04:0E:7E:4D:88 type: supervolt alias: camper
14:24:47 INFO [sampling] connecting bms SuperVoltBt(CB:04:0E:7E:4D:88,camper) 14:24:48 INFO [sampling] connected bms SuperVoltBt(CB:04:0E:7E:4D:88,camper)! 14:25:08 ERROR [sampling] camper error (#7): '>' not supported between instances of 'NoneType' and 'int' Traceback (most recent call last): File "/app/bmslib/sampling.py", line 155, in call s = await self._sample_inner() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 237, in _sample_inner sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/supervolt.py", line 377, in fetch sample = BmsSample( ^^^^^^^^^^ File "/app/bmslib/bms.py", line 64, in init if capacity > 0 and (math.isnan(soc) or (isinstance(soc, int) and charge > 0)): ^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int' 14:25:08 INFO [sampling] Bleak version 0.13.1a1 14:25:08 ERROR [main] 1 exceptions occurred fetching BMSs 14:25:08 ERROR [main] Error (num 6, max 200) reading BMS: '>' not supported between instances of 'NoneType' and 'int' 14:25:08 ERROR [main] Stack: Traceback (most recent call last): File "/app/main.py", line 36, in fetch_loop if await fn(): ^^^^^^^^^^ File "/app/main.py", line 319, in fn raise exceptions[0] File "/app/main.py", line 314, in fn await t() File "/app/bmslib/sampling.py", line 155, in call s = await self._sample_inner() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 237, in _sample_inner sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/supervolt.py", line 377, in fetch sample = BmsSample( ^^^^^^^^^^ File "/app/bmslib/bms.py", line 64, in init if capacity > 0 and (math.isnan(soc) or (isinstance(soc, int) and charge > 0)): ^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int'
14:25:30 ERROR [sampling] camper error (#8): '>' not supported between instances of 'NoneType' and 'int' Traceback (most recent call last): File "/app/bmslib/sampling.py", line 155, in call s = await self._sample_inner() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 237, in _sample_inner sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/supervolt.py", line 377, in fetch sample = BmsSample( ^^^^^^^^^^ File "/app/bmslib/bms.py", line 64, in init if capacity > 0 and (math.isnan(soc) or (isinstance(soc, int) and charge > 0)): ^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int' 14:25:30 INFO [sampling] Bleak version 0.13.1a1 14:25:30 WARNING [sampling] camper disconnect because no data has been flowing for some time 14:25:33 WARNING [bt] BMS SuperVoltBt(CB:04:0E:7E:4D:88,camper) disconnected after 44.9s! 14:25:33 ERROR [main] 1 exceptions occurred fetching BMSs 14:25:33 ERROR [main] Error (num 7, max 200) reading BMS: '>' not supported between instances of 'NoneType' and 'int' 14:25:33 ERROR [main] Stack: Traceback (most recent call last): File "/app/main.py", line 36, in fetch_loop if await fn(): ^^^^^^^^^^ File "/app/main.py", line 319, in fn raise exceptions[0] File "/app/main.py", line 314, in fn await t() File "/app/bmslib/sampling.py", line 155, in call s = await self._sample_inner() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/sampling.py", line 237, in _sample_inner sample = await bms.fetch() ^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/supervolt.py", line 377, in fetch sample = BmsSample( ^^^^^^^^^^ File "/app/bmslib/bms.py", line 64, in init if capacity > 0 and (math.isnan(soc) or (isinstance(soc, int) and charge > 0)): ^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'int'
14:25:35 INFO [sampling] connecting bms SuperVoltBt(CB:04:0E:7E:4D:88,camper) 14:25:36 INFO [sampling] connected bms SuperVoltBt(CB:04:0E:7E:4D:88,camper)!
2x Supervolt SX150P
Error: ERROR [supervolt] (<class 'bleak.exc.BleakError'>, BleakError('Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e was not found!') ERROR [main] Error reading BMS: unsupported operand type(s) for &: 'NoneType' and 'int'
I already tried "install_newer_bleak", "bt_power_cycle" and with ot without "keep_alive" Not quite sure how to get a complete log, down below are pieces of logs which I got from the addon logs tab with careful refreshing and copy...
Using a "DIGITUS DN-30210-1" external Bluetooth Adapter with a USB Extension, Bluetooth Integration in HomeAssistant is working, other integrations that use it also work!
If any more info is needed please let me know.