SBFspot Bluetooth homeassistant addon

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:

Should be able to do process of elimination with this, assuming that savesā€¦
It saves fine for me. So if that doesnā€™t saveā€¦ perhaps itā€™s a browser issue or something.

Connection_Type: Bluetooth
Sensors_HA: "No"
BTAddress: "null"
Password: "null"
LocalBTAddress: "null"
IP_Address: "null"
Plantname: "null"
Latitude: "null"
Longitude: "null"
Timezone: "null"
DateTimeFormat: "null"
SQL_Password: "null"
MQTT_User: "null"
MQTT_Pass: "null"
MQTT_Topic: "null"
MQTT_Data: "null"
PVoutput_SID: "null"
PVoutput_Key: "null"
LogLevel: info

I have gone back to using a pi instead of my virtual machine so that I can use this add on. I had the previous issue. tried a few browsers and same problem with each of them.

It worked with all the ā€œnullā€ values. I then went through and replaced the values one at a time and found which ones did not work. I tried the supplied secret names and found that if I changed any of then it would not save. Also would not save with lat and long using !secret. Not sure what the issue is/was.

My next question is about all the historical data on the inverter. I am in the process of downloading it to CSV files with a possible plan to import them. But I found someone who said they used the following command to download their data. I assumed automatically.

sudo /usr/local/bin/sbfspot.3/SBFspot -v300 -ad300 -am300 -ae300

Is there any way to do this within Home Assistant?

Lastly, it will be interesting to see how the Bluetooth proxy introduced in the latest version will work with your add-on. Might solve the issue with virtual machines.

Thanks again.

Laurie

Going backwards.

Bluetooth proxy/changes didnā€™t seem to improve the VM situation. I have tried directly on a rpi4 HAOS and deb/docker/supervisor. It works perfectly there. I have also tried on HAOS and deb/docker/supervisor on a win10 VM using vmware player. Out of those two I could only get deb/docker/supervisor to connect. It is probably my VM, but I couldnā€™t/canā€™t get HAOS to connect via a VM.

This is possible via portainer and connecting via the console.
Or

docker exec -it haos-sbfspot /bin/bash

I usually use portainer. You donā€™t need the sudo in the container. It should also take you directly to /usr/bin/sbfspot as that is the working directory. You can run any sbfspot command thoughā€¦

-finq -help etc

Getting the csv files outā€¦ They go to /data/sbfspot/ usually which is a shared folderā€¦
You probably need to add -csv if you want csv files as they are off by default so as not to clutter up drivespace or create unnecessary writes to the drive.

OK so secrets. It is designed to use those specific secrets, they are hard coded into the config. The idea being that if they are set up, you donā€™t actually need to save the options. You can just start the addon.

Essentially I was being lazy in testing when I was uninstalling and reinstalling a lot, instead of copy/pasting my optionsā€¦ I just saved the secrets.

You can use your own secretsā€¦ But you have to save them in the options. You can actually also fill out all the options if you really want. They are hidden down the bottom of options.

Lat and longā€¦ They are set to string. But for whatever reason it gets upset after more than 2 or 3 decimal places. Donā€™t ask me why.
So -20.12 is ok but -20.12234 it doesnā€™t like.

I was actually going to try to make it use homeassistant lat and long, but I didnā€™t figure that out yet.

As a side note while talking about optionsā€¦
Itā€™s probably best to switch the options back to No after you Create sensors. Create will make the sensors everytime the addon loads, which seems okā€¦ But to be safe, No is probably better.

OS9 makes connecting via HAOS on x86 VM work for meā€¦

It should be available nowā€¦ or very soon!

os9 - not sure what that is?

i have got Portainer working and have been able to download monthly data for last 153 months. now to figure out how to graph it for comparison purposes.


operating system 9
haos-sbfspot should work on your VM now.

http://www.meterkloud.com/MeterView

that might be fun for graphing. It is Australian format based though.

Hello HasQT,
i am using the addon since a while. Gettung the data via pvoutput works. But if i search for the device i get a device info page with unkown values:

Do you have an idea what might be wrong?

I am using haos-sbfspot 2022.09.2

image

Thanks in advance
Frank

PVoutput is working. that is good. It is separate to the MQTT messages.

It looks like your MQTT message is not arriving. Has you ever had values on your screenshot page? It will be unknown values until the addon sends out a new message after a Home Assistant restart. If you restart the addon it should send out a new message to update the values. If that doesnā€™t happenā€¦ then perhaps you are having MQTT authentication issues and the messages are not arriving? Any errors pointing to that in the addon or MQTT broker?

Hello HasQT,

yes i have an issue with MQTT. I get the following error messages in the main HA log:

Logger: homeassistant.util.logging
Source: util/logging.py:156
First occurred: October 3, 2022 at 10:31:33 (3 occurrences)
Last logged: October 3, 2022 at 10:31:33

Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'SMA Time Inverter', 'state_topic': 'homeassistant/sbfspot_PVName/sbfspot_PVNumber', 'value_template': '{{ value_json.InvTime | as_timestamp | timestamp_custom( %d/%m/%Y %H:%M:%S ) | default() }}', 'unique_id': 'PVNumber_InvTime', 'enabled_by_default': 'true', 'entity_category': 'diagnostic', 'icon': 'mdi:clock', 'device': {'identifiers': ['HAOS-SBFspot-Sensors'], 'name': 'HAOS-SBFspot', 'model': 'SB 2500HF-30', 'manufacturer': 'SMA', 'sw_version': '02.30.06.R'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 348, in async_discover config = discovery_schema(discovery_payload) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']
Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'SMA Sun Rise', 'state_topic': 'homeassistant/sbfspot_PVName/sbfspot_PVNumber', 'value_template': '{{ value_json.SunRise | as_timestamp | timestamp_custom( %d/%m/%Y %H:%M:%S ) | default() }}', 'unique_id': 'PVNumber_SunRise', 'enabled_by_default': 'true', 'icon': 'mdi:weather-sunny', 'device': {'identifiers': ['HAOS-SBFspot-Sensors'], 'name': 'HAOS-SBFspot', 'model': 'SB 2500HF-30', 'manufacturer': 'SMA', 'sw_version': '02.30.06.R'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 348, in async_discover config = discovery_schema(discovery_payload) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']
Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'SMA Sun Set', 'state_topic': 'homeassistant/sbfspot_PVName/sbfspot_PVNumber', 'value_template': '{{ value_json.SunSet | as_timestamp | timestamp_custom( %d/%m/%Y %H:%M:%S ) | default() }}', 'unique_id': 'PVNumber_SunSet', 'enabled_by_default': 'true', 'icon': 'mdi:weather-hazy', 'device': {'identifiers': ['HAOS-SBFspot-Sensors'], 'name': 'HAOS-SBFspot', 'model': 'SB 2500HF-30', 'manufacturer': 'SMA', 'sw_version': '02.30.06.R'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 348, in async_discover config = discovery_schema(discovery_payload) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: invalid template (TemplateSyntaxError: unexpected '%') for dictionary value @ data['value_template']

I have just found the the device Info page. So i do not know if it work before.

Frank

Hello HasQT,

here the config-file:

Connection_Type: Bluetooth
Sensors_HA: Create
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: "%d/%m/%Y %H:%M:%S"
SQL_Password: "!secret mariadb_pw"
MQTT_User: "!secret mqtt_user"
MQTT_Pass: "!secret mqtt_pass"
MQTT_Topic: ""
MQTT_Data: >-
  Timestamp,SunRise,SunSet,InvSerial,InvName,InvTime,InvStatus,InvTemperature,InvGridRelay,EToday,ETotal,GridFreq,PACTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info
MIS_Enabled: 0
OutputPath: /data/sbfspot/%Y
OutputPathEvents: /data/sbfspot/%Y/events
CalculateMissingSpotValues: 1
DateFormat: "%d/%m/%Y"
DecimalPoint: comma
TimeFormat: "%H:%M:%S"
SynchTime: 0
SynchTimeLow: 1
SynchTimeHigh: 3600
SunRSOffset: 900
Locale: en-US
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: 192.168.178.68
SQL_Port: "3306"
SQL_Username: sbfspot
MQTT_Publisher: /usr/bin/mosquitto_pub
MQTT_Host: core-mosquitto
MQTT_Port: "3306"
MQTT_ItemFormat: "\"{key}\": {value}"
MQTT_ItemDelimiter: comma
MQTT_PublisherArgs: "-h {host} -u mqtt-name -P mqtt-pw -t {topic} -m \"{{message}}\" -d"
LogDir: /data/sbfspot/log/
MQTT_ENABLE: "1"

Frank

and a snipped from the SBF-.pot log file from now (after a restart - before sunrise)

Skipping UAC3
Skipping IAC1
Skipping IAC2
Skipping IAC3
Skipping OperTm
Skipping FeedTm
Skipping PDCTot
[05:24:14] INFO: Setting Up PDC1
[05:24:14] INFO: Setting Up PDC2
Skipping PDC
[05:24:14] INFO: Setting Up UDC1
[05:24:14] INFO: Setting Up UDC2
Skipping UDC
[05:24:14] INFO: Setting Up IDC1
[05:24:14] INFO: Setting Up IDC2
Skipping IDC
[05:24:14] INFO: Setting Up GridFreq
Skipping BTSignal
Skipping BatTmpVal
Skipping BatVol
Skipping BatAmp
Skipping BatChaStt
Skipping InvWakeupTm
Skipping InvSleepTm
Skipping MeteringWOut
Skipping MeteringWIn
Skipping MeteringWTot
[05:24:22] INFO: 
[05:24:22] INFO: 
[05:24:22] INFO:  ||    Generating Bluetooth Configs    ||
[05:24:22] INFO:  ||    /usr/bin/sbfspot/SBFspot.cfg    ||
[05:24:22] INFO:  || /usr/bin/sbfspot/SBFspotUpload.cfg ||
[05:24:22] INFO: 
[05:24:22] INFO:  [Starting SBFspotUpload]
[05:24:22] INFO: [Starting cron in foreground]
SBFspot V3.9.6
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 Oct  6 05:24:52 2022: INFO: Starting...
sunrise: 07:18
sunset : 18:33
Connecting to 00:80:25:20:48:3E (1/10)
Initialising...
SUSyID: 125 - SessionID: 832495434
SMA netID=0F
Serial Nr: 7E5E43BA (PVNumber)
BT Signal=77.3%
Logon OK
SUSyID: 131 - SN: PVNumber
Device Name:      SN: PVNumber
Device Class:     Solar Inverters
Device Type:      SB 2500HF-30
Software Version: 02.30.06.R
Packet status: 21
SUSyID: 131 - SN: PVNumber
Device Status:      Ok
SUSyID: 131 - SN: PVNumber
Device Temperature: 0.0Ā°C
SUSyID: 131 - SN: PVNumber
GridRelay Status:      Information not available
********************
* ArchiveDayData() *
********************
startTime: 06/10/2022 00:00:00
SUSyID: 131 - SN: PVNumber
Calculated EToday: 0.000kWh
SUSyID: 131 - SN: PVNumber
Energy Production:
	EToday: 0.000kWh
	ETotal: 29724.598kWh
	Operation Time: 44994.88h
	Feed-In Time  : 41626.98h
SUSyID: 131 - SN: PVNumber
DC Spot Data:
	MPPT 1 Pdc:   0.000kW - Udc:   0.00V - Idc:  0.000A
	MPPT 2 Pdc:   0.000kW - Udc:   0.00V - Idc:  0.000A
	Calculated Total Pdc:   0.000kW
AC Spot Data:
	Phase 1 Pac :   0.000kW - Uac:   0.00V - Iac:  0.000A
	Phase 2 Pac :   0.000kW - Uac:   0.00V - Iac:  0.000A
	Phase 3 Pac :   0.000kW - Uac:   0.00V - Iac:  0.000A
	Total Pac   :   0.000kW - Calculated Pac:   0.000kW
	Efficiency  :    0.00%
SUSyID: 131 - SN: PVNumber
Grid Freq. : 0.00Hz
SUSyID: 131 - SN: PVNumber
Current Inverter Time: 2022-10-06T05:24:23+0200
Inverter Wake-Up Time: 2022-10-05T18:39:20+0200
Inverter Sleep Time  : 2022-10-05T18:43:49+0200
MQTT: Publishing (sbfspot) "Timestamp": "2022-10-06T05:24:57+0200","SunRise": "2022-10-06T07:18:00+0200","SunSet": "2022-10-06T18:33:00+0200","InvSerial": PVNumber,"InvName": "SN: PVNumber","InvTime": "2022-10-06T05:24:23+0200","InvStatus": "Ok","InvTemperature": 0.000,"InvGridRelay": "Information not available","EToday": 0.000,"ETotal": 29724.598,"GridFreq": 0.000,"PACTot": 0.000,"UDC1": 0.000,"UDC2": 0.000,"IDC1": 0.000,"IDC2": 0.000,"PDC1": 0.000,"PDC2": 0.000
Client null sending CONNECT
Client null received CONNACK (0)
Client null sending PUBLISH (d0, q0, r0, m1, 'sbfspot', ... (446 bytes))
Client null sending DISCONNECT
Reading events: 2022-Oct-01
Thu Oct  6 05:24:57 2022: INFO: Done.
INFO: SBFspotUploadDaemon Version 3.0.2

Frank

The error relates to

DateTimeFormat: "%d/%m/%Y %H:%M:%S"        <<< Only has double quotes.

It needs the extra single quotes to wrap the time variable.
Capture

DateTimeFormat: "'%H:%M:%S %d-%m-%y'"       <<<< it has double and single quotes

____________________________________________________

I assume you have removed MQTT topic to postā€¦



You can remove the extra options beyond what I have below (either reset to default or manually remove them). They are added by defaults in the addon now.
Particularly
MQTT_ENABLE: <<< this one will put an error in supervisor log.

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,UAC1,IAC1,OperTm,FeedTm,PDCTot,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2,BTSignal
PVoutput_SID: "!secret pvoSID"
PVoutput_Key: "!secret pvoAPIkey"
LogLevel: info

Edit: you probably want to delete the existing MQTT messages via the devices page if they have the wrong topic. You may need to check in MQTT Explorer that you donā€™t have incorrect retained messages, a purge will only clear messages that have the same MQTT topic.

Hello HasQT,

i have changed the DateTimeFormat. No error in the HA log anymore. But still unkowns in the device info.

In the MQTT-Explorer i have the following history entry:

{"InvSerial": xxxxxx,"InvName": "SN: xxxxx","InvClass": "Solar Inverters","InvType": "SB 2500HF-30","InvSwVer": "02.30.06.R"}

And the following

My SBFspot configuration above is complette with all line. But you have to scroll down.

Frank

What is your mqtt topic? The automatic sensors look for this topic

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

topic

Plantname and serial number are made up from your options and your inverter serial number.

You can see what topics the sensors are listening to in the MQTT INFO on the devices page.

Hi HasQT

I got around to trying the latest version today and seems like you cracked the problemswe were seeing with the Intel NUC. I managed to get the HAOS version working (after I figured out the problem with the secrets for the long and lat).

Connected pretty much straight away using the internal BT adapter and the NUC is 2 floors a probably about 8 meters away (I had it closer when we were testing).

Once it gets light in the moring and the inverter comes back online I will be trying the commands from a few posts above to pull all the backlog data and see how it processes it.

I will also try connecing an external BT adapter to a VMware HA vm in the same location as the NUC and see if that can connect.

Many thanks again for the hard work and assistance in trying to get this working.

1 Like

I havenā€™t tried since just after the OS9 release, but it was working smoothly on my VMs then, SO you shouldnā€™t have any issues bluetooth wise.

Hello HasQT,

simelar to your but one main difference:
image

The following entites:

sensor.sma_inverter_nom
sensor.sma_timestamp
sensor.sma_serial_no
sensor.sma_inverter_status
sensor.sma_inverter_running_temp
sensor.sma_energy_daily
sensor.sma_energy_lifetime
sensor.sma_ac_power
sensor.sma_array1_pdc
sensor.sma_array2_pdc
sensor.sma_array1_udc
sensor.sma_array2_udc
sensor.sma_array1_idc
sensor.sma_array2_idc
sensor.sma_grid_frequency
sensor.sma_time_inverter
sensor.sma_sun_rise
sensor.sma_sun_set

One payload example:

Frank