SBFspot Bluetooth homeassistant addon

When you scan using Bluetoothctl is that from the hass vm? Can you run the official sbfspot and get a connection? I’m not going to be much help with a vm sorry. Do you have other Bluetooth devices working under the hass vm? Sort of sounds like it might be not getting passed through, but I’m just guessing.

Is it a 64bit Linux vm for the hass vm?

That bluetoothctl scan is from the hass vm and yeah it’s 64-bit linux. I don’t have any other bluetooth devices connected at the moment but I’ve definitely had it working before.

I can’t really get the machine that the vm is running on any closer to the SMA but I might try and get sbfspot running on my laptop and see if it connects closer to the inverter.

Thanks anyway mate.

Not sure testing on a second laptop will make much difference. If you had sunny Explorer working…

A third vm with official sbfspot installed might be a better test. I think the bthconnect -1 is an error prior to password exchange, so it won’t be a password problem.

So it’s more likely a range thing. Could be worth trying without the extension perhaps there is abit of power drop on the extension. Got a powered usb hub you could try with?

Since the elapsed time between start of SBFspot and error exit is only about 10 sec it looks like some other process is blocking your BT device.

1 Like

By coincidence I have a BT issue on my system:

Sun Jul  3 12:50:01 2022: INFO: Starting...
sunrise: 05:36
sunset : 21:57
Connecting to 00:80:25:15:XX:XX (1/10)
Connecting to 00:80:25:15:XX:XX (2/10)
....
Connecting to 00:80:25:15:XX:XX (9/10)
Connecting to 00:80:25:15:XX:XX (10/10)
Sun Jul  3 12:51:01 2022: CRITICAL: bthConnect() returned -1
Sun Jul  3 12:51:01 2022: INFO: Done.

As you can see, these 10 connection attempts take 1 minute (5 sec timeout + 1 sec waiting)
In your case there is no timeout because of the unavailability of your BT device on the VM

1 Like

Have the same problem.
Moved the PI closer to the inverter didn’t solve the problem.
Also on my android device i got an app called: Oxly Solar
This gives me two floors away a connection with bluetooth.

Yet another tool to read power production of SMA solar inverters
(c) 2012-2022, SBF (https://github.com/SBFspot/SBFspot)
Compiled for Linux (LE) 32 bit with MySQL support
Commandline Args: -v -ad1 -am0 -ae0 -mqtt
Reading config ‘/etc/sbfspot/SBFspot.cfg’
Tue Jul 5 14:15:00 2022: INFO: Starting…
[SBFspot Upload Log Latest]
tail: can’t open ‘/data/sbfspot/log/SBFspotUpload20220705.log’: No such file or directory
tail: no files
Connecting to 00:80:25:15:51:0C (1/10)
Connecting to 00:80:25:15:51:0C (2/10)
Connecting to 00:80:25:15:51:0C (3/10)
Connecting to 00:80:25:15:51:0C (4/10)
Connecting to 00:80:25:15:51:0C (5/10)
Connecting to 00:80:25:15:51:0C (6/10)
Connecting to 00:80:25:15:51:0C (7/10)
Connecting to 00:80:25:15:51:0C (8/10)
Connecting to 00:80:25:15:51:0C (9/10)
Connecting to 00:80:25:15:51:0C (10/10)
Tue Jul 5 14:16:01 2022: CRITICAL: bthConnect() returned -1
Tue Jul 5 14:16:01 2022: INFO: Done.

Your issue is different to nug, Fritz. As Sbf pointed out nug was timing out in 10 seconds. Your timeout is taking the expected 1 minute, so your Bluetooth isn’t being blocked

Have you had it connect with your hardware setup ever? I assume it’s a pi? What sort of distance are we talking?

hi, I am totally new to this. I am just configuring HA to run in a VM on a Synology NAS.

If I can get a bluetooth dongle to be recognized (shouldn’t be a problem) will/should this add-on then work to access data as I am not using a pi or windows? Sorry if this is a dumb question.

Probably…

In saying that if you have Ethernet connection available on your inverter that’s probably a preferable connection method. My inverter is old enough that only a Bluetooth connection was originally installed, hence sbfspot.

There are other add-ons(or actually integrations I think) for IP connections, which don’t need the additional requirements of this addon.

Otherwise yes in theory it should work… It’s a Linux base container.

Hello HasQT,

I have connection with an android phone with Oxley solar app. I also have an sunnybeam both get connections as far as 3 floorlevels.
With the Pi i with HASS installed i never had a connection and i positioned the Pi several meters away from the inverter.

I restore a backup and do a reinstall of your version of sbfspot.

@FritsOv have you tried without the Sunnybeam being turned on?

Only other suggestion would be to try a standard install of sbfspot on a spare sd card.

I don’t think there is a debug flag, that helps troubleshoot the errors prior to connection.

It is turned off. removed system form the sunnybeam.

Just a question. in mariaDB there is in the read me:
username: sbfspot (LowerCase Usere) ←
Forgive me but quite new to this all.
Is it nessesary to add (LowerCase User) in the config file or is it just a remark you made to ensure that some one will use lowercase for the name?

No need to add (lowercase user). It is a remark to ensure the username matches in the mariadb config and sbfspot config.

I guess it is working:
I got connection to pvoutput.org and it fills de database with data.
Also i got

In MQQT:
1657446668: New client connected from 192.168.2.200:54626 as auto-BC3FE32F-F087-4DA0-97A4-B8C2CF3ECFAE (p2, c1, k60, u’XXXXXXXXX’).
1657446669: Client auto-BC3FE32F-F087-4DA0-97A4-B8C2CF3ECFAE disconnected.

IN HAOSBFspot:
Current Inverter Time: 10/07/2022 13:00:12
Inverter Wake-Up Time: 10/07/2022 13:00:11
Inverter Sleep Time : 10/07/2022 13:00:12
MQTT: Publishing (homeassistant/sbfspot_{plantname}/sbfspot_{serial}) “Timestamp”: “10/07/2022 13:00:12”,“SunRise”: “10/07/2022 05:29:00”,“SunSet”: “10/07/2022 21:53:00”,“InvSerial”: XXXXXXXXXX,“InvName”: “SN: XXXXXXXXX”,“InvTime”: “10/07/2022 13:00:12”,“InvStatus”: “Ok”,“InvTemperature”: 0.000,“InvGridRelay”: “?”,“EToday”: 2.339,“ETotal”: 37388.782,“GridFreq”: 49.970,“PACTot”: 287.000,“UDC1”: 355.000,“UDC2”: 0.000,“IDC1”: 0.960,“IDC2”: 0.000,“PDC1”: 340.000,“PDC2”: 0.000
Client (null) sending CONNECT
Client (null) received CONNACK (0)
Client (null) sending PUBLISH (d0, q0, r0, m1, ‘homeassistant/sbfspot_XXXXXXXXXXX/sbfspot_XXXXXXXXX’, … (409 bytes))
Client (null) sending DISCONNECT

but in MQQT is still an connection i cant adress:

1657447904: New connection from 172.30.32.2:41790 on port 1883.
1657447904: Client closed its connection.

Now its time for the sensors…

Thank you HasQT for your support! and for your work! i finaly think that i can remove some devices by porting to HAS.
thanks to your effort.

Nice, what solved the disconnect issue? Can you have sbfspot and the Sunnybeam running together?

172.30.32.2 is an internal mqtt connection. Could be another addon you have running. (172.30.32.2 is my ssh addon container address as an example).

ahhhh then it is the SSH

The Sunnybeam is disconected for a long time. If you want to i can check if it is possible to get more than one connection. i could try it before this week if you want to. I have also on my android device an oxley app installed. i guess have to disable the pvoutput on that one otherwise i get dual input.

[edit] just checkt with latest bit of sun available ;). HaoSBFspot uploads the correct data while my android app is loged in into the inverter… will try to setup sunnybeam next week. could be poll interval coincident

Could you help me out with the sensors. I get an error on the sensors in your example.
i changed them in the yaml file to
mqtt:
sensor:
etc.
instead of platform: mqtt
But no sensor is shown in the list.
Could it be that if i goto sevices->integration MQTT broker is not configured?

That is the new format for mqtt sensors. You will need to manually change the inverter_name and Serial_no to match your system.

(ps: I have a separate package file for mine. So depending on where you are saving, the format may not need the initial mqtt: if it already exists from another instance )

mqtt:
    sensor:
        
      - name: "SMA Sunny Boy"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.InvName }}'
        icon: "mdi:flash"
        
        
      - name: "SMA TimeStamp"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.Timestamp }}'
        icon: "mdi:clock"
        
                
      - name: "SMA Sun Rise"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: "{{ value_json.SunRise }}"
        icon: "mdi:weather-sunny"
        
        
      - name: "SMA Sun Set"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.SunSet }}'
        icon: "mdi:weather-sunset-down"
        
        
      - name: "SMA Running Temp"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.InvTemperature }}'
        unit_of_measurement: "°C"
        icon: "mdi:coolant-temperature"
        device_class: temperature
        
        
      - name: "SMA Status"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.InvStatus }}'
        icon: "mdi:flash"
        
        
      - name: "SMA Grid Relay"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.InvGridRelay }}'
        icon: "mdi:electric-switch"
        
        
      - name: "SMA Daily Energy"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.EToday }}'
        unit_of_measurement: "kWh"
        icon: "mdi:solar-power"
        device_class: energy
        state_class: total_increasing
        
        
      - name: "SMA Total Energy"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.ETotal }}'
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing
        
        
      - name: "SMA Power AC"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.PACTot }}'
        unit_of_measurement: "W"
        icon: "mdi:flash"
        device_class: power
        state_class: measurement
        
        
      - name: "SMA DC Array"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.UDC1 }}'
        unit_of_measurement: "Volts"
        icon: "mdi:solar-panel-large"
        device_class: voltage
        
        
      - name: "SMA DC Array2"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.UDC2 }}'
        unit_of_measurement: "Volts"
        icon: "mdi:solar-panel"
        device_class: voltage
        
        
      - name: "SMA DC Array"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.IDC1 }}'
        unit_of_measurement: "Amps"
        icon: "mdi:solar-panel-large"
        device_class: current
        
        
      - name: "SMA DC Array2"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.IDC2 }}'
        unit_of_measurement: "Amps"
        icon: "mdi:solar-panel"
        device_class: current
        
        
      - name: "SMA DC Array"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.PDC1 }}'
        unit_of_measurement: "Watts"
        icon: "mdi:solar-panel-large"
        device_class: power
        
        
      - name: "SMA DC Array2"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.PDC2 }}'
        unit_of_measurement: "Watts"
        icon: "mdi:solar-panel"
        device_class: power
        
        
      - name: "SMA Grid Frequency"
        state_topic: "homeassistant/sbfspot_Inverter_name/sbfspot_Serial_no"
        value_template: '{{ value_json.GridFreq }}'
        unit_of_measurement: "Hz"
        icon: "mdi:transmission-tower"
        device_class: frequency   

Hello HasQT,

Just tested the distance with a Pi 3b+. three floors in a straight line between inverter and pi will connect to the bluetooth. thats aprox 7 meters.

Thank you for the sensors.

Got the sensors figured out… took me a while to see where the problem was.

2 Likes

HI,

Not hugely technical but trying to get a USB Bluetooth Dongle got work in a Synology VM of HA 2022.7.4. I have tried it in a VM of Windows 10 and Sunny Explorer - works perfect.

Can anyone tell how I can see if it is recognized by HA before I go searching for issues with the SBFSpot?

Try setting up the BT tracker and see if it pops up in known_devices.yaml

It might be listed in the hardware settings…