SBFspot Bluetooth homeassistant addon

Hello there,

I am new to Home Assistant en last weekend managed to install the SBFspot for HAOS. For the most part I have got it working. Connection to SMA inverter is established, MariaDB is updated every five minutes with right values, but one problem remains.

The sensors are being made at start, but are never updated. I have used a MQTT explorer and see that the message homeassistant->sbfspot_{plantname}->sbfspot_{serial} is being updates every five minutes. But the sensors never receive an update. After staring and trying for a whole weekend I am out of clues. Can anyone suggest something to point me in the right direction? Many thanks in advance.

Hi @Lex72

You need to confirm topics and messages match up in mqtt explorer and mqtt debug info in HA.
Check if you are getting errors in the HA log.

The Highlighted message below in the screenshot, needs to match the debug info in the second screenshot
mqttExplore

homeassistant/sbfspot_YourPlantName/sbfspot_Serial

The config messages set up the sensors. The actual sensor updates come in on the single subscribed topic. You should be seeing most recently received messages under the subscribed topics.

Check for a typo/case sensitive text error, etc in your HAOS-sbfspot options.

Mine looks close to that, but not exactly. Looks like I am missing the serialnumber in the topic. See below.

@Lex72

It does indeed look like the serial number is being missed there.

Do a purge and then do a Create sensors in the HAOS-sbfspot options.

There should be this HAOS-SBFspot topic in MQTT explorer also.

Capture

That should just be a short message sent from the inverter with

"InvSerial": 2484848832,
  "InvName": "SN: 2484848832",
  "InvClass": "Solar Inverters",
  "InvType": "SB 3000",
  "InvSwVer": "03.10.37.R"

That should be where your inverter serial number is coming from when it makes the sensors.

Try that, otherwise I will need some logs and options configs sent to me in a PM to look over.

OK so here is the latest update for me.
I have removed the add on (SBFspot), then deleted all the entries for with from mqtt and reboot HA.
Added SBFspot back, made sure configuration is OK and then restarted the addon. This time it went further - it found the details of the invertor.

image

However, while sensors are created in mqtt they still remain unknown in HA (just like before).

Looking at the logs that strange entry is still there - sh: HxoCzfjh4T7d: not found

SBFspot V3.9.7
Yet another tool to read power production of SMA solar inverters
(c) 2012-2022, SBF (https://github.com/SBFspot/SBFspot)
Compiled for Linux (LE) 64 bit with MySQL support
Commandline Args: -v -ad1 -am0 -ae0 -mqtt
Reading config '/usr/bin/sbfspot/SBFspot.cfg'
Tue May  9 08:40:00 2023: INFO: Starting...
sunrise: 06:55
sunset : 17:30
Connecting to 00:80:25:17:91:F2 (1/10)
Initialising...
SUSyID: 125 - SessionID: 921113612
SMA netID=01
Serial Nr: 7D30C046 (2100346950)
BT Signal=75.3%
Logon OK
SUSyID: 78 - SN: 2100346950
Device Name:      SN: 2100346950
Device Class:     Solar Inverters
Device Type:      SB 5000TL-20
Software Version: 03.01.05.R
Packet status: 21
SUSyID: 78 - SN: 2100346950
Device Status:      Ok
SUSyID: 78 - SN: 2100346950
Device Temperature: 52.5Ā°C
SUSyID: 78 - SN: 2100346950
GridRelay Status:      Closed
SUSyID: 78 - SN: 2100346950
Energy Production:
        EToday: 1.504kWh
        ETotal: 105972.508kWh
        Operation Time: 54758.67h
        Feed-In Time  : 53816.52h
SUSyID: 78 - SN: 2100346950
DC Spot Data:
        MPPT 1 Pdc:   0.268kW - Udc: 208.26V - Idc:  1.293A
        MPPT 2 Pdc:   0.163kW - Udc: 271.40V - Idc:  0.602A
        Calculated Total Pdc:   0.431kW
AC Spot Data:
        Phase 1 Pac :   0.449kW - Uac: 244.13V - Iac:  1.841A
        Phase 2 Pac :   0.000kW - Uac:   0.00V - Iac:  0.000A
        Phase 3 Pac :   0.000kW - Uac:   0.00V - Iac:  0.000A
        Total Pac   :   0.449kW - Calculated Pac:   0.449kW
        Efficiency  :  104.18%
SUSyID: 78 - SN: 2100346950
Grid Freq. : 49.99Hz
SUSyID: 78 - SN: 2100346950
Current Inverter Time: 2023-05-09T08:28:06+0800
Inverter Wake-Up Time: 2023-05-09T06:37:35+0800
Inverter Sleep Time  : 2023-05-09T08:28:10+0800
MQTT: Publishing (homeassistant/sbfspot_{plantname}/sbfspot_{serial}) "PrgVersion": "3.9.7","Plantname": "Home","Timestamp": "2023-05-09T08:40:02+0800","SunRise": "2023-05-09T06:55:00+0800","SunSet": "2023-05-09T17:30:00+0800","InvSerial": 2100346950,"InvName": "SN: 2100346950","InvTime": "2023-05-09T08:28:06+0800","InvStatus": "Ok","InvSwVer": "03.01.05.R","InvClass": "Solar Inverters","InvType": "SB 5000TL-20","InvTemperature": 52.460,"InvGridRelay": "Closed","EToday": 1.504,"ETotal": 105972.508,"GridFreq": 49.990,"PACTot": 449.000,"PAC1": 449.000,"UAC1": 244.130,"IAC1": 1.841,"OperTm": 54758.668,"FeedTm": 53816.519,"PDCTot": 431.000,"UDC1": 208.260,"UDC2": 271.400,"IDC1": 1.293,"IDC2": 0.602,"PDC1": 268.000,"PDC2": 163.000,"BTSignal": 75.294,"InvWakeupTm": "2023-05-09T06:37:35+0800","InvSleepTm": "2023-05-09T08:28:10+0800"
sh: HxoCzfjh4T7d: not found
MQTT: Failed te execute '/usr/bin/mosquitto_pub' mosquitto client installed?
Error 32512 while publishing to MQTT Broker
Error: Both topic and message must be supplied.

MQTT: Failed te execute ā€˜/usr/bin/mosquitto_pubā€™ mosquitto client installed? - so I went looking inside the /usr/bin/mosquitto_pub file. It kind of looks strange to me.
Is yours the same?

@MnM That last image you posted is showing an out of memory error. Message too large error.

What hardware do you have HA installed on?

You can try deleting some of the MQTT sensor items from options to make the message smaller.

PrgVersion,Plantname,Timestamp,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvType,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal

Try the above, it has some of the more redundant options taken out.

Mosquitto_pub is installed in the addon, so yours will be same as mineā€¦
Although looking in the binary file I see same details, which looks like just standard messages. Looking in the binary file is the same as looking in an .exe file. So not really helpful, especially if it isnā€™t decompiled and reverse engineered.

Just tried that. Purged all and stop the addon, then added your suggested sensors and start the addon.
Exact same issue and error.

I am running a virtual HA on ProxMox.

Also tried with just one sensor - PrgVersion - same error.

Thatā€™s not the pw you have entered for mqtt is it?

Can you PM your options to me

No it isnt.

Will send a PM.

Just a follow up - got it all working as it should now.
It was this:

sh: HxoCzfjh4T7d: not found

My mqtt password is really long. I had a & character in there everything after the & is shown as an error. I did have double quotes for the password but it still broke.

Created new password without any special characters and all working as it as it should now.

@HasQT - many thanks for your assistance!

1 Like

Hi,

Does SBFspot still upload historical data (14 days) to PVPoutput?
I donā€™t have mine doing that anymore. How can I configure it for that?
Thanks

line 95 in docker file

Line 95 and line 97 determine the crontabs for SBFspot to run at.
Line 95 does 1 day archive every 5 mins.
Line 97 does a monthly archive once per day at 5:55am local time.

So it is vaguely redundant to run the 14 day archive all the time.

In saying that if you want to run one as a once off because you missed some days due to server being down or similar, you can do it manually.

You can use either ā€œAdvanced SSH & Web Terminalā€ or Portainer Addons to run the commands. Note the standard Terminal & SSH addon doesnā€™t allow this function.

The below command will open a terminal in the haos sbfspot container.

docker exec -it addon_a51a23d8_haos-sbfspot /bin/bash 

then the below will execute the 14 day archive.

/SBFspot -v -ad14 

The full list of SBFspot commands can be listed with. Note SBFspot is case sensitive here. /sbfspot wonā€™t work.

/SBFspot -?

As a side note I think I had planned to add a way to do variables(as in the set the days you wanted) for archive retrieval from the addon options, but never really got around to it because itā€™s way simpler just to run the commands from the Terminal addon.

Edit: You could also set those commands up in a script or automation using the commandline function, to make a button or automation to do this.

Thanks. I think a manual update will work. maybe you can build another cron line which will take the value from GUI (for the number of days to update) in the next version :slight_smile:

@HasQT - just saw the new version and the log for it.
Thanks for adding the 14 back log option!!

1 Like

Iā€™m using SBFspot to connect to my SMA sunnyboy by bluetooth.
Iā€™d like to use a esp32 to replace my HAS bluetooth and act as extender

As any one done this kind of set up ?

(a ip connection would be easyer for sureā€¦ but my sunny boy is too old ^^ )

That one was working I believe, there are a couple of others I posted a few months back in this thread

Hi HasQT

As always thx for your precious answers
I went back and had a look.

I first tryed silly frog version which was more clear on how to installā€¦ but had some code error.

C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino: In function ā€˜void blinkLed()ā€™:
C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino:108:16: error: ā€˜LED_BUILTINā€™ was not declared in this scope
digitalWrite(LED_BUILTIN, blinklaststate);
^~~~~~~~~~~
C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino: In function ā€˜void setup()ā€™:
C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino:260:11: error: ā€˜LED_BUILTINā€™ was not declared in this scope
pinMode(LED_BUILTIN, OUTPUT);
^~~~~~~~~~~
C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino: In function ā€˜bool checkIfNeedToSetInverterTime()ā€™:
C:/Users/Lebeck/Desktop/ESP32_to_SMA_ESPHome-main/src/ESP32_SMA.ino:576:48: error: call of overloaded ā€˜abs(long unsigned int)ā€™ is ambiguous
timediff = abs(datetime - ESP32rtc.getEpoch());

Iā€™m now trying darrylb version but itā€™s not clear what to update. seems itā€™s waiting for a JSON File with the config.

Anyone already used that one ?
A readme.txt with how to use would be helpfull to me ^^

(ps : in both case, Iā€™m trying to use VS code)

for darrylb error i have:
in config_exemple.h > identifier ā€œuint8_tā€ is undefined
in config.h > cannot open source file for all ā€˜includeā€™ like wifi.h

Cherry on the cakeā€¦ in SBFspot . i have a MIS_Enabled Multi inverter systems optionā€¦ any chance I can activate this on those ESP32 code ?

Hi @lebeck

Sorry Iā€™m not sure how to set them up. It has been a long time since Iā€™ve looked at them and my kids ate(or otherwise destroyed) my spare esp32 I had. Which I didnā€™t really have a need to replace.

Darrylb readme does make mention of esp touch on the play storeā€¦ Although Iā€™m not sure what the benefit of that is over just putting the info you need in the config.h file. I see you asked over there already.

Iā€™m not sure if MIS will be possible on a esp32.

HasQT any idea why MQTT my data from sbfspot looks correct but not HA energy dashboard ?
MQTT daily production sum is 10951 while energy dashboard is 9,44 k

sbf_mqtt_inv1
sbf_mqtt_inv2

There is usually abit of lag in data on the energy dashboard as it averages the data over like a 2 hr period.