SBFspot Bluetooth homeassistant addon

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

Hi HasQT,

Installed Home Assistant a few days ago and my first mission was to install SBFspot to upload the SMA data to PVoutput. I am really just a user and have not much knowledge about programming, debugging etc. And it turned out that i also cannot read well.

After 2 days of tinkering and reading this thread i finally got my installation working! Installation of SBFspot, MariaDB, Mosquitto Broker and phpMyAdmin turned out to be straight forward. SBFspot connected to the SMA straight away, but the data would not upload.

Turned out that i did not fill in the System ID and API correctly. Sid 012345679:12345 Api
37377fake37373fake4847fake12.

Thanks for making SBFspot!

1 Like

Congrats and welcome. fyi I only made the addon, the SBFspot team deserve all the credit for SBFspot.

In saying that I copied alot of the addon because I can’t program either :slight_smile:

Hello, you don’t really need the MariaDB and phpMyAdmin as long as you only want to use the data for yourself.
You only need the api and the fake number if you don’t want to publish your data.

Considering they want to upload to pvoutput they need mariadb and myphpadmin.

Surely then they need it as it says in the description of SBFspot.

Hi there, I’m fairly new to HA and wanted to add on old SMA inverter to a local HA installation (being close to the inverter). I looked at your solution and tried it out. Installed as suggested (apart from PVoutput) and have it running :slightly_smiling_face: Yet I’m confused about the data flow in your set-up and options. The main reason is that I also have a remote home automation system that I’m using as a master (integrating all measurements). This master system is already running a MQTT broker. Would it be possible, rather than using your proposed data flow, to simply send the inverter data straight to the broker on my master automation system? Or perhaps there are other Addons or Integrations that I missed in my search?

You can point to a different broker in the setup if you want.

You would have to setup the mqtt sensors on you master home automation system, however you normally do that, assuming it’s not homeassistant.

The automatic sensors only work with the Homeassistant mqtt integration discovery. You can skip the automatic sensors and manually create them if you prefer. Which is how they were originally setup.

You could just run SBFspot directly on a machine locally if you have only setup HA for that specific purpose.

Thank for the quick reply :slight_smile: OK, I missed that in the setup as I saw no obvious possibility to provide an IP address and port. Which entry should I use for this?
By the way, the master is not a HomeAssistant version so I indeed would have to setup the sensors myself, which is fine.

There is a slider button at the bottom of the options.

Show unused optional configuration options

That will display the whole list of options.

Aha :slight_smile: Will give it a go…

Hi,

Firstly, thanks for a great add-on and wrapping SBFspot (which I already know).

New-ish HA user here. I am running it on Supervised on “unsupported” Ubuntu 22.04.1 LTS until now without issue.

Have a bt enabled SMA SB3800 inverter and previously older SBFspot running on this host uploading to PVOutput (using CSV files not SQL). So I know bluetooth is all good, most config settings etc.

I have installed MQTT Add-on and configured Broker integration, and setup my secrets.yaml entries, but I can’t seem to get the sensors created for some reason. Looks like it can’t talk to MQTT ?

Any thoughts on troubleshooting this ? (have stopped other instance of SBFSpot during this of course)

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)
[22:55:57] INFO:
[22:55:57] INFO: Linux 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64
[22:55:57] INFO:
s6-rc: info: service legacy-services successfully started
| INITIALISE MQTT SENSOR CREATION |
curl: (7) Couldn’t connect to server
[22:55:57] ERROR: Something went wrong contacting the API
null
core-mosquitto
null
null
null
[22:55:57] INFO: ===================================
[22:55:57] INFO: Setup failed to create HA Sensors
[22:55:57] INFO: ===================================
jq: error: Could not open file /data/device: No such file or directory
[12:55:57] WARNING: Halt add-on with exit code 2
s6-rc: info: service legacy-services: stopping

Try a host reboot to start.

Looks like it isn’t finding your mqtt broker. That should be core-mosquitto on a default setup. Perhaps it hasn’t been picked up in the dns yet.

The broker address in sbfspot options should match the address in the mqtt integration.

Hi HasQT,

Yes, I assumed that was the issue from interpretation of the logs.

I did try a host restart with no difference.
MQTT is of course running without error.
How is “core-mosquitto” resolved normally ? Remember I am not on HAOS.
I will check the address in the options. Thanks.
Cheers
Ian

Does it work and post info to mqtt when you don’t try to create the sensors? As in option “no” on create sensors.

HAOS or supervised shouldn’t be of any particular relevance generally, they would both use core-mosquitto on a default install of mqtt addon and integration.

The hostname for the mqtt addon should be visible on the info page of that addon, and should be matching in the integration.

You could try the IP address as a test. Supervisor handles the name resolution normally.

Working nicely with Ethernet connection to Inverter and MQTT. Could I suggest you take bluetooth out of the name. It threw me off for 2 years!

It didn’t have ethernet two years ago. That was a recent addition. There is also an SMA integration for Ethernet connections.
I can’t test the Ethernet version so I don’t particularly promote it.

As to the issue you posted on github. (issue #54)
The sensors don’t always refresh.

The connection to the inverter is shut off overnight and restarting HA does not restart addons. The addon does a finq when it starts or restarts, which will update the sensors overnight. They will update at the next 5min timestamp during the day and when it starts in the morning.

Solutions to the issue are:
Restart the addon manually when you restart homeassistant if it’s night time. This is what I typically do… If I happen to restart HA and go looking for the data. So perhaps once every 3 months or so… So very rarely.

You could create an automation in HA to restart the addon when HA restarts. It would be best to check it does actually restart.

There is a post around post 230 which details how to use SSH to do a finq via the command line that you could also use in an automation instead of a restart automation. This would be safer than a straight up restart as it won’t cause the addon to duplicate accidentally(which is fairly rare).

Someone might do a pull request for a websocket authentication and trigger for a finq request on HA restarts. I would be happy to add it into the addon. I couldn’t figure how to write this after spending quite abit of time on that solution.

A host reboot will cause the addon to restart also.