SBFspot Bluetooth homeassistant addon

Reinstalled and no difference.

Which of the serial devices is your bluetooth? If any.

Neither of the 2 device in my pic are the bluetooth, 1 is the zigbee, the other zwave.

I had tried previously booting everything with those unplugged but made no difference.

ttyAMA0 are mine I think… both my pi3 and pi4 are using inbuilt

plain sbfspot-addon doesn’t list any devices in config and still connects no issue. haos-sbfspot-addon has ttyAMA0 in config, although this apparently unnecessary.

I added “devices”: ["/dev/ttyS0", “/dev/ttyAMA0”, “/dev/ttyAMA1”], to test

You could run sbfspot on your pi and point to mqtt and mariadb on your NUC…
or run haos on the pi, mqtt on the NUC and use PVoutput integration to pull in pvo data to the NUC.

Could play around with that too.

I know there are loads of other options to get this going. I was hoping to keep it to a single device rather than run on multiple.

I guess for now we are out of ideas. Will be interesttng to see and hear of anyone else running it on anything other than a pi.

Thanks for all the efforts.

1 Like

yeah I get the single device theory… its how we got to this addon.

You know what I just tried both addons plain sbfspot and test sbfspot with a usb BT adapter I had floating around.
The usb adapter automatically switched to default controller. Switching the MACs in LocalBTAdress I could connect with either adapter in both addons, and I had a failed connection when I pulled the usb adapter out but left that MAC as localBTAdrress.

So yeah, not sure what’s going with the NUC :frowning_face: I did ask on discord for suggestions, haven’t had any yet.
I will have a look at doing apparmor in the next few days. Perhaps that will help.

@bmccluskey

Try test 2022.7.4
I got apparmor working.

No change :frowning:

What does the apparmor do?

its abit like windows UAC. its a security thing. Access control.

Thank you for the update. I tried it and didn’t have any success.

Since then I grabbed a Raspberry Pi and installed HA and the add on. Put in next to my Server/virtual machine and I got same result. Kept moving the Pi closer to the SMA Inverter. Took about 3 meters before I got it to hook up. Very strange. My laptop will hook up further away from the inverter.

Waiting for delivery of a 5m USB cable to see if that will solve my VM issue as I can’t move the server. It will be interesting to see if it is only a distance thing or possible interference with the bluetooth signal.

Anyway, now trying to figure out how to download all the data stored in the Inverter to Maria DB. I can access year of data on the laptop so it will be interesting to see if I can get it all.

Laurie

1 Like

10second duration timeout connection attempt seems to be a hardware Bluetooth issue.
1minute duration timeout is a range issue.

An extension should be useful. Pi have pretty well known interference issues.

It could also just be a difference in power supplies, and what power is available to the Bluetooth… Pc has a big power supply… Pi have much smaller power supplies.

In saying that would like to hear if someone does get the addon going on a nuc or vm.

I’m vaguely planning on trying to get a vm or wsl build going for testing…

Started up the test version again and had connected into it with Portainer. Ive also plugged the usb dongles (zigbe, zwave,3rd party BT) into a hub.

BluetoothCTL started fine in core and could see both BT controllers in the NUC.

When I try to start BluetoothCTL in the Portainer console I get this


> bash-5.1# bluetoothctl
> Waiting to connect to bluetoothd...dbus[166]: arguments to dbus_connection_get_object_path_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5921.
> This is normally a bug in some application using the D-Bus library.
> 
>   D-Bus not compiled with backtrace support so unable to print a backtrace
> Aborted (core dumped)
> bash-5.1#

try it now. I had taken out host_dbus:true it will need a reinstall.

None sure about that. Device Tracker on both the VM & Pi found the Inverter Bluetooth. Both did the 10 seconds timeout not connecting. Tested on Pi with internal and external Bluetooth. I went from the 10 second time out to a connection with movement closer to the inverter. That movement also took me away from a very full tech cupboard though, so perhaps interference. I did see it connect a couple of times on the second go and once on the 10th but I did not look at the timing.

i did not get much better reception, distance wise, between the internal bluetooth of the Pi and using an, alleged high gain, USB dongle.

The similarities between what I had on the VM & the Pi make me think the VM will work if I can get the antenna closer to the inverter. Will report back when I get the extension cable.

This is the first thing I have done on HA. Now trying to understand how to get the data to display. Should have started on a light switch.

I can not see any documentation for your add-on about how to pull historical data. Will I have to use some other method?

Again thanks for the help.

1 Like

Thanks for the informative post.

The options change abit of the day, they are in the Dockerfile crontabs section.
The Commandline Args: -v -ad1 -am0 -ae0 -mqtt -finq

bash-5.1# ./usr/bin/sbfspot/SBFspot -?
SBFspot V3.9.5
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
SBFspot [-options]
 -scan               Scan for bluetooth enabled SMA inverters.
 -d#                 Set debug level: 0-5 (0=none, default=2)
 -v#                 Set verbose output level: 0-5 (0=none, default=2)
 -ad#                Set #days for archived daydata: 0-300
                     0=disabled, 1=today (default), ...
 -am#                Set #months for archived monthdata: 0-300
                     0=disabled, 1=current month (default), ...
 -ae#                Set #months for archived events: 0-300
                     0=disabled, 1=current month (default), ...
 -cfgX.Y             Set alternative config file to X.Y (multiple inverters)
 -finq               Force Inquiry (Inquire inverter also during the night)
 -q                  Quiet (No output)
 -nocsv              Disables CSV export (Overrules CSV_Export in config)
 -nosql              Disables SQL export
 -sp0                Disables Spot.csv export
 -installer          Login as installer
 -password:xxxx      Installer password
 -loadlive           Use predefined settings for manual upload to pvoutput.org
 -startdate:YYYYMMDD Set start date for historic data retrieval
 -settime            Sync inverter time with host time
 -mqtt               Publish spot data to MQTT broker

Libraries used:
        MySQL V10.5.5 (Client)
        BOOST V1.78.0
bash-5.1# 

You can from portainer do various flags in the command line.

historical data. You mean from the inverter(I am assuming its SMA inverter). You can use SunnyExplorer to download all the history of the inverter as CSV files.

I think I have imported sqlite DB to mariadb DB, but it was a long time ago and I don’t really remember. I would have used myPHPadmin. you can probably upload CSV data with myPHPadmin

You can upload the data by hand to PVoutput as CSV. that will help you get the format correct for doing it by hand in myPHPadmin.

Hello,

just a side note. i regularly get an error so that the app reports a BT error (see post #54). But the Raspi BT still works. Then only a reboot of the Raspi helps. It was not the SSD as written in post #60. The SSD did not have an error during a retrospective test.

Frank

@tropfen
Are you using pi3 64bit or pi4 64bit?
Your connection duration seems to take a long time from those earlier images 2-3 mins.
What sort of rssi are you getting when it does connect?
BT_Signal=69.8% for me and I rarely have more than 1-2 attempts to connect. I have one of those argonOne cases though, not sure if that helps or hinders the connection.

There should be an update available in 20 mins or so. 2022.8.1 should be soonish

Hello Has,

it is an raspi 4:
Board rpi4-64
CPU Architecture aarch64
Standard plastic red/white raspi case
The distance raspi to inverter is approx. 90 cm

Frank

1 Like

Just a short update on some of my testing yesterday and today.

On the NUC, just updated to the latest versions of all 3 of your pacakages. Moved the NUC so it was less than 1m from the inverter. Ran each in packagage in turn but all failed in the same way.


Generating /usr/bin/sbfspot/SBFspot.cfg & /usr/bin/sbfspot/SBFspotUpload.cfg
[08:26:55] INFO: [Host Bluetooth MAC Address] Controller AC:7B:A1:44:5C:CC homeassistant [default]
Starting daemon
Starting cron in foreground
SBFspot V3.9.5
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 -ad0 -am0 -mqtt -finq
Reading config '/usr/bin/sbfspot/SBFspot.cfg'
Mon Aug  1 08:27:25 2022: INFO: Starting...
sunrise: 05:15
sunset : 20:40
Connecting to 00:80:25:1F:64:54 (1/10)
Connecting to 00:80:25:1F:64:54 (2/10)
Connecting to 00:80:25:1F:64:54 (3/10)
Connecting to 00:80:25:1F:64:54 (4/10)
Connecting to 00:80:25:1F:64:54 (5/10)
Connecting to 00:80:25:1F:64:54 (6/10)
Connecting to 00:80:25:1F:64:54 (7/10)
Connecting to 00:80:25:1F:64:54 (8/10)
Connecting to 00:80:25:1F:64:54 (9/10)
Connecting to 00:80:25:1F:64:54 (10/10)
Mon Aug  1 08:27:34 2022: CRITICAL: bthConnect() returned -1
Mon Aug  1 08:27:34 2022: INFO: Done.

Also downloaded the latest VMware virtual machine of HA and installed and configured that on my HP Microserver and installed the external BT adapter. After configuring HA I mapped through the external bluetooth adapter. Instaled the Test SBFspot version but alas I got the same issue. Then did a few checks with Bluetoothclt. It could see the external BT adapter and I could scan and see the inverter from both inside and outside the docker package.

1 Like

Hil aurie_lewis
Interested to hear you had some success with your VM. What hardware are you running the VM on? What OS is running on the VM? What hypervisor (VMware?) are you running? Are you using a built in bluetooth or do you have a plug in adapter? If a plug in adapter do you know the make and model?

When you talk about the 10 second time out are you getting 10 seconds between each of the tries to connect or is it 10 seconds from the first to the last? Im getting the later, see my previous post the shows the timestamp starting at 08:27:25 and finishing at 08:27:34.

1 Like

Howdy,

I am just starting with VM. I am running the VM on a Synology NAS. I believe it is a basic linux machine inside. Downloaded the OVA file from the HA site and imported it. As an introduction 8.2 has been working well but I am now having issues with 8.4 and HACS/localtuya. Another issue. My system requires an external bluetooth dongle. I can pass the USB port directly through to the NAS so the OS should handle drivers etc for it. My NAS is at what I believe to be the range for my bluetooth connection to the Inverter, though I can get a windows laptop to connect via bluetooth with the inverter from a tiny bit further away. I am going through a number of walls and a linen closet full of stuff.

I spun up a windows VM with Sunny Explorer on the NAS and was able to connect with my bluetooth dongle so thought the HA VM would be fine. It wasn’t. Using bluetooth_tracker on HA I can see the SMA inverter on known devices so I am under the impression my dongle is working but the strength is not enough to connect. I can not explain why it does not connect with HA though.

I created a HA configuration on a Raspberry Pi 4 and placed it on top of the NAS it would not connect but it also showed the inverter on the Bluetooth tracker. I had to move the Pi about 2 metres closer to the inverter before it connected. I can’t move my NAS that close to test so I have ordered a longer usb cable and I am waiting for delivery. I will test it when I get it.

On both devices I was getting the 10 connection attempts in 10 seconds. There was no delay at all. This continued for the Pi till it just connected. I never had it taking a minute to go through the 10 connection attempts. It just suddenly connected when close enough. I think it was just a signal strength thing. Enough to recognise that the inverter was there but not enough to connect.

The other interesting thing was that I did not get any better reception distance using a Bluetooth dongle that was supposedly hight gain as opposed to the internal one in the Pi. I would say that I am about 5 metres from the inverter when it connects and it is going through one brick wall and a number of other walls.

My VM has seen the inverter using a Realtek and a Broadcom bluetooth dongle. Has not connected with either. My Pi has connected with its internal device and the Realtek dongle.

This is the dongle: Long Range Bluetooth 5.0 Adapter for PC USB Bluetooth Dongle Wireless Audio | eBay

Once I get a longer bluetooth cable (ordered) I will report back on how the NAS works. Cable I ordered was 5 metres. Will be a problem to install so it is not seen, if it works, but an easy test to conduct.

If you can move your VM closer and see if it hooks up.

Hope it works for you.

1 Like