Integration with SMA Solar STP 10000TL-20 via SBFspot

My configuration.yaml looks very much like poggialb posted above, except my topic ID numbers are different. It’s mqtt sensors and nothing else.

From memory you just add your mqtt details in the sbfspot config file (poggialb discusses this in his post when he says “Some important settings to get MQTT working with HA:”.

And then just execute sbfspot with the -mqtt argument every X minutes.

Hi

Im using SBFspot in Windows to read my SMA. I works fine, and now tried to get it to work in HA. NO GO.

I copied the config above, even tried many other setting (to the point i confuse myself…lol)

If is do a manual “pub” i get the value into HA, but SBFSpot dont want to send values when it runs.

Please help

Works (XX just for security)
Manual send : mosquitto_pub -h 192.168.x.xx -p 1883 -u xx -P xx -t sbfspot/PDC1 -m “100”

But SBFSpot with this DONT WORK

MQTT_Publisher=%ProgramFiles%\mosquitto\mosquitto_pub.exe
MQTT_Host=192.168.1.73
MQTT_Port=1883
MQTT_Topic=sbfspot
MQTT_ItemFormat="{key}": {value}
MQTT_ItemDelimiter=comma
MQTT_PublisherArgs=-h {host} -p {port} -t {topic} -m “{{message}}” -u xx -P xx
MQTT_Data=SunRise,SunSet,InvStatus,InvTemperature,InvGridRelay,ETotal,EToday,PACTot,PDC1,PDC2,UDC1,UDC2,IDC1,IDC2,OperTm,FeedTm,PAC1,PAC2,PAC3,UAC1,UAC2,UAC3,IAC1,IAC2,IAC3,GridFreq

What am i missing ?

…can SBFSpot do MQTT and MySQL at the same time.

Ok I CANT READ!!!

the -mqtt ( On Windows the command to generate a reading is:
"C:\\Program Files (x86)\SpfSpot.3\SBFSpot.exe" -v -finq -nocsv -mqtt) got me. Its working fine

1 Like

Thank you very much!

I got it working, mqtt user is required, not optional which I first thought due mqtt already working while never entered username and password but it was an integration so seems work differently for those.

Now looking to intregrate into new energy dashboard in Home assistant 2021.8, it doesn’t show in entities list but I’m trying to use platform integration to create new kwh property.

It would be nice to get original kwh entitie to get showing into energy dashboard choice list.

Thank you very much for this @poggialb, also managed to get it work.

@jaan I am ideally looking to integrated this with the new Energy Dashboard, so if you are anyone makes progress on this, please can you update us here.

Cheers for that I’ve now got my SMA invertor talking via MQTT as well as PVOutput

I’m also trying to get it connected to the new energy dashboard and I believe it’s because the power generation values are missing two attributes state_class: measurement (See below) and last_reset: which I haven’t figured out the format with the MQTT Sensor [Edit might have figured out]

  - platform: mqtt
    state_topic: "sbfspot/123456"
    name: "Inverter Today Yield"
    value_template: "{{ value_json.EToday }}"
    unit_of_measurement: 'kWh'
    icon: mdi:solar-power
    device_class: power
    state_class: measurement
    last_reset_topic: 'sbfspot/123456'
    last_reset_value_template: '1970-01-01T00:00:00+00:00'

Been trying to do the same thing - had spfspot running for around a year on a raspberry pi taking in my data from an older sma 3600 inverter into home assistant. Have made some nice existing dashboards on generation, but would like to put into the new Energy Dashboard.

It seems that MQTT generated sensors cannot have the last_reset set which means it can’t create statistics which the new Energy dashboard needs. I’ve seen some comment about making a utility meter in configuration.yaml which can get around this with the daily attribute on it but not managed to get it working yet.

I’ve also amended the other outputs to now be device_class: power or energy and taken off the ‘’ ‘’ around appropriate unit of measurement - this should make it easier to see them in the newer HA environments

Hmm looking further into it specifically from this topic MQTT Sensor : how to define last_reset_value_template - #20 by iSteeb
I’ve updated my config and home assistant likes it but I can’t confirm until tomorrow when I have daylight. [EDIT: it works :slight_smile: ]

The other thing I think is if sbfspot itself would publish the last reset time via MQTT but I’d have to look into that aspect further.

Can you use this also with Home Assistant OS on a Raspberry PI? Thus without RaspberryOS and only have HomeAssistantIO OS installed?

Think you’d need a separate raspberry pi running Raspbian to run Spfspot - that is what I use. I run HA as a docker image on my NAS as the most stable and easiest for me. Don’t think you can run spfspot on HomeAssistant OS.

As for getting data into the new solar output part of HA I found that by creating a utility meter using the inverter_today_yield data that I didn’t need to mess with last reset time etc - which was crashing for me.

Making sure that inverter_today_yield was set as device_class power and unit as kwh allowed the utility meter to sum up the daily total and then be shown in the new solar output portion of HA.

utility_meter:
daily_solar_export:
source: sensor.inverter_today_yield
cycle: daily
monthly_solar_export:
source: sensor.inverter_today_yield
cycle: monthly

1 Like

Strange about the crashing. I ended up using the total Yield in the energy graph as the daily yield seemed to reset the graph with a negative value for the second day I guess because it starts at 0 each day and the last reset date should match that.

So excluding all the other mqtt data sbfspot sends to HomeAssistant this is the main sensor I’m using. Obviously change the 123456 to what ever your invertor Serial Number is

sensor solar:
  - platform: mqtt
    state_topic: "sbfspot/123456"
    name: "Inverter Total Yield"
    value_template: "{{ value_json.ETotal }}"
    last_reset_topic: "sbfspot/123456"
    last_reset_value_template: '1970-01-01T00:00:00+00:00'
    unit_of_measurement: kWh
    device_class: energy
    state_class: measurement
    icon: mdi:solar-power

You won’t see it as an option in the energy solar configuration until sbfspot has sent a mqtt message post adding the last_reset info either.

Also the solar predictions are pretty close to real world

4 Likes

@poggialb Just wanted to say a massive thanks for this, I moved in to place with SMA inverter 18months ago and since been trying to work out how to integrate since webconnect doesn’t work. Hour after stumbling across this post have it working :smile: and perfect timing with addition of energy functionality.

works fine, just one question, I have 2 inverters, get data from both in mqtt but on same topic, is there a way to have different topics or select them in Home assitant?

With two invertors don’t each of them have different serial numbers leading to different MQTT datasets. I’m not sure how sbfspot handles multiple invertors.

I stumbled across the same thing.
But it’s quite easy to solve.

I have a Rapberrypi Zero W running sbfspot, as my inverters only have one Bluetooth interface.

Two different configurations simply ensure that you query both inverters one after the other via the crontab and then send them via mqtt.

Both configurations send via their own topic and Homeassistant simply listens to # and can therefore also receive both topics.

In the HA config, simply sort by topic and you can integrate more than one inverter.

The question is whether you want to have one or two displays?

Hi,
I also installed this a few weeks ago, and all seems to work. I get the values and nice graphs.

But sometimes during the day i get these errors in the logs :

2021-08-25 07:31:16 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.EToday }}'
2021-08-25 07:31:16 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.ETotal }}'

my config looks like this:

    name: "Zonnepaneel Omvormer 1 dag"
    state_topic: "sbfspot_2100071280"
    unit_of_measurement: 'kWh'
    value_template: "{{ value_json.EToday }}"
    last_reset_topic: 'sbfspot_2100071280'
    last_reset_value_template: '1970-01-01T00:00:00+00:00'
    state_class: 'measurement'
    device_class: 'energy'
    icon: mdi:solar-power
  - platform: mqtt
    name: "Zonnepaneel Omvormer 1 totaal"
    state_topic: "sbfspot_2100071280"
    unit_of_measurement: 'kWh'
    value_template: "{{ value_json.ETotal }}"
    last_reset_topic: 'sbfspot_2100071280'
    last_reset_value_template: '1970-01-01T00:00:00+00:00'
    state_class: 'measurement'
    device_class: 'energy'
    icon: mdi:solar-power

I can’t see what is wrong, because this looks the same as the config of aynema

It looks like with the latest 2021.9 update that the total power should change from state_class: ‘measurement’ to ‘total_increasing’.

I’ve now moved to the same way of collecting data as others with the right settings for Total Energy Produced and this came up when I did the amendment today.

1 Like

Hiyas,
I am looking for someone to test my conversion of my Bluetooth SBFspot addon to Ethernet. I need to confirm it actually connects to an inverter over ethernet! My Inverter is only bluetooth.
Thanks in advance!

The thread on the bluetooth version

HAOS-SBFspot repo GitHub - habuild/hassio-addons: Home Assistant addon using SBFspot Bluetooth SMA inverters

The new ethernet version is here GitHub - habuild/hassio

An example yaml config is here You should just need to put in your Inverter IP and perhaps password? Not sure, I don’t use the ethernet version. Whatever you would normally use on a Non HA SBFspot version anyway. I just need to confirm it connects and receives data before I swap it over to my other Repo into my main version. you can leave fake details(you can make up your own) in to get the yaml config page to save.

You don’t need MQTT, MariaDB or a PVOutput account to test the connection, Although feed back on those would be useful(let me know if you are going to try live to PVOutput I disabled it for the moment.)

Connection_Type: Ethernet
BTAddress: '00:00:00:00:00:00'
Password: yoourpass
LocalBTAddress: '00:00:00:00:00:00'
IP_Address: '255:255:255:255'
Plantname: plantname
MIS_Enabled: 0
OutputPath: /data/sbfspot/%Y
OutputPathEvents: /data/sbfspot/%Y/events
Latitude: -37.81
Longitude: 144.96
Timezone: Australia/Melbourne
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
CalculateMissingSpotValues: '1'
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: sbfspot
SQL_Password: passowrd
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: '-h {host} -u usernom -P wordpass -t {topic} -m \"{{message}}\" -d'
MQTT_Data: >-
  Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2
MQTT_ENABLE: '1'
PVoutput_SID: yourSID0123456789:12345
PVoutput_Key: fake9364fake4545fake834fake
LogDir: /data/sbfspot/log/
LogLevel: info

Edit: 13/08/2022

Ethernet version has been moved into the main repo. It isn’t tested as yet, but it doesn’t effect the Bluetooth version so…
Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.