I have the same problem as
@lexxmm
My ANT-BMS is the same as his, its the 20S model (I'm using it as 16S, its configurable).
Also my MAC address is the same as his: AA:BB:CC:B1:23:45
I have configured the getbms-ant.py to look for my MAC (this is forgotten to say in the Youtube video)
The Mac address in the file isn't actually used; If you look a few lines down, you will see that sock.connect is actually commented out.
Problem is that when I "sudo python getbms-ant.py" I've got error:
This is due to Python needing indents in the code. If you cut and pasted it into your Pi, it probably did not properly keep the indents (tabs) and that is what is triggering the error. The easiest way to fix this is to download the entire file, then delete all of the other stuff out of it, and then copy that file over to the Pi. The indents were in his file.
So, I'm thinking that there may be one of two problems:
1. The getbms-ant.py is not suitable for our BMS-20S model?
There is nothing in the code that is model specific as far as I can tell, but I have the 16s version as well, so I can't be sure that the 20S version responds to the 140 bytes of data is any different. However, even if that was the case, you should still be able to pair with it but the data you get is just junk.
2. The bluetooth connection is not correct?
About the 2. - I already bind the connection to the driver with rfcomm code, and if I go to bluetoothctl and run "info" for my MAC, I got "Paired: yes", but "Connected: no"?
In the Youtube video Part 1, I see that after runnig the "pair" he got "paired" but after that in the scan code he got also "connected: no" for his MAC, althrough he proceeded with success?
Will be thankful for any help, also if the .py is not for our BMS, is there any options to scan our BMS-20S output and rewrite the code?
This is the normal output:
[bluetooth]# list
Controller B8:27:EB:06:52:B9 antpi [default]
[bluetooth]# info AA:BB:DD:06:55:00
Device AA:BB:DD:06:55:00 (public)
Name: BMS-ANT16A-500
Alias: BMS-ANT16A-500
Class: 0x00001f00
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Serial Port (00001101-0000-1000-8000-00805f9b34fb)
[CHG] Device AA:BB:DD:06:55:00 Connected: yes
[CHG] Device AA:BB:DD:06:55:00 Connected: no
It is only connected when your Pi and talked to the device, otherwise it will say no. Above, you see that it is not connected, then my script runs, and it connects for a few seconds, then disconnects.
If you fix your indents, I think it will work fine with your 20S.