Page 1 of 2

SMA info in Domoticz

Posted: Monday 26 July 2021 11:51
by DJathome
Hello all,

I am rather new to Domoticz so pardon me if I get things wrong one in a while.
I have the latest version of Domoticz installed on a RPI 4 that is connected to my home network, as is my SMA (SB3.6) invertor and an USB digital meter cable connected to my energy counter.
After some fiddling I got al things to work and I see actual and historic data in Dashboard and so on.
Now I am wondering if the SBFspot (SMA) hardwaretype can create more than the 5 devices than it does in my case.
I get;
- temperature (not supported by my SMA SB3.6 I believe) zero value
- frequency (which lists a subtype percentage) but does give a plausible value
- efficiency (also not supported by my SMA SB3.6 I believe) zero value
- output voltage inverter giving a correct value
- sma inverter listing the total produced energy side startup of the SMA more than 2 years ago
When I go looking in the log files (path /var/log/sbfspot.3)
I see the collected info (of course only on moments when the inverter is up and running)
In that log I can see the string info also, so it is there to be used. With that in mind I guess I am looking towards Domoticz for what I am trying to do next.

What I do not know is if and how I can get all of this logged info 'visible' in Domoticz preferably without having too much extra configuration or installations. ;)
The 5 devices that pop up after I add sbfspot as hardware do not give all info in that can be read in the logfile.
For example I would like to compare both my PV-strings because they are not the same in orientation nor in configuration.
I have added a clipping (1 report) from that logfile, so I am interested mainly in the part "DC spot" data.

So 2 questions;

Can I get this "DC spot" data in one form or another in Domoticz as it is already the case for other values that do already appear like EToday.

How do I get all historic data from my SMA in the database (I chose the SQLite option in the sbfspot-config tool)

SBFspot V3.8.2
Yet another tool to read power production of SMA solar inverters
(c) 2012-2021, SBF (https://github.com/SBFspot/SBFspot)
Compiled for Linux (LE) 32 bit with SQLite support
Commandline Args: -v -ad1 -am0 -ae1 -cfg/usr/local/bin/sbfspot.3/SBFspot.cfg
Reading config '/usr/local/bin/sbfspot.3/SBFspot.cfg'
Mon Jul 19 21:40:01 2021: INFO: Starting...
sunrise: 05:52
sunset : 21:45
Connecting to Local Network...
Initializing...
SUSyID: XX - SessionID: XXXXXXXXX (0xXXXXXXXX)
Inverter IP address: 192.XXX.X.XX from SBFspot.cfg
Logon OK
SUSyID: 342 - SN: XXXXXXXXXX
Device Name: SB3.6-1AV-40 140
Device Class: PV-omvormers
Device Type: Sunny Boy 3.6
Software Version: 01.03.17.R
Serial number: XXXXXXXXXX
SUSyID: 342 - SN: XXXXXXXXXX
Device Status: OK
SUSyID: 342 - SN: XXXXXXXXXX
Device Temperature: 0.0°C
SUSyID: 342 - SN: XXXXXXXXXX
GridRelay Status: Gesloten
SUSyID: 342 - SN: XXXXXXXXXX
Pac max phase 1: 3680W
Pac max phase 2: 0W
Pac max phase 3: 0W
SUSyID: 342 - SN: XXXXXXXXXX
Energy Production:
EToday: 23.275kWh
ETotal: 13998.104kWh
Operation Time: 14551.32h
Feed-In Time : 14357.10h
SUSyID: 342 - SN: XXXXXXXXXX
DC Spot Data:
String 1 Pdc: 0.029kW - Udc: 301.60V - Idc: 0.090A
String 2 Pdc: 0.022kW - Udc: 144.10V - Idc: 0.150A
Calculated Total Pdc: 0.051kW

[/color]SUSyID: 342 - SN: XXXXXXXXXX
AC Spot Data:
Phase 1 Pac : 0.000kW - Uac: 231.01V - Iac: 0.300A
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: 342 - SN: XXXXXXXXXX
Grid Freq. : 49.99Hz
SUSyID: 342 - SN: XXXXXXXXXX
Current Inverter Time: 19/07/2021 21:39:59
Inverter Sleep Time : 19/07/2021 21:39:59
ExportSpotDataToCSV()
********************
* ArchiveDayData() *
********************
startTime = 60F4A460 -> 19/07/2021 00:00:00
ExportDayDataToCSV()
Reading events: 2021-Jul-01
ExportEventsToCSV()
Mon Jul 19 21:40:02 2021: INFO: Done.

Re: SMA info in Domoticz

Posted: Monday 26 July 2021 21:43
by solarboy
I have the same set up. You have already done the hard work. Next you need to go into Domoticz>Setup>hardware> and at the bottom you can chose to add new hardware. Use the drop down to choose "SBFspot (SMA)" and give is a friendly name and in the "location" tab insert the location of the sbfspot file, for example (mine) "/usr/local/bin/sbfspot.3/SBFspot.cfg" without inverted commas. The values you have collected should then appear as "devices" in Domoticz>Setup>Devices at the end of the list. You can then set them as "Used" and they will appear in the "Utility" tab and can be used in scripts etc.

Re: SMA info in Domoticz

Posted: Tuesday 27 July 2021 14:15
by DJathome
Thanks for your reply, I have meanwhile edited my post to clarify my question.
I do get info in dashboard when I set it accordingly but it seems I have no possibility to add info that is in the logfile but does not appear to be 'covered' by one of those 5 'devices'. And let it now be the case I wanted that info displayed somehow (info in red in logfile clipping)
I guess Domoticz only creates the 5 devices ('sensors') I see but I am not sure, following that reasoning I am looking at Domoticz for a solution, not SBFspot.

Re: SMA info in Domoticz

Posted: Thursday 29 July 2021 0:38
by solarboy
Ahh I see, individual string information, sorry I missed that first time around. I only have one string so I haven't looked into that, wish I could help more.

Re: SMA info in Domoticz

Posted: Thursday 29 July 2021 19:57
by PieterS
DJathome wrote: Monday 26 July 2021 11:51 Hello all,

I am rather new to Domoticz so pardon me if I get things wrong one in a while.
I have the latest version of Domoticz installed on a RPI 4 that is connected to my home network, as is my SMA (SB3.6) invertor and an USB digital meter cable connected to my energy counter.
After some fiddling I got al things to work and I see actual and historic data in Dashboard and so on.
Now I am wondering if the SBFspot (SMA) hardwaretype can create more than the 5 devices than it does in my case.
.
.
.
.
.
ExportSpotDataToCSV()
ExportEventsToCSV()
Hi,

You deliver a lot of info to us. But I missed how you got the above export. I guess you configered SBFspot the output to CSV-format.

I use SBFspot too to read my SB4000TL-2 and configured it to export via MQTT to Nodered and after conversion to Domoticz. Then you can read (almost) all your data of the SMA-inverter in Domoticz.

It is discribed in this thread viewtopic.php?f=81&t=36213&p=274625&hil ... ot#p274625
I had a little slow start with asking the right question but Firewizard helped me out and problem solved :D

So maybe you have to install some extra services to get a nice result. If you have questions maybe we can help you?

Re: SMA info in Domo

Posted: Thursday 29 July 2021 21:40
by DJathome
Again thanks for another reply,
I will have to read the thread you sent me.
The info I put in my mail is a clipping of one message in the logfile, every sample the sbfspot ‘reads’ from the inverter is written in the logfile, I guess sbfspot converts this info in a csv file that in turn is read by domoticz…

Re: SMA info in Domoticz

Posted: Friday 30 July 2021 11:15
by PieterS
In addition to my reply above:

In SBFspot.cfg you can fill in for example:

Code: Select all

# IP address or DNS name of MQTT Broker
# Don't use test broker for production environments
#MQTT_Host=test.mosquitto.org
MQTT_Host=192.168.X.X

# Port (Optional)
#MQTT_Port=

# Topic Name
# When using public broker like test.mosquitto.org make sure to define a unique topic name
# by appending the serial number of the inverter to avoid you receive data of another SBFspot user.
MQTT_Topic=sbfspot/data

# Format of message items to be sent
# JSON: MQTT_ItemFormat="{key}": {value}
# TEXT: MQTT_ItemFormat={key}:{value}
# XML:  MQTT_ItemFormat=<item name="{key}" value="{value}" />
MQTT_ItemFormat="{key}": {value}

# MQTT_ItemDelimiter (none|blank|comma|semicolon default comma)
# JSON: MQTT_ItemDelimiter=comma
# TEXT: MQTT_ItemDelimiter=semicolon
# XML : MQTT_ItemDelimiter=none

MQTT_ItemDelimiter=comma

# Mandatory arguments for mosquitto_pub executable
# JSON: MQTT_PublisherArgs=-h {host} -t {topic} -m "{{message}}"
# TEXT: MQTT_PublisherArgs=-h {host} -t {topic} -m "{message}"
# XML : MQTT_PublisherArgs=-h {host} -t {topic} -m "<mqtt_message>{message}</mqtt_message>"
MQTT_PublisherArgs=-h {host} -t {topic} -m "{{message}}"

# Data to be published (comma delimited)
MQTT_Data=OperTm,InvStatus,InvTemperature,InvGridRelay,BTSignal,GridFreq,EToday,ETotal,PACTot,PDCTot,FeedTm,PAC1,.....
MQTT sends this info to NodeRed and then there is a conversion to JSON which is read in Domoticz.

This is what I got in Domoticz:
Image

So even the temperature and state of your inverter is readable. In NodeRed you can do calculations for effenciency.

Now I see that also the version of firmware can be shown. Didn't know that...

If you like I can send you an export of the flow in NodeRed.

Re: SMA info in Domoticz

Posted: Friday 30 July 2021 21:53
by FireWizard
Hi, @DJathome

@PieterS wrote:
It is discribed in this thread viewtopic.php?f=81&t=36213&p=274625&hil ... ot#p274625
I had a little slow start with asking the right question but Firewizard helped me out and problem solved
If you need some support to create a Node Red flow for your inverters, let me know, but I need some information as a starting point.

I do not own a SMA inverter, and so haven't installed SBFspot.

Regards

Re: SMA info in Domoticz

Posted: Sunday 01 August 2021 21:59
by DJathome
Hello there Firewizard,

Thanks for the offer can you please clarify on the info you need as a starting point?

Furthermore, from all that I read it seems choosing hardware type Sbfspot (SMA) will only get me those 5 ‘devices’, hence also only that info. So Domoticz implementation via Sbfspot (SMA) is limited in that way, even the info is indeed collected with all wanted info from the inverter.

I get I will have to do some installations to have the hardware type Sbfspot MQTT available and with that all devices that can be used to display the info I want to be able to read in the Domoticz dashboard for example.

I ‘ll dig into that later start with PieterS’s suggesties on changing SBFspot.cfg

Re: SMA info in Domoticz

Posted: Monday 02 August 2021 11:40
by PieterS
@DJathome,

For your info: Firewizard is the expert! He knows all about MQTT and NodeRed! :o

Let me try to help you a bit for the overall view to get a solution for your questions.

I own a SMA-inverter SB4000TL-20 with 2 strings and wanted to read its data, like you do. :P You need to do some configuration in Linux. You started already by installing SBFspot and SQL. But did not succeed to get all data. I don't know why. I only can explain how I did it my way to get all data in Domoticz. :idea: In an earlier time I installed SBFspot to send data to PVoutput.org. Later on I discovered that you can upload to Domoticz too. So I had another goal.. :mrgreen:

In your first post you started with two questions:
So 2 questions;

Can I get this "DC spot" data in one form or another in Domoticz as it is already the case for other values that do already appear like EToday.

How do I get all historic data from my SMA in the database (I chose the SQLite option in the sbfspot-config tool)
So my answer to your first question:
You can get all info from the export of SBFspot into Domoticz as you show in your list later in the same post. About 20 values.. :D

Forget for now the answer for your second question. Make step by step..

Back to the first answer... I do not use the SQL-option as you did. I use the other option (MQTT) to export the data of SBFspot. In SBFspot.cfg you fill in some info (IP-adres, delimiter and the format of data you want).
Here an example how I edited SBFspot.cfg for MQTT:

Code: Select all

# Full path to mosquitto_pub executable
MQTT_Publisher=/usr/bin/mosquitto_pub

# IP address or DNS name of MQTT Broker
# Don't use test broker for production environments
#MQTT_Host=test.mosquitto.org
MQTT_Host=192.168.X.X

# Port (Optional)
#MQTT_Port=

# Topic Name
# When using public broker like test.mosquitto.org make sure to define a unique topic name
# by appending the serial number of the inverter to avoid you receive data of another SBFspot user.
MQTT_Topic=sbfspot/data

# Format of message items to be sent
# JSON: MQTT_ItemFormat="{key}": {value}
# TEXT: MQTT_ItemFormat={key}:{value}
# XML:  MQTT_ItemFormat=<item name="{key}" value="{value}" />
MQTT_ItemFormat="{key}": {value}

# MQTT_ItemDelimiter (none|blank|comma|semicolon default comma)
# JSON: MQTT_ItemDelimiter=comma
# TEXT: MQTT_ItemDelimiter=semicolon
# XML : MQTT_ItemDelimiter=none
MQTT_ItemDelimiter=comma

# Mandatory arguments for mosquitto_pub executable
# JSON: MQTT_PublisherArgs=-h {host} -t {topic} -m "{{message}}"
# TEXT: MQTT_PublisherArgs=-h {host} -t {topic} -m "{message}"
# XML : MQTT_PublisherArgs=-h {host} -t {topic} -m "<mqtt_message>{message}</mqtt_message>"
MQTT_PublisherArgs=-h {host} -t {topic} -m "{{message}}"

# Data to be published (comma delimited)
MQTT_Data=OperTm,InvStatus,InvTemperature,InvGridRelay,BTSignal,GridFreq,EToday,ETotal,PACTot,PDCTot,FeedTm,PAC1,UAC1,IAC1,UDC1,UDC2,IDC1,IDC2,PDC1,PDC2
Now some explanation of the route of the data after the export of SBFspot to Domoticz:

SBFspot -> MQTT -> NodeRed -> Domoticz

I guess you use the same OS (linux) as I do. So you have to install two extra applications in Linux.
  • For MQTT you can use Mosquitto. A so called broker. It is a kind of server. Not really because it does not store information. Just accept and transmit data.
  • You install NodeRed to do the conversion to JSON of the data so that Domoticz understand / read the data. And it will do calculations if you like.
The first application (Mosquitto) needs after installation no further attention.
For the second application (nodeRed) you have to build a so called flow. But I made the structure for that. You have to correct that flow because I do not know the numbers of the virtual sensors (IDX) in Domoticz.

I add the flow as attachment but you have to rename it from .txt to .json before you can import it in NodeRed. You use the menu in the red circle I made in the corner. Than change some information in different places like IP-adresses and IDX-numbers. ;)
SBFspot SMA.txt
(7.82 KiB) Downloaded 47 times
If you have more questions let us know.

Re: SMA info in Domoticz

Posted: Monday 02 August 2021 12:17
by waltervl

Re: SMA info in Domoticz

Posted: Monday 02 August 2021 14:36
by PieterS
Consider:
The inverter has the right interface? e.g. Modbus?
Just a few, or at least less values are exported in that example. Maybe some more if you are lucky.

Re: SMA info in Domoticz

Posted: Monday 02 August 2021 22:17
by FireWizard
Hi all,

As far as I have followed the discussion you have 2 options to get the data from the SMA inverters into Domoticz.

1. Use SBFspot, currently at version 3.8.2 (See: https://github.com/SBFspot/SBFspot)

The easiest way, I believe is to use SBFspot-config (See: https://github.com/SBFspot/sbfspot-config) Currently version 1.2.0

2. To use the ModBus approach as suggested by @waltervl

I have no idea, if you have the same possibilities as with SBFspot and MQTT, but if ModBus is enabled in the SMA inverter, it is a possibility.
An alternative can be to use ModBus and Node Red.
This is not to difficult.

@DJathome: It is up to you which route you want to take:

1. SBFspot ==> MQTT (Mosquitto) ==> Node-Red ==>MQTT ==> Domoticz
2. SMA (ModBus) ==> Domoticz
3. SMA (ModBus) ==> Node-Red ==> MQTT ==> Domoticz

Let me know, what your plan is.

If you go for option 1 or 3 I have the following questions:

1. Have you already SBFspot-config (only option 1) configured and does it work?
2. Have you already installed Mosquitto? (See: https://stevessmarthomeguide.com/instal ... pberry-pi/)
3. Have you Node-Red installed? (See: https://nodered.org/docs/getting-started/raspberrypi)

If you install MQTT Explorer (http://mqtt-explorer.com/) and you connect to your Mosquitto broker, what do you get?

Let me know?

Regards

Re: SMA info in Domoticz

Posted: Tuesday 03 August 2021 18:33
by DJathome
Hi Firewizard,

Currently I am looking into the 3 route options SBFspot/SMAmodbus directly to Domoticz/SMAmodbus Node-red MQTT Domoticz, so bear with me a little longer for picking one. I am trying to figure out what the advantages of each option is.
Your other questions;
1 SBFspot-config configed and working, the answer is yes
2 No not intentionally but I read here and there it is the image supplied with my RBPi.
3 Not yet.

I wil install an communicate what I get afterwards.

Thanks for bearing with me!

Re: SMA info in Domoticz

Posted: Wednesday 04 August 2021 15:51
by PieterS
As far as I can see there is ModBus available on the SB3.6-1AV-40 140. https://files.sma.de/downloads/SB30-50- ... -nl-10.pdf. It is deactivated by default. (See page 55).
In this case it should be the best way to implement the plugin for ModBus.
Even no need for SBFspot any more :D

Re: SMA info in Domoticz

Posted: Wednesday 04 August 2021 17:16
by FireWizard
Hello @DJathome and @PieterS,

I suggest you try the ModBus solution first.
If you are satisfied with the number of sensors, it provides, I think it is the easiest solution.

However, if you feel that you need Node Red to convert the ModBus registers to a MQTT message to Domoticz, I 'm prepared to support you, if necessary.

I will follow this thread, but will not produce anything, yet.

Regards

Re: SMA info in Domoticz

Posted: Wednesday 04 August 2021 20:33
by DJathome
Hi guys,

Wow, feels good you al want to share as much as possible. Since I have only limited time per day I can look at this, I am a bit slow in putting all in perspective.

But maybe I could be usefull I write down some things I would like to get out of all this so you can suggest the best options.

First of all I would like to be able to see the info from both strings on my SB3.6-1AV-40 140 in Domoticz (that famous DC Spot Data)

But I guess I wil have to 'install and configure' some more things to be able to calculate efficiency figures for example based on the info that can be extracted out of the Sunny boy or if I want to combine info from the Sunny Boy with info from for example my digital meter that was installed by the power distributing firm here.

I also know meanwhile that what I have now only reads every 5 minutes and while I can change crontab to run more frequently there seem to be limits to that approach.

As Firewizard suggest I will look to ModBus first, but I understand this has to be activated in the Sunny Boy because it isn't by default.

Regards to you all!

Re: SMA info in Domoticz

Posted: Wednesday 04 August 2021 21:30
by DJathome
PieterS wrote: Wednesday 04 August 2021 15:51 As far as I can see there is ModBus available on the SB3.6-1AV-40 140. https://files.sma.de/downloads/SB30-50- ... -nl-10.pdf. It is deactivated by default. (See page 55).
In this case it should be the best way to implement the plugin for ModBus.
Even no need for SBFspot any more :D
I suppose you mean this plugin, no? >>> https://github.com/derenback/Domoticz-SMA-Inverter

Re: SMA info in Domoticz

Posted: Wednesday 04 August 2021 21:35
by FireWizard
Hi, @DJathome,

Yes, this is the one indicated also indicated by @walrervl.

Re: SMA info in Domoticz

Posted: Thursday 05 August 2021 9:27
by DJathome
I have tried to use the ModBus plugin but it turns up an error in the log, googled it a bit but I fail to see what is wrong (beginner here ;-) )

2021-08-05 09:22:26.205 Error: Test ModBus: (SMA) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-SMA-Inverter/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-08-05 09:22:26.205 Error: Test ModBus: (Test ModBus) Module Import failed, exception: 'ModuleNotFoundError'
2021-08-05 09:22:26.205 Error: Test ModBus: (Test ModBus) Module Import failed: ' Name: pyModbusTCP'
2021-08-05 09:22:26.205 Error: Test ModBus: (Test ModBus) Error Line details not available.