Victron Energy Smart Battery Sense Bluetooth integration

I am a bit lost, and I hope for some input, guidance, clarity…

As my UPS is not reporting very precise Battery Voltage Values, I got myself a Victron Smart Battery Sense (essentially a Bluetooth Voltmeter). This is a test-balloon to see if I can get it integrated into HA and then when the big Battery Pack comes, use a Victron Smart Shunt for measurement in the same fashion.
A Shelly Plus 1PM is acting as Bluetooth Proxy.

And here starts the quagmire:

There seems to be a myriad of repositories on Github
https://github.com/topics/victron
https://github.com/topics/victronenergy

talking about:
ModBus
Ve.Direct
mqtt
dbus
Victron GX
ESP32.
Some of them require configuration work that falls just short of programming.

Also I have a hard time imagining that there is no official integration for (something as popular as) Victron devices and everybody needs to do custom integration work, to get it running. In any case I could not find anything. (did I use the wrong search terms…???)

There are several Forum Threads here allready, but they also talk about the various Protocols and I havent found anything just straightforward integrating via bluetooth.

So concept-wise I am a bit lost on what I need, what Repository to use and how to get it working.
Has anyone done that before and is willing to share the learnings or basic principle how it works and what to look out for?
Any other suggestions to reliably get the measurement from the Bluetooth Voltmeter into HA?

Thank you!

3 Likes

This is something I want too. I was just starting to look into the Home Assistant Bluetooth LE integration to see if someone had managed to hook up Victron devices yet.

Seems not? So this will require more work and probably some code.

The Victron SmartShunt apparently sends out BLE advertisements of its current state. However, the Victron Connect app says something about the data being “encrypted” with the PIN so that’s an extra wrinkle to sort out.

This was my feeling as well, but it seems that the only (unofficial) option that exists is physically connecting to the device (which does make a bit of sense as most people are using them in an RV with their HA server located there as well).

I’d LOVE to be able to pull it on via BT as well though, as my primary residence is my house and I just don’t have enough stuff in my RV to justify adding a separate HA instance.

So I sat down today having finally decided to hardwire an ESP device to my Victron to get the data and very luckily stumbled upon this post:

https://www.reddit.com/r/homeassistant/comments/13ip2mt/victron_bluetooth_devices_to_home_assistant/

Getting the data passively via Bluetooth is now possible!

It takes a little extra effort to get the Advertising Key so HA can decrypt the data, but otherwise it’s quite seamless; once you add the custom integration and restart it was even auto-discovered! I spent a while trying to get said key off of my android phone but finally gave up and went the Linux route mentioned in the Reddit post.

If the Linux bit is just too much for you, I ran across some posts (I think they might have been official Victron ones?) that mentioned they are working to make the advertising key accessible from within the app. That would make this whole process a 5 minute job if they end up doing that. Fingers crossed.

2 Likes

The reddit post was deleted. Can I find that info anywhere else?

Here’s the GitHub:

I happened to notice on the issues someone said the Victron app now gives you the Advertisement Key. I don’t have my Victron device currently on, so I can’t test this out, but if so that would be AWESOME!

Yes, version 5.93 show the key under product info.

1 Like

Yes but not all devices I got my battery sense working but no key for smart battery charger. Victon are being no help as usual. It’s the last product I will buy from them it seems you don’t actually own the device if they hold back details from you.

The protocol for Victron Instant Readout is not implemented yet in Smart Battery Chargers so there is no key avalible.

Hi All,

So I lost all the food in my fridge on my boat as I was not monitoring the fridge temp or the battery voltage, either would have let me know there was a problem, a little bit of searching and I found this, as I actually have a victron shunt.

So as a semi NOOB, there does not seem to be any instructions to this, I have been able to piece together that the latest app gives you the code you need, but when adding the device it asks for an “address”???

And this is the other part I am having issues finding, I have seen hints that you can use a SHELLY to listen for the blue tooth, but how? If there is some sort of instructions, could someone PLEASE point me at them.

It should just be auto-discovered via Bluetooth. Do you have a Bluetooth adapter or BT Proxy setup?

And yes, if it’s one of the newer Shellys with BT, you can set them up as a BT Proxy as well.

Also, while you’re at it grab a couple BT temp sensors and toss them in your fridge and freezer; I’ve found that to be a worthwhile investment for sure.

Ummm ok.
Not sure about the Bluetooth, I am using a RPi4 so it should be there, but I have never seen a setup for it., so hopefully it auto setup?

If this victon integration is “auto setup” i suspect my problem is that the whole electrical system is pulled apart due to the charger loosing is smoke and and bit of panic. SO i am not sure if the shunt is even connected properly.

In regard to the Bluetooth temp sensors you mentioned, could you let me know which ones you are using, cos like you said they would come in very handy indeed.

I will put the electrical system back together this week, as i have had to move a lot of stuff around including battery positions and wiring. Once i have it back together i will see if the system can see it.

THanks for your reply!

** edit, yes I found the Bluetooth integrations and it looks to be setup. So I will make sure that the shunt is up and running and report back.

I have one of these outside; they go on sale frequently for like $10:
https://a.co/d/0jRWDYp

If you want cheaper and are willing to put in a little effort (and wait a few weeks for shipping), you can re-flash these with custom firmware; they’re what I put in my fridge and freezer and elsewhere:
https://www.aliexpress.us/item/3256801440661227.html

thanks!

yeah, they look useful. I am using a sensor/display unit from a 4wd store in Australia called “kings”, its defiantly a rebranded something as i see them in lots of places.
As i have quite a few SHELLYS in the boat my original idea was to just use and external TEMP sensor from one of those for the fridge and the outside temp. The inside temp and humidity are taken care of via a SHELLY H&T (I only just found the post on how to get that to work with HA) , but i will definatly have a look at these.

Next is a IR blaster to control the AIRCON so that it can be turned on etc.
I know there are commercial units available, but i might find a cheaper DIY version for this as its not going to be doing anything else, i know of…

Hi All,

Just reporting back regarding the Victron unit and it was working fine. I had some electrical setup issues that took a bit of sorting out, it turned out that some of the VE- line were not going through the shunt. So that messed up the AMP load readings for a while.
I had that all sorted out and it was working great for a while. I even had a dodgy charger that would lock up, a power cycle would fix it, so I used a smart plug and an automation for when the batter bank got below 12.5 and t would send me an email and power cycle the charger, it worked a treat.

But recently, i had to change the battery bank, create new cables and after than now the shunt is not showing any data. 2024.1.6V.
I am going to delete the integration and see if adding it again is going to fix it. Does anyone else have issues? i didnt miss a breaking change did I?

Hi All,

Ok, interesting problem. As i was saying above the Shunt was working, then stopped. I removed everything and re-added it.
and got some pretty strange stuff coming out
image

HA versions
image

Some logs,
This error originated from a custom integration.

Logger: custom_components.victron_ble
Source: components/bluetooth/passive_update_processor.py:586
Integration: Victron BLE (documentation, issues)
First occurred: 1 February 2024 at 18:43:43 (55208 occurrences)
Last logged: 10:04:06

Unexpected error updating Slightly Unst Shunt data: (<VictronSensor.MIDPOINT_VOLTAGE: ‘midpoint_voltage’>, <Units.ELECTRIC_POTENTIAL_VOLT: ‘V’>)
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/bluetooth/passive_update_processor.py”, line 586, in async_handle_update
new_data = self.update_method(update)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/victron_ble/sensor.py”, line 151, in sensor_update_to_bluetooth_data_update
entity_descriptions={
^
File “/config/custom_components/victron_ble/sensor.py”, line 154, in
): SENSOR_DESCRIPTIONS[
^^^^^^^^^^^^^^^^^^^^
KeyError: (<VictronSensor.MIDPOINT_VOLTAGE: ‘midpoint_voltage’>, <Units.ELECTRIC_POTENTIAL_VOLT: ‘V’>)

Anyone have the same issues?

-=-=-=-=-=-=-=-=-=-=-
more information 7/2/24
-=-=-=-=-=-=-=-=-=-=-
Hi All,

Ok, so I have been doing some work in the background on this as it’s a live system.

The background of this is that I run an HA instance on my boat and I had a charger fail that drained the batteries, so a VICTRON Shunt (due to the driver available for HA) was put in to monitor the batteries/ charge and a simple smart switch was put on the charger to be able to power cycle it. All this was a stopgap as it took me a while to buy new batteries. So before the new batteries the Victron Shunt was just monitoring the main battery bank, and that worked with only a small NooB mistake on getting the shunt working with HA.

Fast forward several weeks and I have just finished redoing everything in the battery compartment. To give you an idea of the amount of work I have done here, I have re-built all the battery storage area, replaced the main batteries, separated the diesel engine onto its own starting battery, added the Shunt, added several VE- bussbars and replaced every cable.

The problems started when I added the AUX wire of the Shunt to monitor the starter battery. THe first problem was that the VE- of starter battery was not connected to the shunt. I didn’t realise that.

So, as above, the main and starter are now connected and the Victron APP shows the values correctly, but the HA instance is showing the values as double before ??crashing ?? the device. A reboot of HA show the data, as a static set of values, the next refresh of the screen it changes to unavailable.

Looking at the logs, its getting really upset over the AUX line and being changed to second battery.

In terms of troubleshooting, here is what I have done, rebooted the shunt (dozens of times while testing) shut off the AUX in the settings, removed and re-installed the device in HA and added the VE- line between the batteries.
At one stage I even removed the AUX line and shut off the option for monitoring the starter battery in the shunt, rebooted the Shunt (removing power) and rebooted HA, to still have the logs saying it was trying to see the starter battery and then shutting on and off.

The next thing I am going to do is remove the AUX lead to the second battery, factory reset the Shunt, Delete the instance from HA, reboot HA and re-setup everything. Hopefully, that will prove the issue is the Starter battery monitoring.

I suspect you are affected by the issue discussed here No Devices/Entities added · Issue #94 · keshavdv/victron-hacs (github.com)

Basically the current live version of the code doesn’t have the appropriate code to handle the STARTER_BATTERY_VOLTAGE or MIDPOINT_VOLTAGE configurations. No Devices/Entities added · Issue #94 · keshavdv/victron-hacs · GitHub

There is an open pull request here which has the fixed code that resolves the issue, the original developer hasn’t yet added that in, but if you manually put those missing lines in it will fix the integration. Support starter battery / midpoint auxillary functions. by david-collett · Pull Request #97 · keshavdv/victron-hacs (github.com)

I ran into this same issue and is what resolved it.

How did you get the address key?

I did it the hard way because that was the only option at the time. Now it’s in the app (can’t remember exactly where, but I did verify it at one point).

What’s the hard way? lol