SBFspot Bluetooth homeassistant addon

I would have a different approach maybe just using Mqtt just for my own use of the data. I can well imagine that most of those who use it with and for HA only do it for themselves so that they don’t always have to go online via any manufacturer apps, just to check and to have an overview.

Hello, had to find the following problem.
Whenever I have to restart the system after an installation or a change or after an update or if the system runs itself, I have to restart the integration SBFspot so that it runs and displays values ​​again.

Yes it takes a few minutes during the day to send the new data.
At night the communication to the inverter is shut off so it will sit on unknown until the addon is restarted, or when the inverter wakes up in the morning.

You could make an automation to restart the addon following a restart of home assistant.

Unless you know how to write a python script to track the websocket restarts inside the container. I haven’t managed to do that as yet.

I managed to add 1 inverter to pvoutput and back to HA.
it was not clear in the energy dashbord were to add them… it’s in “foreseen production”

as pvoutput donator you can add several inverters and the production can be summed.
You need to look at data aggregation : Data Aggregation — PVOutput documentation
Could be a solution.

But atm for MultiINV-SBFspot i have a message preventing installation :
’ not compatible with pi cpu’ (sorry for my bad translation … i have HA in french ^^)

In the addon store if you click on check for updates you should be able to install now for your pi.
Capture



I put my sensors in

retour à la grille (return to grid)
and/or
production solaire (solar production)

foreseen production (next production?) is that for solar forecast(prévisions solaires?) perhaps?

You can put the MQTT data directly into the energy dashboard or you can use the PVoutput data. That is upto you.
SMA Energy Lifetime is what I usually put in Solar production.

Although with two inverters you would need to make a template sensor to Sum both MQTT sensors from each inverter.

{{ states('sensor.sma_energy_lifetime) + states('sensor.sma_energy_lifetime_2') }}

The data from PVoutput should already be an aggregate of both inverters(I think, was waiting for you to tell me actually).

Regarding the donation aggregation. You would need to be uploading the two inverters separately. SBFspotUpload (its combined in MariaDB) should be already sending them up to PVoutput in aggregate(I think)

This will poll your inverter to update your sensors when homeassistant restarts when it is dark.
This is how I would set up said automation.

First you need to use puttygen to make a public private key
puttygen

the Public key, (which is the blue highlighted bit)
gets pasted into a file called `id_rsa.pub’ or whatever you want to call it.
for this example its ‘id_rsa_ha.pub

The Private key you need to go to ‘Conversions > export OpenSSH Key
That gets pasted into a file called ‘id_rsa_ha

They get put in config/.shh/ note the fullstop .ssh for hidden directory.

You can create known_hosts file at this time too.

ConfigSSH

You need to change the permissions on the id_rsa_ha file via the console (Terminal addons -la)
chmod 600 id_rsa_ha




If you don’t change the permissions you will get an error.
Capture


Once all that is done you can test the command in Terminal and SSH addon( the official one, not the community one).

The command is

ssh [email protected] -o UserKnownHostsFile=/config/.ssh/known_hosts -i /config/.ssh/id_rsa_ha 'docker exec addon_a51a23d8_multiinv-sbfspot /SBFspot -v -finq -mqtt'

You need to change the hostname(haosVM.local) to your hostname(eg. homeassistant.local)
You will also need to change addon_a51a23d8_multiinv-sbfspot to the other addon if that’s the addon you are using. eg. addon_a51a23d8_haos-sbfspot

for example
ssh [email protected] -o UserKnownHostsFile=/config/.ssh/known_hosts -i /config/.ssh/id_rsa_ha 'docker exec addon_a51a23d8_haos-sbfspot /SBFspot -v -finq -mqtt'

don’t forget the quotes wrapping the docker exec part.


Once it works you can make a shell_command in your configuration.yaml

shell_command:
  # poll SBFspot Inverter with -finq
  sbfpot_finq: ssh [email protected] -o UserKnownHostsFile=/config/.ssh/known_hosts -i /config/.ssh/id_rsa_ha 'docker exec addon_a51a23d8_multiinv-sbfspot /SBFspot -v -finq -mqtt'

Then you can make your automation

alias: SBFspot Poll nighttime
description: SBFspot poll inverter on HA restarts outside of daytime hours.
trigger:
  - platform: homeassistant
    event: start
condition:
  - condition: sun
    before: sunrise
    after: sunset
  - condition: state
    entity_id: binary_sensor.multiinv_sbfspot_running   ## Enable in supervisor integration
    state: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 0
action:
  - service: shell_command.sbfpot_finq   ## This was made above
    data: {}
mode: single


The binary sensor comes from Supervisor Integration in Devices and Services
You need to enable the binary sensor
Capture


Hopefully I will figure out websockets one day and make the automation redundant. This Automation is significantly easier to setup than websockets so far however.

I suppose you could also use the shell_command to poll your inverter more often…




Thanks to Mike and if you need further info

for info I’ve also posted the ‘multi inverters’ on SBF spot forum and here’s the reply.
I’ve tryed updating that parameter … but I see no difference.

Set MIS_enabled=1 in SBFspot.cfg

I then installed MultiINV-SBFspot. verry easy. Thx again !
I will following the logs for a few days to check if all numbers match

Beginner question I guess… but where do you see MQTT sensors ?

I don’t think you actually need MIS enabled. You would if you were running SBFspot directly using multiple BT inverters… But it’s two separate addons so shouldn’t be being used…
(I Think) it’s one of those things I can’t test.

Edit: Hmm that’s interesting about the BT network. That seems to imply only one inverter would need to be polled for data from all inverters. You would have to check the numbers to confirm that. Perhaps multiple addons are not needed and just one BT address is required.

MQTT sensors should show up in the MQTT integration in settings > devices and services > MQTT integration.

That’s assuming you have run the create sensors once to create them in the HAOS-Sbfspot or MultiINV-SBFspot addons.

For sure, using Multi and MIS option are two different solution.
I see other people looking for the same answer… I’ll dig a little bit.

Thx for the MQTT explaination… It’s now working.

Still have to do :

{{ states('sensor.sma_energy_lifetime) + states('sensor.sma_energy_lifetime_2') }}

where do I need to add this sensor sum ?

By any chances … are you as good with daikin heat pump or Domintell domotic that you are with SMA inverters ?
:stuck_out_tongue:

1 Like

Hi there, I used the SBFspot BT HA addon for a while with pleasure to get data from my SB2000HF in HA. A month ago I updated my PV-system (from 2011) on my house and reused the SB2000 and old PV panels in a bit more remote location: too far away from my PI4 for a direct BT connection, but within WIFI range. Would it be possible, or better perhaps already experience with the new BT proxy feature in HA (based on ESP32) to bridge this connection gap? I am a user, with very little programming experience… so may need a bit of explanation if this turns out to be a stupid question…

@WI001

Not possible to use proxy as far as I know.
The inverters don’t use Bluetooth low energy (ble).

Ble devices just automatically send out their data, alot like Rf devices. So the proxy just grabs that floating data and passes it on.

The inverters need to be commanded to send data. SBFspot logs into the inverter and commands that the data be sent, every 5 minutes.

What may be possible is to put SBFspot onto a esp32. I think if you look back at the history of SBFspot it was originally based on an arduino project.

It’s not something I have dug into much and outside the scope of this addon though.

Edit:

This seems recent. Not sure if it works or not.

Actually looks like sillyfrogs is more advanced.

@lebeck

You would need to make a template sensor which uses that value_template.

You can also use dev tools > template to check it is providing the correct number.

template:
   - sensor:
        - name: Combined Inverter data  ## You can make up your name of choice
          unique_id: sbfspot_combined_id_128123483  ## this can be any sort of unique value
          device_class: energy
          state_class: total_increasing
          icon: mdi:solar
          state: >
             {{ states('sensor.sma_energy_lifetime) + states('sensor.sma_energy_lifetime_2') }}
     

You probably need to provide a default value also, so that HA knows what to do with unavailable data.

{{ states('sensor.sma_energy_lifetime) | float(none) + states('sensor.sma_energy_lifetime_2') | float(none) }}

You will need to check if that works on

Capture

Indeed, that way not all your inverters need to be in BT range with the connecting host. Each device needs to “see” another device in the same network (= with same netID)

1 Like

Well it seems like it should work out of the box with the addon then.
Might be just a case of not turning on the option correctly.

haos-sbfspot repo issue 42

If I understood… the problem is with sensor creation for multi bluetooth inverter.

Even if not working yet… Huge thx to HasQT sbf01 and Sven for ongoing work and cross comunication
What a great comunity !!

Yeah seems to be.

If you run each inverter through the sensor creation in HAOS-SBFspot. You will get sensors for each inverter. Do this with MIS_enabled: 0

Once the sensors are created enable MIS and set sensors create to No.

It should then pick up sensors from both inverters in MQTT.

PVoutput:
Needs separate accounts (unless you donate, not sure how that works)

So you would put for inverters.

SerialnumINV1:acc1, serialnumINV2:acc2

Was already done :

  • Having HAOS-SBFspot & MultiINV-SBFspot Running
  • activated Create or purge Sensors for MQTT integration to : CREATE

Updates :
1 - set back sensor creation to NO
2 - MIS to 1 (Multi Inverter System in the advanced option)
3 - deactivate MultiINV-SBFspot

and I see my 2 inverters in the logs.
I guess the final correction will be a change in HTML form to allow entering a number of sensor instances to create.

I guess this will help other people in the same case :slight_smile:

Hmm I just join HA discord chat :slight_smile:

Next step

  • try to manually create sensors and create dashboards
    already tryed in Dev Tools > Model :
    {{ states(‘sensor.sma_energy_daily’) + states(‘sensor.sma_energy_daily_2’) }}

but the outcome is a char concat (state: 0.3680.368) instead of a int sum ( should be state: 0,736)
I still haven’t figured where to put them… File editor > configuration.yaml ?

Yataaaaaaaaa :slight_smile:

You need to add the float to convert from string to float. I am not sure if that is handling “Unknowns”
correctly though. You want unknown or none when either figure is not a float.

I couldn’t get to test properly in my > dev tools > template

{{ states('sensor.sma_energy_lifetime') | float(none) + states('sensor.sma_energy_lifetime_2') | float(none) }}

Once it works in dev tools > template

You would add it to configuration.yaml as a template sensor.

template:
   - sensor:
        - name: Combined Inverter data  ## You can make up your name of choice
          unique_id: sbfspot_combined_id_128123483  ## this can be any sort of unique value
          device_class: energy
          state_class: total_increasing
          icon: mdi:solar
          state: >
             {{ states('sensor.sma_energy_lifetime') | float(none) + states('sensor.sma_energy_lifetime_2') | float(none) }}
     

Edit:

Actually have you tried just adding the individual inverters separately to the energy dashboard. You wouldn’t need the template that way.

Thanks for the help and explanation(!) and for pointing to the Sillyfrog fork. I missed that one. I’ll try it soon.

@WI001

I couldn’t get those two I linked earlier to connect, I didn’t try super hard though. One was arduino and one was platformio.

These two work in arduino.
You have to set the appropriate files up with your info. BTaddress and Password and SSID and Password. Also make sure partitions are setup in arduino, the default partitions are too small for the Lupo one.

the lupo one would be reasonable for testing your range issue, as you should be able to have the esp32 in bt range to your inverter and then view the webview over wifi.

I didn’t find a mqtt one… although mqtt shouldn’t be toooo hard to add in…

This one has a nice little webview. You might need to set your partions in arduino.
https://github.com/Lupo135/ESP32_SMA-Inverter

This one compiles easier for whatever reason, although only has serial monitor.
https://github.com/darrylb123/ESP32_SMA-Inverter