SBFspot Bluetooth homeassistant addon

Hello, I have an SMA STP8000TL-10 inverter from which I can retrieve data (current and historical) via Bluetooth with Sunny Explorer on my laptop.
Now I have had Home Assistant (HA-OS @ raspy 4) for some time and have stumbled across SPFspot.
Is it possible to retrieve the actual values in HA? I only have the user password though.
I have installed the add-on but can’t get to grips with the configuration. How do I find out the BT-MAC of the inverter? I can’t find it in Sunny Explorer.
And is there an explanation of the setup somewhere that is also suitable for beginners?

@Eisbaer2

Hi Wolfgang, Yes it sounds like you should be able to use SBFspot if you can connect to your inverter with Sunny Explorer via bluetooth. I am not familiar with your Inverter.

I usually find the bluetooth Mac using my mobile phone bluetooth connection (Sunny Explorer doesn’t list the BT mac that I have seen, ALSO make sure Sunny explorer is NOT running, you can’t have 2 connections to the inverter). Just scan for BT devices on your phone while standing near your inverter and you should be able to find the MAC in the list. Your inverter should have a Blue BT led light up if you actually connect to it.

The Bluetooth password for SBFspot will the be the same as your sunny explorer password.

The Readme on the addon or github is good place to start for setup instructions.

The other main thing you really need is the MQTT Addon and also Integration, and a dedicated User/password for MQTT, that is not your Homeassistant MQTT user. Homeassistant needs it’s own User that cannot be used for SBFspot. MQTT explorer can be useful for troubleshooting here.

Once you have MQTT working and sending data, you should be able to change the SBFspot options to create Sensors and they will be adding to Homeassistant. It is important that MQTT works prior to trying to create sensors as SBFspot needs MQTT working to detect your inverters serial number to create the correct sensors in homeassistant.

Once you have connected SBFspot to your inverter over MQTT, you can setup mariaDB database for SBFspot data storage and PVoutput if you want.

Hope that helps and happy new year.

Thank you @HasQT. And there beginns my problem. Tried with two different Android Smartphones with same result: I can see my inverter in Bluetooth. To pair I’m asked for a password (0000 and 1234 are suggested by Android). Neither 1234 nor my Sunny Explorer user password are accepted, only 0000 works. So my inverter is paired but I’m not able to connect to it. The blue LED doesn’t light up. And because of that I also can’t see a BT MAC address.

Once the inverter is saved in your Bluetooth devices list you should be able to click the cog :gear: to see it’s BTmac. I can do that on android 14 using 0000, you don’t actually need to connect beyond that with your phone.

You could also try doing that from your windows PC Bluetooth settings.it should be a similar process.

You could also try SBFspot for windows it may have inverter detection. Although I can’t confirm that as it’s been many many years since I used the windows version. It wouldn’t hurt running that to familiarise yourself with SBFspot config settings.

With a new Android App I can see all BT MACs. My both Samsung smartphones didn’t show any MACs in the system settings. So first problem solved.
I also could start SBFspot as a HA addon. When the inverter is alive, I usually get values (I get new values about every 5-10 min).
More questions:

1a) I don’t use MariaDB so far. Aren’t all values stored in the internal DB of HA (and I also have Influx DB activated)?

1b) What is the advantage of using MariaDB?

1c) How can I deactivate the use of MariaDB? In the log file I see several times “Error: Can’t open MySQL db [SBFspot] : Unknown server host ‘core-mariadb’ (-5)”

  1. What does “* ArchiveDayData() *” in the log file mean?

  2. I have one internal and one external BT adapters. Are both used (I can see both BT MACs in the log no matter which of the both MACs I use in the config)?

  3. Today I had a lot of failed connection attempts:
    Connecting to 00:80:25:1E:78:59 (1/5)
    Connecting to 00:80:25:1E:78:59 (2/5)
    Connecting to 00:80:25:1E:78:59 (3/5)
    Connecting to 00:80:25:1E:78:59 (4/5)
    Connecting to 00:80:25:1E:78:59 (5/5)
    Mon Jan 6 15:51:20 2025: CRITICAL: bthConnect() returned -1

I could connect to the inverter with Sunny Explorer without any problems at these times. Does anyone have any tips on what I can improve?

  1. I see the blue LED (BT LED) on the inverter only when the values are updated every 5-10 mins. Is it possible to leave the connection permanently on (as long as the inverter is alive)?

Thanks in advance

The values received via MQTT in Home Assistant should indeed be stored in the HA database. Any missing values would have to manually adjusted using statistics adjust feature or manually editing the HA database(not recommending that)

The main purpose of MariaDB is for uploading to PVoutput, SBFspotUpload uses the database to send the figures to PVoutput. MQTT uses the direct figures without the database. You don’t need to set up MariaBD or PVoutput if you don’t want/need them.
The Error will be remain though, The MQTT portion works fine with the error( it is just a text notification). The error will just continue to show up every 5 mins. I’d need to learn to program to have a dynamic setup capable of switching these features On of Off. There may be forks of this addon around that do this or using SBFspot directly is more configurable.

This is an SBFspot command which collects any missing data from the day and adds it to MariaDB, there is a Monthly command also. It is then used to adjust PVoutput.

The addon will show both MACs as it is detecting both MACs. It should use the one that is set in the options under LocalBTAddress.

The inverters are only capable of a single BT connection. Running Sunny Explorer will block the addon trying to make a connection. BT on raspberryPI’s(although I don’t know what device you are using) is pretty prone to interference. You could try a usb extension on the dongle BT adapter, or moving your device closer.

No, not with this addon. Even with running SBFspot directly without the addon and setting your own polling times (of say 10 seconds) you still wouldn’t achieve permanent connection as SBFspot it designed to disconnect between requests. This is not how SBFspot is written (to explore that further you would need to contact the authors of SBFspot, I only wrote the addon to interface Home Assistant.)

1 Like

@HasQT: Thanks a lot!

1 Like

After my first connection successes some days ago something has changed. I get no more connection. Here the log:

[09:18:43] INFO: 
[09:18:43] INFO:  Linux 6.6.62-haos-raspi #1 SMP PREEMPT Thu Dec 19 12:58:10 UTC 2024 aarch64
[09:18:43] INFO: 
|   INITIALISE MQTT SENSOR CREATION   |
XXX
core-mosquitto
XXX
homeassistant/sbfspot_{plantname}/sbfspot_{serial}
PrgVersion,Plantname,Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvClass,InvType,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,OperTm,FeedTm,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal,InvWakeupTm,InvSleepTm
[09:18:45] INFO: 
[09:18:45] INFO: 
[09:18:45] INFO:  ||    Generating HA Sensors    ||
SBFspot V3.9.11
Yet another tool to read power production of SMA solar inverters
(c) 2012-2024, SBF (https://github.com/SBFspot/SBFspot)
Compiled for Linux (LE) 64 bit with MySQL support
Commandline Args: -v -finq -mqtt -cfg/usr/bin/sbfspot/SetConfig.cfg
Reading config '/usr/bin/sbfspot/SetConfig.cfg'
Wed Jan  8 09:18:45 2025: INFO: Starting...
sunrise: 08:17
sunset : 16:42
Connecting to 00:80:25:1E:XX:XX (1/10)
Connecting to 00:80:25:1E:XX:XX (2/10)
Initialising...
SUSyID: 125 - SessionID: 961637948
SMA netID=01
Serial Nr: XXX
BT Signal=70.6%
Wed Jan  8 09:19:45 2025: CRITICAL: Logon failed. Reason unknown (-1)
Wed Jan  8 09:19:45 2025: INFO: Done.
[08:19:45] WARNING: Halt add-on with exit code 1
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

And here my configuration:

Connection_Type: Bluetooth
Sensors_HA: Create
BTAddress: XXX
Password: XXX
LocalBTAddress: XXX
IP_Address: 55.255.255.255
Plantname: PV
Latitude: "49"
Longitude: "9"
Timezone: Europe/Brussels
DateTimeFormat: "'%H:%M:%S %d-%m-%y'"
SQL_Password: fake
MQTT_User: XXX
MQTT_Pass: XXX
MQTT_Topic: homeassistant/sbfspot_{plantname}/sbfspot_{serial}
MQTT_Data: >-
  PrgVersion,Plantname,Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvClass,InvType,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,OperTm,FeedTm,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal,InvWakeupTm,InvSleepTm
PVoutput_SID: "0123456789:12345"
PVoutput_Key: fake
LogLevel: debug

Anyone has an idea what to change to have more success? I have the current version: 2025.1.0, HAOS 2025.1.1 on a Raspi 4

Looks like you are putting the wrong password. This is the first password in configuration. It should be the same as Sunny Explorer. Double check you don’t have a typo.

I’m absolutely sure using the right password and have no more idea what ton change. The BT quality seems good enough with >70%.

Today all my further connection trials failed. Maybe something changed with last update?

Do you have “quotes” wrapping the password?

The addon is particularly troublesome with “quote mark” as the text is converted from HA to the addon and then to the SBFspot config file. Especially when swapping from UI config mode to YAML config mode.

The password should be showing as “password” in the YAML config

I doubt the update of HA will be the problem, but I haven’t updated yet to confirm.

Thank you @HasQT for your message.
Interesting. As shown in my config.yaml above (Post #359) some of the options are in quote marks, some not.
But all of the passwords are not quoted.
Example with password “TestPW”

Way 1 via GUI: I type TestPW in the password field and when I switch to yaml I also see TestPW without quotes.

Way 2 via yaml: I type “TestPW” with quotes in yaml => click SAVE => quotes dissapear

At my Tests 2-3 ago with successfull connections I used the same password also without quotes.

Yeah the quotes can be annoying, that was why I swapped to using secrets.

This is how my config looks in yaml mode. I have my details in secrets, which means I can also uninstall/reinstall the addon easily on my test machine etc…

All my secret file text is “quote wrapped” like this

Homeassistant needs a restart after adding text to secrets.

BTAddress: "00:80:34:2A:C6:48"
Connection_Type: Bluetooth
Sensors_HA: "No"
BTAddress: "!secret BTAddress"
Password: "!secret SBFpassword"
LocalBTAddress: "!secret LocalBTAddress"
IP_Address: 55.255.255.255
Plantname: "!secret SBFplantname"
Latitude: "!secret home_lat"
Longitude: "!secret home_long"
Timezone: "!secret Timezone"
DateTimeFormat: "'%H:%M:%S %d-%m-%y'"
SQL_Password: "!secret mariadb_pw"
MQTT_User: "!secret mqtt_user"
MQTT_Pass: "!secret mqtt_pass"
MQTT_Topic: homeassistant/sbfspot_{plantname}/sbfspot_{serial}
MQTT_Data: >-
  PrgVersion,Plantname,Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvClass,InvType,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,OperTm,FeedTm,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal,InvWakeupTm,InvSleepTm
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info

FYI just tried using the addon on HAOS 2025.1.1 and it worked without issue.

Tried that. Made no difference. I get no connection to the inverter, whatever I try.

With SBFspot @ Windows on my laptop (near my RP4 with HA) it just takes about 3 seconds to connect, get all wanted values, and disconnect again.

No connection (10\10 attempts fail) or logon failure?

You don’t have complicated password with special characters in it? That trips up the config too.

If it’s logon failure, and you are using secrets, just uninstall\reinstall the addon. That should clear config errors that remain.

The addon runs the same SBFspot as what is running on your PC. The results should be similar.

You can login to the addon and double check your SBFspot.cfg file being written correctly using the terminal (the community one, not the official one)

The command is.

docker exec -it addon_a51a23d8_haos-sbfspot /bin/bash

then 
nano SBFspot.cfg

Both. I had this several times today with one, two or three connection attempts:

Connecting to 00:80:25:1E:78:59 (1/10)
Connecting to 00:80:25:1E:78:59 (2/10)
Connecting to 00:80:25:1E:78:59 (3/10)
Initialising...
SUSyID: 125 - SessionID: 856275878
SMA netID=01
Thu Jan  9 14:45:34 2025: CRITICAL: Failed to initialise communication with inverter.`

I also deactivated my internal BT or my external BT and removed my external BT. Made no difference.

No. Easy Password. And it already worked sometimes. And works with the windows version.

Tried that. Wasn’t better.

How to do that without Docker? I have HAOS on a RP4 (and 2 terminal addons).

That’s command for HAOS on rpi4 using Advanced SSH & Web Terminal.
You can run SBFspot directly from the terminal after that command.
HAOS runs on docker(a fairly locked down version). Addons are just docker containers configured to work with HA supervisor.

This is a different error. I think that might be a Bluetooth problem. Perhaps when you removed the BT dongle. These are SBFspot errors though, they don’t come from the addon.

I have done a lot more testing in the meantime and it has cost me a lot of nerves. Most of the time it didn’t work and it wasn’t because of the settings. I tried everything there too…
Then I moved my Home Assistant to a Proxmox VM on a thin client. No change. However, I continued to use the existing external Bluetooth stick. After that didn’t work either, I tried using a different Bluetooth stick. And that was the solution. It works great with the other stick. Thank you @HasQT for your support!

1 Like

Good to hear.

Out of curiosity did you try rpi4 with the new BT dongle?

I personally use a rpi4, I just use the internal Bluetooth. My rpi4 is only about 3 metres from my inverter in my garage though.

I use a VM for testing from my pc. That is about 5 metres away through a few walls.

No, I didn’t. But I’m quite sure that it would work with my RP4 and the new BT stick.

1 Like