Xiaoxiang bms

So far, no issue and the keep alive work fine so I haven’t lost any connection yet to my 2 sets of battery!

I’ll add more this coming weekend to the batmon, I have a total of 13 BMS.

1 Like

hi guys, just an update on the addon, I migrated to .39 and so far, the only issue I have is I can’t monitor more then 5 BMS/Battery, as soon as I had a 6 one, the addon start having error and close down. All my BMS are the same model so I’m suspecting either a Bluetooth issue on the Rasp4 or the HA itself.

Any one has the same issue?

Thanks.

I am connecting to 4 bms’s and after a couple days my rasp 4 will stop working with Bluetooth. I am fairly certain it’s HA issue. I’ve now also tried 3 different external Bluetooth adapters and all have same issue. I’d say be patient and hope the next HA update will have a fix.

Hey Jason, I just tried to raise the BMS sample_period config from 1 to 10 seconds and I did managed to get more reading up to 7 BMS with my Rasp4 builtin Bluetooth. I’m rebooting my HA to see if I can get more then 7. I do agree there seem to be a glitch with the HA code for the bluetooth integration.

10 BMS at the same time with sample_period set to 15 seconds is the max I could do. After it’s failing.

@flap Just setup your add-on. Worked like a charm on my Xiaoxiang BMS bluetooth dongle! Thank you so much! This is awesome!

1 Like

Should this add-on run on an x86 NUC with a USB Bluetooth adapter?

Trying to connect to a Victron SmartShunt.

I keep seeing this line on the logs:
bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist

Are you running HA OS or Supervisor install?

HAOS 9.0 on a Bevy NUC (https://www.amazon.com/Lineage-Labs-Smart-Photo-System/dp/B017JCG14U) installed on the internal 120G SSD I put in it at the moment.

I get this executing ha os info on the terminal:

board: generic-x86-64
data disk: /dev/sda8
update_available: false
version: "9.0"
version latest: "9.0"

ha host info gives:

agent_version: 1.3.0
apparmor_version: 3.0.3
boot_timestamp: 1664581448500411
broadcast_llmnr: true
broadcast_mdns: true
chassis: embedded
cpe: cpe:2.3:o:home-assistant:haos:9.0:*:production:*:*:*:generic-x86-64:*
deployment: production
disk_free: 90.2
disk_life_time: null
disk_total: 109.3
disk_used: 14.6
dt_synchronized: true
dt_utc: "2022-10-08T15:27:24.532611+00:00"
features:
- reboot
- shutdown
- services
- network
- hostname
- timedate
- os_agent
- haos
- resolved
hostname: homeassistant
kernel: 5.15.67
llmnr_hostname: homeassistant
operating_system: Home Assistant OS 9.0
startup_time: 1.089825
timezone: Etc/UTC
use_ntp: true

I restarted the host, just in case, and now the Bluetooth discovery step is working.

I do get another issue though:

bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local
INFO     [victron.py:63] Connecting DA:88:D3:60:A0:50 to pair
ERROR    [main.py:205] 1 exceptions occurred fetching BMSs
ERROR    [main.py:83] Error (num 2) reading BMS: [org.bluez.Error.Failed] le-connection-abort-by-local
ERROR    [main.py:84] Stack: Traceback (most recent call last):
  File "/app/main.py", line 79, in fetch_loop
    await fn()
  File "/app/main.py", line 206, in fn
    raise exceptions[0]
  File "/app/main.py", line 201, in fn
    await t
  File "/app/main.py", line 118, in _fetch_victron
    result = await victron.fetch_device(dev['address'], psk=dev.get('pin'))
  File "/app/victron.py", line 64, in fetch_device
    async with BleakClient(address, handle_pairing=bool(psk)) as client:
  File "/usr/lib/python3.10/site-packages/bleak/backends/client.py", line 97, in __aenter__
    await self.connect()
  File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 359, in connect
    assert_reply(reply)
  File "/usr/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] le-connection-abort-by-local

What’s your sample period? I have mine at 5 and it works well enough. You may be behind on updates as well. I think 10 is current. I finally got mine working right since discovering dbus-broker had to be setup for Bluetooth to work properly on my Ubuntu install. HA OS should just work. Also doing mine via a hop with an esp32 since it’s too far to get connected on its own.

Thanks,

So far the “Check for updates” on the frontend gives no indication of an update.

Trying to update the core via ssh gives:

➜  ~ ha core update
Processing... Done.

Error: Version 2022.10.1 is already installed

Trying to update the OS via ssh gives:

➜  ~ ha os update
Processing... Done.

Error: Version 9.0 is already installed

I do have sample period on 10. I’ll try 5 and see :wink:

I also am trying to run the StandAlone version but no luck. BMS is not in BT range, so I am trying to post to MQTT.
EeePC with Debian 10 x86 version, Pyhton 3.9 and USB BT4.0 adapter.

When I run the command (root or no),
& python3.9 main.py bunch of errors are displayed

@eeepc:/home/pi/batmon-ha# python3.9 main.py
error reading /data/options.json, trying options.json [Errno 2] No such file or directory: ‘/data/options.json’
Traceback (most recent call last):
File “/home/pi/batmon-ha/main.py”, line 25, in load_user_config
with open(’/data/options.json’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘/data/options.json’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/batmon-ha/main.py", line 61, in <module>
    user_config = load_user_config()
  File "/home/pi/batmon-ha/main.py", line 31, in load_user_config
    conf = dotdict(json.load(f))
  File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 9 column 3 (char 115)

Tried to fix the /data/options.json patch but no result.

I found the stand alone to work for less time than the direct Bluetooth. I just tossed an ESP32 in the greenhouse with the BMS and added the BT proxy config and that got me connected to the BMS. Now I can go for a week or more instead of just days. Once in a while have to unplug the BT adapter on the BMS and plug it back in. Quick reset brings it back online with ease.

Could you be more specific?

I have a battery with JBD BMS on one location and a home assistant running on other location.

Both location have internet with static IPs.
I wanted to install a eeePC running in stand alone mode, but the eeePC won’t run it for some reason.

Any way to use ESP32 wroom (the BT model) or something similar?

Are they not on the same network? I have my BMS in my greenhouse which is out of range for bluetooth but with ESP32 BT proxy and I can bounce the bluetooth signal over wifi so it works great.

@flap nice update 0.0.46 running good. Thank you

@flap thanks for keeping it up to date! Been working mostly good. Occasionally have to Start Batmon again because Watchdog doesn’t restart as it says but I’d rather have stats most of the time than none of the time.

Which BMS is build-in? My LiFePO4 24V 100Ah from Basen has a badly documented VIP-BMS. Luckily, I’ve met a great guy online and he transfered my logfiles into a working integration. GitHub - syssi/esphome-basen-bms: ESPHome component to monitor a Basen Battery Management System via BLE

No built in. This tool is to help monitor JK, JBD, Daly and anything rebranded like Overkill Solar.