SBFspot Bluetooth homeassistant addon

Thanks for the detailed reply. I will order a BT adapter similar to yours.

Im thinking the working assumption about the the 10 tries in 10 seconds being an issue contacting the BT adapter could be wrong and could be distance related. I will move my NUC beside the Inverter again and leave it for a while and see what happens.

No i have an old pi3 that I sent to my parents to play emby there. It has remote access. I replaced it about a year ago with the pi4.

Pi3 runs 64bit haos. Pi4 runs 64bit docker supervised.

The pi4 is in my garage. The other end of my garage is my inverter.

I did play around with WSL today though. It’s interesting, but my pc is limited to win 10. WSL looks great for win 11. My CPU is an early gen i7-pre-uefi and only win 10 home, so even VM is limited.

I’ll probably try a VMware soonish to see if I can replicate the amd64 problems. WSL looks like abit too much mucking on win10 for trouble shooting

My desktop used to be my sbfspot machine. Then the pi3, now the pi4. They all connect from my desk/office

Ok - now i understand.

Update on the NUC beside inverter - no difference. Either with the buit in or external BT. The new BT will turn up in a few days and see if that makes any difference.

I would think you can get vmware running on you win10 machine. The vm image doesnt require a lot of power and if its only for a little testing you should be good.

It’s not the power/usage. Some of the virtual stuff requires uefi bios or/and win 10 pro

Ok I could follow that guide

This is the result via desktop/BT adapter using the VMWare Was 10seconds connection attempt duration.
While my Desktop connected first go.

Version core-2022.7.7
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
User root
Virtual Environment false
Python Version 3.10.5
Operating System Family Linux
Operating System Version 5.15.55
CPU Architecture x86_64

Generating /usr/bin/sbfspot/SBFspot.cfg & /usr/bin/sbfspot/SBFspotUpload.cfg
[11:53:46] INFO: [Host Bluetooth MAC Address] Controller 00:43:7D:AD:45:12 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 (GitHub - SBFspot/SBFspot: Yet another tool to read power production of SMA® solar/battery inverters)
Compiled for Linux (LE) 64 bit with MySQL support
Commandline Args: -v -ad0 -am0 -mqtt -finq
Reading config ‘/usr/bin/sbfspot/SBFspot.cfg’
Wed Aug 3 11:54:16 2022: INFO: Starting…
sunrise: 07:19
sunset : 17:32
Connecting to 00:80:25:34:D7:43 (1/10)
------ truncated and MACs edited
Connecting to 00:80:25:34:D7:43 (10/10)
Wed Aug 3 11:54:25 2022: CRITICAL: bthConnect() returned -1
Wed Aug 3 11:54:25 2022: INFO: Done.

From my desktop directly
Ugh formatting

D:\Users\User\Downloads\SBFspot>SBFspot -v -finq
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 Windows (LE) 32 bit with MySQL support
Commandline Args: -v -finq
Reading config 'SBFspot.cfg'
**Wed Aug  3 12:18:10 2022: INFO: Starting...**
sunrise: 07:19
sunset : 17:32
**Connecting to 00:80:25:34:D7:43 (1/10)**
Initialising...
SUSyID: 125 - SessionID: 904022468
SMA netID=01
Serial Nr: blanked
BT Signal=67.8%
----
----
etc etc
----
----
**Wed Aug  3 12:18:17 2022: INFO: Done.**

FYI coming in Home Assistant ver 2022.8

I am not sure how this is going to effect haos-sbfspot as yet, if at all.

This may or may not help the VMware player users

Useful for reseting dead Bluetooth. Although that was on debian 11 not haos

modprobe btusb
systemctl restart bluetooth 

This was on Debian VM so Bluetooth was starting dead on reboot… Don’t ask me how I found it I don’t know.
It was related to VMX config. below was originally set to false. So bluetooth was being ignore on Boot.
usb.restrictions.defaultAllow = "TRUE"
profiles/sap/server.c:sap_server_register() Sap driver initialization failed.

This fixed it

OK

I did make some progress. I actually got a connection on VM debian 11 HA docker/supervised. Latest version of Home assistant with the new Bluetooth integration
I did have a 4-5metre extension on my usb2 realtek adapter. The bluetooth is really flakey on the VM.
I had a variety of 10s 60s and a few longer duration connection attempts. Hard to say which was related to failed Bluetooth though. the adapter keeps falling off the VM.

There is a possibility that bluetoothctl scan on helps with a connection…
It should work on a NUC though. It worked fine without the extension across my desk once the flakey BT was sorted.

bash-5.1# ./usr/bin/sbfspot/SBFspot -v -finq
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 -finq
Reading config ‘/usr/bin/sbfspot/SBFspot.cfg’
Thu Aug 4 22:22:40 2022: INFO: Starting…
sunrise: 07:18
sunset : 17:33
Connecting to 00:80:87:23:65:56 (1/10)
Connecting to 00:80:87:23:65:56 (2/10)
Connecting to 00:80:87:23:65:56 (3/10)
Connecting to 00:80:87:23:65:56 (4/10)
Connecting to 00:80:87:23:65:56 (5/10)
Connecting to 00:80:87:23:65:56 (6/10)
Connecting to 00:80:87:23:65:56 (7/10)
Connecting to 00:80:87:23:65:56 (8/10)
Connecting to 00:80:87:23:65:56 (9/10)
Connecting to 00:80:87:23:65:56 (10/10)
Thu Aug 4 22:23:42 2022: CRITICAL: bthConnect() returned -1
Thu Aug 4 22:23:42 2022: INFO: Done.
bash-5.1# /uname -a
bash: /uname: No such file or directory
bash-5.1# uname -a
Linux a51a23d8-haos-sbfspot 5.10.0-16-amd64 #1 SMP Debian 5.10.127-2 (2022-07-23) x86_64 Linux
bash-5.1#


[22:19:32] INFO: [Host Bluetooth MAC Address] Controller 00:1A:7D:DA:71:13 has64vm [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 -ad1 -am0 -ae0 -mqtt
Reading config ‘/usr/bin/sbfspot/SBFspot.cfg’
Thu Aug 4 22:20:00 2022: INFO: Starting…
sunrise: 07:18
sunset : 17:33
Nothing to do… it’s dark. Use -finq to force inquiry.
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’
Thu Aug 4 22:20:02 2022: INFO: Starting…
sunrise: 07:18
sunset : 17:33
Connecting to 00:80:87:23:65:56 (1/10)
Initialising…
BT Signal=68.6%

Thu Aug 4 22:20:07 2022: INFO: Done.

Hiyas
Anyone here got ethernet connection to their router? I need to test new version before I merge them.
The details of how to connect are on the link.

HAOS-SBFspot Released 2022.8.3

It should update fine over previous version. (mine did).
I do suggest copying your previous config just in case.

There are a few additional config options to cater for Ethernet connections.
I haven’t had anyone test the Ethernet part as yet, but it should work for those with an ethernet connection to their inverter.

Yaml Example. 
Connection_Type: "Bluetooth"      <--- New. There is a radio button to change to Ethernet
BTAddress: ""
Password: "0000"
LocalBTAddress: "00:00:00:00:00:00" 
IP_Address: "255.255.255.255"    <--- New for Ethernet, can be Blank for Bluetooth

Capture

Let me know either way if the Ethernet version connects. Thanks.

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

HAOS-SBFspot Released 2022.8.4

Minor changes to Options.
bump MariaDB deps to latest

  • Added translations to increase the detail of options.
    Most of the info is also available in the Official SPFspot default configs. or
    repo /usr/bin/sbfspot default configs. if you need to find a default setting.

  • MQTT_enable is a defunct legacy option that has been removed.
    If you have it in yaml options it will produce a warning in the supervisor logs.
    It can be safely deleted from the yaml options config.

Ethernet remains untested as far as I know. It should work for ethernet or speedwire.

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

Hi,

I said I would get back with my experiences of trying to connect via a Synology VM.

I have added a 5m USB cable to my system but I am still unable to connect to the
SMA inverter. The Synology virtual machine appears to be working ok as far as the bluetooth dongle goes.

VM: Synology DSM7.1
Home Assistant 2022.8.7
Supervisor 2022.08.3
Operating System 8.5
Frontend 20220802.0 - latest

SbfSPOT 2022.8.4

I start up the VM and go to hardware and search for bluetooth.

BUSNUM: '002' DEVNAME: /dev/bus/usb/002/002 DEVNUM: '002' DEVPATH: /devices/pci0000:00/0000:00:04.0/usb2/2-1 DEVTYPE: usb_device DRIVER: usb ID_BUS: usb ID_MODEL: Bluetooth_Radio ID_MODEL_ENC: Bluetooth\x20Radio ID_MODEL_ID: '8771' ID_PATH: pci-0000:00:04.0-usb-0:1 ID_PATH_TAG: pci-0000_00_04_0-usb-0_1 ID_REVISION: '0200' ID_SERIAL: Realtek_Bluetooth_Radio_00E04C239987 ID_SERIAL_SHORT: 00E04C239987 ID_USB_INTERFACES: ':e00101:' ID_VENDOR: Realtek ID_VENDOR_ENC: Realtek ID_VENDOR_ID: 0bda MAJOR: '189' MINOR: '129' PRODUCT: bda/8771/200 SUBSYSTEM: usb TYPE: 224/1/1 USEC_INITIALIZED: '2899765'

This is the log from sbfSPOT

s6-rc: info: service s6rc-oneshot-runner: starting

s6-rc: info: service s6rc-oneshot-runner successfully started

s6-rc: info: service fix-attrs: starting

s6-rc: info: service fix-attrs successfully started

s6-rc: info: service legacy-cont-init: starting

s6-rc: info: service legacy-cont-init successfully started

s6-rc: info: service legacy-services: starting

services-up: info: copying legacy longrun sbfspot (no readiness notification)

s6-rc: info: service legacy-services successfully started

[17:09:03] INFO:

[17:09:03] INFO: Linux 5.15.60 #1 SMP Tue Aug 16 12:26:36 UTC 2022 x86_64

[17:09:03] INFO:

[17:09:03] INFO:

[17:09:03] INFO: [Host Bluetooth MAC Address] Controller 00:E0:4C:9E:CF:03 homeassistant [default]

[17:09:03] INFO:

[17:09:06] INFO:

[17:09:06] INFO:

[17:09:06] INFO: || Generating Bluetooth Configs ||

[17:09:06] INFO: || /usr/bin/sbfspot/SBFspot.cfg ||

[17:09:06] INFO: || /usr/bin/sbfspot/SBFspotUpload.cfg ||

[17:09:06] INFO:

[17:09:06] INFO: [Starting SBFspotUpload]

[17:09:06] INFO: [Starting cron in foreground]

SBFspot V3.9.5

Yet another tool to read power production of SMA solar inverters

(c) 2012-2022, SBF (GitHub - SBFspot/SBFspot: Yet another tool to read power production of SMA® solar/battery inverters)

Compiled for Linux (LE) 64 bit with MySQL support

Commandline Args: -v -ad0 -am0 -mqtt -finq

Reading config ‘/usr/bin/sbfspot/SBFspot.cfg’

Sun Aug 28 17:09:36 2022: INFO: Starting…

sunrise: 06:15

sunset : 17:33

Connecting to 00:80:25:15:44:C0 (1/10)

Connecting to 00:80:25:15:44:C0 (2/10)

Connecting to 00:80:25:15:44:C0 (3/10)

Connecting to 00:80:25:15:44:C0 (4/10)

Connecting to 00:80:25:15:44:C0 (5/10)

Connecting to 00:80:25:15:44:C0 (6/10)

Connecting to 00:80:25:15:44:C0 (7/10)

Connecting to 00:80:25:15:44:C0 (8/10)

Connecting to 00:80:25:15:44:C0 (9/10)

Connecting to 00:80:25:15:44:C0 (10/10)

Sun Aug 28 17:09:45 2022: CRITICAL: bthConnect() returned -1

Sun Aug 28 17:09:45 2022: INFO: Done.

SBFspot V3.9.5

Yet another tool to read power production of SMA solar inverters

(c) 2012-2022, SBF (GitHub - SBFspot/SBFspot: Yet another tool to read power production of SMA® solar/battery inverters)

Compiled for Linux (LE) 64 bit with MySQL support

Commandline Args: -v -ad1 -am0 -ae0 -mqtt

Reading config ‘/usr/bin/sbfspot/SBFspot.cfg’

Sun Aug 28 17:10:00 2022: INFO: Starting…

SBFspotUploadDaemon Version 3.0.1

Loglevel=2

LogDir=/data/sbfspot/log/

sunrise: 06:15

sunset : 17:33

Connecting to 00:80:25:15:44:C0 (1/10)

Connecting to 00:80:25:15:44:C0 (2/10)

Connecting to 00:80:25:15:44:C0 (3/10)

Connecting to 00:80:25:15:44:C0 (4/10)

Connecting to 00:80:25:15:44:C0 (5/10)

Connecting to 00:80:25:15:44:C0 (6/10)

Connecting to 00:80:25:15:44:C0 (7/10)

Connecting to 00:80:25:15:44:C0 (8/10)

Connecting to 00:80:25:15:44:C0 (9/10)

Connecting to 00:80:25:15:44:C0 (10/10)

Sun Aug 28 17:10:09 2022: CRITICAL: bthConnect() returned -1

Sun Aug 28 17:10:09 2022: INFO: Done.

[17:10:45] INFO: [SBFspot Upload Log Latest] [17:10:06.592] INFO: Starting Daemon…

Obviously no connection

Finally YAML setup

Connection_Type: Bluetooth

BTAddress: 00:80:25:15:44:C0

Password: “!secret SMA-Home-User-Password”

LocalBTAddress: “00:00:00:00:00:00”

IP_Address: 255.255.255.255

MIS_Enabled: 0

Plantname: Home-SMA

OutputPath: /data/sbfspot/%Y

OutputPathEvents: /data/sbfspot/%Y/events

Latitude: -30.5036

Longitude: 151.6523

CalculateMissingSpotValues: 1

DateTimeFormat: “%d/%m/%Y %H:%M:%S”

DateFormat: “%d/%m/%Y”

DecimalPoint: comma

TimeFormat: “%H:%M:%S”

SynchTime: 0

SynchTimeLow: 1

SynchTimeHigh: 3600

SunRSOffset: 900

Locale: en-US

Timezone: Australia/Sydney

BTConnectRetries: 10

CSV_Export: 0

CSV_ExtendedHeader: 1

CSV_Header: 1

CSV_SaveZeroPower: 1

CSV_Delimiter: semicolon

CSV_Spot_TimeSource: Inverter

CSV_Spot_WebboxHeader: 0

SQL_Database: SBFspot

SQL_Hostname: core-mariadb

SQL_Port: “3306”

SQL_Username: “!secret sbfspot-mariadb-user”

SQL_Password: “!secret sbfspot-mariadb-password”

MQTT_Publisher: /usr/bin/mosquitto_pub

MQTT_Host: core-mosquitto

MQTT_Port: “1883”

MQTT_Topic: homeassistant/sbfspot_{plantname}/sbfspot_{serial}

MQTT_ItemFormat: “"{key}": {value}”

MQTT_ItemDelimiter: comma

MQTT_PublisherArgs: “!secret sbfspot-mqtt-publisherargs”

MQTT_Data: >-

Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2

PVoutput_SID: “2100334356:92105”

PVoutput_Key: “!secret PVoutput_Key_API”

LogDir: /data/sbfspot/log/

LogLevel: info

MQTT_ENABLE: “1”

I tried it with the local BT address both filled in and blank. Same result. The bluetooth connection is also showing up in the bluetooth configuration in Home Assistant as “hci0”

Still working on my Pi.

Laurie

Yeah its pretty flakey on a VM I gotta say. I set up 2 HAOS VMs and a Deb/Docker/Supervisor using VMware player.

I can’t get either of the HAOS VMs to connect to anything bluetooth really. I can scan and trust and connect, but pairing with Bluetoothctl is pretty fruitless.

The Debian connects sometimes… mostly depending on when I put the dongle in, it doesn’t handle reboots very well. Once it connects it’s pretty consistent. Distance from my desktop to my inverter is probably 8-10 metres. A usb extension(4 or 5 meter one) didn’t improve things much.

That’s with el cheapo mini dongles that connect otherwise. Connects fine if I run SBPspot directly from windows with no extension.

On the upside the deb/docker/supervisor is good for testing the addon and doing upgrades…

The docker vm seems to handle it best if I pop the dongle in before the OS loads…

Ooohh I also usually don’t configure the bluetooth integration. It just sits waiting in auto discovery

That option has been removed. It wasn’t being used, it just throws warnings to the supervisor log.

It can be removed from options.

Thanks for building this addon, it’s something I have been looking for a while now! I have been using PV Bean Counter for a few years now running on a Win10 and uploading to PV Output. This works OK but from time to time it needs massaging to get it back to life.

I tried setting this addon up a few months ago but got busy and never really got it working. Trying again now that I have a bit more time but no matter what I do I get the error below. Even the default config throws up the error. I have tried entering the config parameters directly and also using the secrets file but get the same error. I have updated to the latest build 2022.9.1.

I’m not sure how to get setup…

Have you restarted HA since saving the secrets?

That error message is the worst, not very helpful when you can’t read it all.

Would you mind posting the yaml version (with sensitive stuff removed)?

That’s my yaml config… ignore the extended sensor, this is my test version config.

Connection_Type: Bluetooth
Sensors_HA: "No"
BTAddress: "!secret BTAddress"
Password: "!secret SBFpassword"
LocalBTAddress: "!secret LocalBTAddress"
IP_Address: 255.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,PAC2,PAC3,UAC1,UAC2,UAC3,IAC1,IAC2,IAC3,OperTm,FeedTm,PDCTot,PDC1,PDC2,PDC,UDC1,UDC2,UDC,IDC1,IDC2,IDC,BTSignal,InvWakeupTm,InvSleepTm,MeteringWOut,MeteringWIn,MeteringWTot
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info

Yes I have restarted HA after setting the secret file. I also tried removing the add-on and re-installing but the same error.
My config is basically the default, I’m using BT config and all the settings in the secrets file minus the LocalBTAddress.

Connection_Type: Bluetooth
Sensors_HA: "No"
BTAddress: "!secret BTAddress"
Password: "!secret SBFpassword"
LocalBTAddress: "!secret LocalBTAddress"
IP_Address: 255.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: >-
  Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvClass,InvType,InvTemperature,OperTm,FeedTm,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info

Check if that one starts

Connection_Type: Bluetooth
Sensors_HA: "No"
BTAddress: "!secret BTAddress"
Password: "!secret SBFpassword"
LocalBTAddress: "00:00:00:00:00:00"
IP_Address: 255.255.255.255
Plantname: "!secret SBFplantname"
Latitude: "!secret home_lat"
Longitude: "50.80"
Timezone: "4.33"
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: >-
  Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvSwVer,InvClass,InvType,InvTemperature,OperTm,FeedTm,EToday,ETotal,GridFreq,PACTot,PAC1,UAC1,IAC1,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info

same problem I’m afraid :frowning: