SBFSpot (SMA) Inverter Hardware

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

SBFSpot (SMA) Inverter Hardware

Post by Brutus »

I am the proud owner of a newly installed Solar System on my roof. I installed it myself and it is working great.

I have the new SMA Sunny Boy 5.0 Inverter. Its connected through its network interface with my home network / internet.

Then I installed the SBFSpot software on my Windows (Domoticz / Kodi) computer and scheduled a task that runs every minute to collect the available data from the inverter.

With the hardware integration in Domoticz I can read the available data.

I am wondering if there are people who whould like more data to become available beside the Standard sensors that are made now?

Standard you can see:
-Temperature of the inverter
-BT Signal
-Hz
-Efficiency
-Volt uac1
-SolarMain (Actual generation and Daily generation)

If you take a look at the *.csv file that SBFSpot makes you can see things like:
- DC Power, Ampere and Volt for both strings.
- AC Power, Ampere and Volt for a 1 fase or for 3 fase if you have that.
- Operating Time
- Condition

Code: Select all

DeviceName;DeviceType;Serial;Pdc1;Pdc2;Idc1;Idc2;Udc1;Udc2;Pac1;Pac2;Pac3;Iac1;Iac2;Iac3;Uac1;Uac2;Uac3;PdcTot;PacTot;Efficiency;EToday;ETotal;Frequency;OperatingTime;FeedInTime;BT_Signal;Condition;GridRelay;Temperature
My idea is to lookup both DC voltages of my two strings and then compare them. Normally both voltages are almost the same. When it deflects like more then 30 / 40 Volt you know that there is a problem in one of your strings and need to take action. With a LUA script you can compare the values and send a notification when someting is wrong.

Also this Inverter has a "Condition" status that normally says "OK" but when this changes you can also receive a notification made in a LUA script.

If more sensors are added still everyone has its own choice of adding the devices they want.

I'm no programmer so I don't know were to start. Don't know if its easy or hard the change.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
zenit
Posts: 17
Joined: Wednesday 25 March 2015 17:40
Target OS: Linux
Domoticz version: Beta
Location: Berg aan de Maas
Contact:

Re: SBFSpot (SMA) Inverter Hardware

Post by zenit »

Hi, I am sorry to bring up this "old" threat.

Did anyone ever succeed to get these values from from SBFspot to Domoticz? I own a SMA Tripower 4kw inverter. Setting up SBFspot was a bit of a hassle, but eventually got it working.
I'm particularly interested in displaying/ logging the values concerning Udc1 en Udc2. Maybe there is a possibility to alter the plugin for it or another way.
The more data the better :)

Could somebody point me out to this? Thanks.
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: SBFSpot (SMA) Inverter Hardware

Post by Brutus »

zenit wrote: Sunday 09 August 2020 9:36 Hi, I am sorry to bring up this "old" threat.

Did anyone ever succeed to get these values from from SBFspot to Domoticz? I own a SMA Tripower 4kw inverter. Setting up SBFspot was a bit of a hassle, but eventually got it working.
I'm particularly interested in displaying/ logging the values concerning Udc1 en Udc2. Maybe there is a possibility to alter the plugin for it or another way.
The more data the better :)

Could somebody point me out to this? Thanks.
I think this will help you get all the information you need ;) I use is for 3 years now.

Code: Select all

----------------------------------------------------------------------------------------------------------
-- /home/pi/domoticz/scripts/lua/script_device_calculate_Pac.lua
----------------------------------------------------------------------------------------------------------
-- This script collects the values below from a modified sbfspot 
--   * A single line csv with the latest SMA data
-- It then calculates the efficiency and Pac for both MPP's from the values above with the formula's
-- This is almost always slightly wrong as the efficiency is for the total system and not per MPP
--   * Efficiency = PacTot/PdcTot*100%
--   * PacX = PdcX * Efficiency
-- It then updates a series of  virtual devices in Domoticz
--   * Pdc1 -> Power at MPP1
--   * Pdc2 -> Power at MPP2
--   * Pac1 -> AC Power calculated for Pdc1
--   * Pac2 -> AC Power calculated for Pdc2
--   * Efficiency -> Efficiency based on PacTot deviced by PdcTot
-- To send the value to Domoticz enter the *IDX and *Name
----------------------------------------------------------------------------------------------------------
-- Written by Christ Neeskens (Format5) 2017
----------------------------------------------------------------------------------------------------------
-- V0.4A Replaced comma with dot for SMA variables
-- V0.4 Added all values and only send to Domoticz if wanted (for Brutuss)
-- V0.3 Efficiency max 100% and debug info
-- V0.2 Addedd test PdcTot > 0 to check if system running
-- V0.1 Initial versions
----------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------
-- Domoticz IDX and names of the needed devices
----------------------------------------------------------------------------------------------------------
-- System settings
local SBFSpotSystemName = "Brutus Energy Plant"                                					-- System Name of the SBFspot system
local SBFSpotSMAData = ""     									-- Location of SMAData in SBFSpot
--local GenerationDeviceName = "Zonnepanelen"                                    	-- Device name of the Generated energy

----------------------------------------------------------------------------------------------------------
-- Domoticz IDX

local Pdc1IDX = 378                                 -- IDX of the energy device that shows Pdc1 power (watt)
local Pdc2IDX = 379                                 -- IDX of the energy device that shows Pdc2 power (watt)
local Idc1IDX = 386                                 -- IDX of the energy device that shows Idc1 current (ampere)
local Idc2IDX = 387                                 -- IDX of the energy device that shows Idc2 current (ampere)
local Udc1IDX = 382                                 -- IDX of the energy device that shows Udc1 voltage (volt)
local Udc2IDX = 383                                 -- IDX of the energy device that shows Udc2 voltage (volt)
local Pac1IDX = 0                                   -- IDX of the energy device that shows Pac1 power (watt)
local Pac2IDX = 0                                   -- IDX of the energy device that shows Pac2 power (watt)
local Pac3IDX = 0                                   -- IDX of the energy device that shows Pac3 power (watt)
local CalculatedPac1IDX = 0                         -- IDX of the energy device that shows calculated Pac1 power (watt)
local CalculatedPac2IDX = 0                         -- IDX of the energy device that shows calculated Pac2 power (watt)
local Iac1IDX = 388                                 -- IDX of the energy device that shows Iac1 current (ampere)
local Iac2IDX = 0                                   -- IDX of the energy device that shows Iac2 current (ampere)
local Iac3IDX = 0                                   -- IDX of the energy device that shows Iac3 current (ampere)
local Uac1IDX = 389                                 -- IDX of the energy device that shows Uac1 voltage (volt)
local Uac2IDX = 0                                   -- IDX of the energy device that shows Uac2 voltage (volt)
local Uac3IDX = 0                                   -- IDX of the energy device that shows Uce3 voltage (volt)
local PdcTotIDX = 0                                 -- IDX of the energy device that shows PdcTot power (watt)
local PacTotIDX = 0                                 -- IDX of the energy device that shows PacTot power (watt)
local EfficiencyIDX = 380                           -- IDX of the energy device that shows the efficiency (%)
local ETodayIDX = 0                                 -- IDX of the energy device that shows today's generated electricity (kWh)
local ETotalIDX = 390                               -- IDX of the energy device that shows total generated electricity (kWh)
local FrequencyIDX = 0                              -- IDX of the energy device that shows frequency (Hz)
local OperatingTimeIDX = 0                          -- IDX of the energy device that shows the operating time
local FeedInTimeIDX = 0                             -- IDX of the energy device that shows the feed in time
local BT_SignalIDX = 0                              -- IDX of the energy device that shows bluetooth signal stringth
local ConditionIDX = 385                            -- IDX of the energy device that shows current condition
local GridRelayIDX = 0                              -- IDX of the energy device that shows grid relay status
local TemperatureIDX = 0                            -- IDX of the energy device that shows temperature 

----------------------------------------------------------------------------------------------------------
-- Domoticz device names

local Pdc1DeviceName = "Zonnepanelen String 1"          -- Name of the energy device that shows Pdc1 power
local Pdc2DeviceName = "Zonnepanelen String 2"          -- Name of the energy device that shows Pdc2 power
local Idc1DeviceName = "Zonnepanelen String 1 Ampere"   -- DeviceName of the energy device that shows Idc1 current
local Idc2DeviceName = "Zonnepanelen String 2 Ampere"   -- DeviceName of the energy device that shows Idc2 current
local Udc1DeviceName = "Zonnepanelen String 1 Volt"     -- DeviceName of the energy device that shows Udc1 voltage
local Udc2DeviceName = "Zonnepanelen String 2 Volt"     -- DeviceName of the energy device that shows Udc2 voltage
local Pac1DeviceName = ""                               -- DeviceName of the energy device that shows Pac1 power
local Pac2DeviceName = ""                               -- DeviceName of the energy device that shows Pac2 power
local Pac3DeviceName = ""                               -- DeviceName of the energy device that shows Pac3 power
local CalculatedPac1DeviceName = ""                     -- Name of the energy device that shows calculated Pac1 power
local CalculatedPac2DeviceName = ""                     -- Name of the energy device that shows calculated Pac2 power
local Iac1DeviceName = "Omvormer Levering Ampere"       -- DeviceName of the energy device that shows Iac1 current
local Iac2DeviceName = ""                               -- DeviceName of the energy device that shows Iac2 current
local Iac3DeviceName = ""                               -- DeviceName of the energy device that shows Iac3 current
local Uac1DeviceName = "Omvormer Levering Volt"         -- DeviceName of the energy device that shows Uac1 voltage
local Uac2DeviceName = ""                               -- DeviceName of the energy device that shows Uac2 voltage
local Uac3DeviceName = ""                               -- DeviceName of the energy device that shows Uce3 voltage
local PdcTotDeviceName = ""                             -- DeviceName of the energy device that shows PdcTot current
local PacTotDeviceName = ""                             -- DeviceName of the energy device that shows PacTot current
local EfficiencyDeviceName = "Efficiëntie"              -- Name of the energy device that shows the efficiency
local ETodayDeviceName = ""                             -- DeviceName of the energy device that shows today's generated electricity
local ETotalDeviceName = "Zonnepanelen"                 -- DeviceName of the energy device that shows total generated electricity
local FrequencyDeviceName = "Frequency"                 -- DeviceName of the energy device that shows frequency Hz
local OperatingTimeDeviceName = ""                      -- DeviceName of the energy device that shows the operating time
local FeedInTimeDeviceName = ""                         -- DeviceName of the energy device that shows the feed in time
local BT_SignalDeviceName = ""                          -- DeviceName of the energy device that shows bluetooth signal stringth
local ConditionDeviceName = "Omvormer Status"           -- DeviceName of the energy device that shows current condition
local GridRelayDeviceName = ""                          -- DeviceName of the energy device that shows grid relay status
local TemperatureDeviceName = ""                        -- DeviceName of the energy device that shows temperature 

----------------------------------------------------------------------------------------------------------
-- Script parameters including all parameters in sbfspot single line csv

local CSVfile = SBFSpotSMAData .. os.date("%Y") .. '/' .. SBFSpotSystemName .. '-Spot-SingleLine.csv'
UpdateDateTime = 0
DeviceName = 0
DeviceType = 0
Serial = 0
Pdc1 = 0
Pdc2 = 0
Idc1 = 0
Idc2 = 0
Udc1 = 0
Udc2 = 0
Pac1 = 0
Pac2 = 0
Pac3 = 0
Iac1 = 0
Iac2 = 0
Iac3 = 0
Uac1 = 0
Uac2 = 0
Uac3 = 0
PdcTot = 0
PacTot = 0
Efficiency = 0
EToday = 0
ETotal = 0
Frequency = 0
OperatingTime = 0
FeedInTime = 0
BT_Signal = 0
Condition = 0
GridRelay = 0
Temperature = 0
CalculatedPac1 = 0
CalculatedPac2 = 0
Debug = "NO"           -- Turn debugging on ("YES") or off ("NO")
 
----------------------------------------------------------------------------------------------------------
-- Lua Functions
----------------------------------------------------------------------------------------------------------
-- Update to domoticz

function update(device, id, value, index)
    if Debug=="YES" then print("Lua Calculate PacX: commandArray[" ..  index .. "] = {['" ..device .. "'] = " .. id .. "|0|" .. value .."}") end    
    commandArray[index] = {['UpdateDevice'] = id .. "|0|" .. value}
end 

----------------------------------------------------------------------------------------------------------
-- Round up number

function round(num, numDecimalPlaces)
  local mult = 10^(numDecimalPlaces or 0)
  return math.floor(num * mult + 0.5) / mult
end

----------------------------------------------------------------------------------------------------------
-- CommandArray

commandArray = {}

    --if devicechanged[GenerationDeviceName] then
        -- Read sbfspot single line csv file
        if Debug=="YES" then
            print("Lua Calculate PacX: Using file: " .. CSVfile)
        end
        file = io.open(CSVfile, "r")
        UpdateDateTime,DeviceName,DeviceType,Serial,Pdc1,Pdc2,Idc1,Idc2,Udc1,Udc2,Pac1,Pac2,Pac3,Iac1,Iac2,Iac3,Uac1,Uac2,Uac3,PdcTot,PacTot,Efficiency,EToday,ETotal,Frequency,OperatingTime,FeedInTime,BT_Signal,Condition,GridRelay,Temperature=file:read():match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")

----------------------------------------------------------------------------------------------------------
-- remove comma's

        if Debug=="YES" then
            print("Lua Calculate PacX: Replacing comma's with dots and rounding up/down")
        end
        Pdc1=round(string.gsub(Pdc1,"%,","."))
        Pdc2=round(string.gsub(Pdc2,"%,","."))
        Idc1=string.gsub(Idc1,"%,",".")
        Idc2=string.gsub(Idc2,"%,",".")
        Udc1=string.gsub(Udc1,"%,",".")
        Udc2=string.gsub(Udc2,"%,",".")
        Pac1=round(string.gsub(Pac1,"%,","."))
        Pac2=round(string.gsub(Pac2,"%,","."))
        Pac3=round(string.gsub(Pac3,"%,","."))
        Iac1=string.gsub(Iac1,"%,",".")
        Iac2=string.gsub(Iac2,"%,",".")
        Iac3=string.gsub(Iac3,"%,",".")
        Uac1=string.gsub(Uac1,"%,",".")
        Uac2=string.gsub(Uac2,"%,",".")
        Uac3=string.gsub(Uac3,"%,",".")
        PdcTot=round(string.gsub(PdcTot,"%,","."))
        PacTot=round(string.gsub(PacTot,"%,","."))
        Efficiency=string.gsub(Efficiency,"%,",".")
        EToday=string.gsub(EToday,"%,",".")
        ETotal=string.gsub(ETotal,"%,",".")
        --ETotal=round(string.gsub(ETotal,"%,","."))
        Frequency=string.gsub(Frequency,"%,",".")
        OperatingTime=string.gsub(OperatingTime,"%,",".")
        FeedInTime=string.gsub(FeedInTime,"%,",".")
        BT_Signal=string.gsub(BT_Signal,"%,",".")
        Condition=string.gsub(Condition,"%,",".")
        GridRelay=string.gsub(GridRelay,"%,",".")
        Temperature=string.gsub(Temperature,"%,",".")
        if tonumber(PdcTot) >0 and tonumber(PacTot) >0   then
----------------------------------------------------------------------------------------------------------
-- Calculate efficiency

            Efficiency=PacTot/PdcTot
            if Efficiency >1 then
                if Debug=="YES" then
                    print("Lua Calculate PacX: Efficiency= " .. Efficiency .. " So higher than 100% therefor decreasing to 100%")
                end
                Efficiency=1
            else
                if Debug=="YES" then
                    print("Lua Calculate PacX: Efficiency= " .. Efficiency .. " So lower than 100% therefor not modifying it")
                end
            end

----------------------------------------------------------------------------------------------------------
-- Calculate Pac values using efficiency and round to whole number

            CalculatedPac1=round(Pdc1*Efficiency)
            CalculatedPac2=round(Pdc2*Efficiency)
            if Debug=="YES" then
                print("Lua Calculate PacX: PacTot= " .. PacTot .. " so normal running")
                print("Lua Calculate PacX: UpdateDateTime= " .. UpdateDateTime)
                print("Lua Calculate PacX: DeviceName= " .. DeviceName)
                print("Lua Calculate PacX: DeviceType= " .. DeviceType)
                print("Lua Calculate PacX: Serial= " .. Serial)
                print("Lua Calculate PacX: Pdc1= " .. Pdc1 .. "Watt")
                print("Lua Calculate PacX: Pdc2= " .. Pdc2 .. "Watt")
                print("Lua Calculate PacX: PdcTot= " .. PdcTot .. "Watt")
                print("Lua Calculate PacX: PacTot= " .. PacTot .. "Watt")
                print("Lua Calculate PacX: Efficiency= " .. PacTot .. "/" .. PdcTot .. "=" .. Efficiency*100 .. "%")
                print("Lua Calculate PacX: CalculatedPac1=" .. CalculatedPac1 .. "Watt")
                print("Lua Calculate PacX: CalculatedPac2=" .. CalculatedPac2 .. "Watt")
            end 
        else
            Efficiency=0
            CalculatedPac1=0
            CalculatedPac2=0
            if Debug=="YES" then
                print("Lua Calculate PacX: PacTot =" .. PacTot .. " and PdcTot =" .. PdcTot .. "so offline running")
                print("Lua Calculate PacX: CalculatedPac1=" .. CalculatedPac1 .. "Watt")
                print("Lua Calculate PacX: CalculatedPac2=" .. CalculatedPac2 .. "Watt")
            end
    end 
    
----------------------------------------------------------------------------------------------------------
-- Create array with values to update

    if PdcTot > 0 then
        print ('Omvormer gegevens worden verwerkt')
    else 
        print ('Geen zon, Geen gegevens')
    end
    

        local count = 0
        if Pdc1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Pdc1DeviceName, Pdc1IDX, Pdc1, count) " .. Pdc1DeviceName .. "," .. Pdc1IDX .. "," .. Pdc1 .. "," .. count) end 
            update(Pdc1DeviceName, Pdc1IDX, Pdc1, count)
        end
        if Pdc2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Pdc2DeviceName, Pdc2IDX, Pdc2, count) " .. Pdc2DeviceName .. "," .. Pdc2IDX .. "," .. Pdc2 .. "," .. count) end 
            update(Pdc2DeviceName, Pdc2IDX, Pdc2, count)
        end
        if Idc1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Idc1DeviceName, Idc1IDX, Idc1, count) " .. Idc1DeviceName .. "," .. Idc1IDX .. "," .. Idc1 .. "," .. count) end 
            update(Idc1DeviceName, Idc1IDX, Idc1, count)
        end
        if Idc2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Idc2DeviceName, Idc2IDX, Idc2, count) " .. Idc2DeviceName .. "," .. Idc2IDX .. "," .. Idc2 .. "," .. count) end 
            update(Idc2DeviceName, Idc2IDX, Idc2, count)
        end
        if Udc1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Udc1DeviceName, Udc1IDX, Udc1, count) " .. Udc1DeviceName .. "," .. Udc1IDX .. "," .. Udc1 .. "," .. count) end 
            update(Udc1DeviceName, Udc1IDX, Udc1, count)
        end
        if Udc2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Udc2DeviceName, Udc2IDX, Udc2, count) " .. Udc2DeviceName .. "," .. Udc2IDX .. "," .. Udc2 .. "," .. count) end 
            update(Udc2DeviceName, Udc2IDX, Udc2, count)
        end
        if Pac1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Pac1DeviceName, Pac1IDX, Pac1, count) " .. Pac1DeviceName .. "," .. Pac1IDX .. "," .. Pac1 .. "," .. count) end 
            update(Pac1DeviceName, Pac1IDX, Pac1, count)
        end
        if Pac2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Pac2DeviceName, Pac2IDX, Pac2, count) " .. Pac2DeviceName .. "," .. Pac2IDX .. "," .. Pac2 .. "," .. count) end 
            update(Pac2DeviceName, Pac2IDX, Pac2, count)
        end
        if Pac3IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Pac3DeviceName, Pac3IDX, Pac3, count) " .. Pac3DeviceName .. "," .. Pac3IDX .. "," .. Pac3 .. "," .. count) end 
            update(Pac3DeviceName, Pac3IDX, Pac3, count)
        end
        if CalculatedPac1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(CalculatedPac1DeviceName, CalculatedPac2IDX, CalculatedPac1, count) " .. CalculatedPac1DeviceName .. "," .. CalculatedPac1IDX .. "," .. CalculatedPac1 .. "," .. count) end 
            update(CalculatedPac1DeviceName, CalculatedPac1IDX, CalculatedPac1, count)
        end
        if CalculatedPac2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(CalculatedPac2DeviceName, CalculatedPac2IDX, CalculatedPac2, count) " .. CalculatedPac2DeviceName .. "," .. CalculatedPac2IDX .. "," .. CalculatedPac2 .. "," .. count) end 
            update(CalculatedPac2DeviceName, CalculatedPac2IDX, CalculatedPac2, count)
        end
        if Iac1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate IacX: update(Iac1DeviceName, Iac1IDX, Iac1, count) " .. Iac1DeviceName .. "," .. Iac1IDX .. "," .. Iac1 .. "," .. count) end 
            update(Iac1DeviceName, Iac1IDX, Iac1, count)
        end
        if Iac2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate IacX: update(Iac2DeviceName, Iac2IDX, Iac2, count) " .. Iac2DeviceName .. "," .. Iac2IDX .. "," .. Iac2 .. "," .. count) end 
            update(Iac2DeviceName, Iac2IDX, Iac2, count)
        end
        if Iac3IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate IacX: update(Iac3DeviceName, Iac3IDX, Iac3, count) " .. Iac3DeviceName .. "," .. Iac3IDX .. "," .. Iac3 .. "," .. count) end 
            update(Iac3DeviceName, Iac3IDX, Iac3, count)
        end
        if Uac1IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Uac1DeviceName, Uac1IDX, Uac1, count) " .. Uac1DeviceName .. "," .. Uac1IDX .. "," .. Uac1 .. "," .. count) end 
            update(Uac1DeviceName, Uac1IDX, Uac1, count)
        end
        if Uac2IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Uac2DeviceName, Uac2IDX, Uac2, count) " .. Uac2DeviceName .. "," .. Uac2IDX .. "," .. Uac2 .. "," .. count) end 
            update(Uac2DeviceName, Uac2IDX, Uac2, count)
        end
        if Uac3IDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(Uac3DeviceName, Uac3IDX, Uac3, count) " .. Uac3DeviceName .. "," .. Uac3IDX .. "," .. Uac3 .. "," .. count) end 
            update(Uac3DeviceName, Uac3IDX, Uac3, count)
        end
        if PdcTotIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(PdcTotDeviceName, PdcTotIDX, PdcTot, count) " .. PdcTotDeviceName .. "," .. PdcTotIDX .. "," .. PdcTot .. "," .. count) end
            update(PdcTotDeviceName, PdcTotIDX, PdcTot, count) 
        end
        if PacTotIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(PacTotDeviceName, PacTotIDX, PacTot, count) " .. PacTotDeviceName .. "," .. PacTotIDX .. "," .. PacTot .. "," .. count) end
            update(PacTotDeviceName, PacTotIDX, PacTot, count) 
        end
        if EfficiencyIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(EfficiencyDeviceName, EfficiencyIDX, Efficiency*100, count) " .. EfficiencyDeviceName .. "," .. EfficiencyIDX .. "," .. Efficiency*100 .. "," .. count) end 
            update(EfficiencyDeviceName, EfficiencyIDX, Efficiency*100, count)
        end
        if ETodayIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(ETodayDeviceName, ETodayIDX, EToday, count) " .. ETodayDeviceName .. "," .. ETodayIDX .. "," .. EToday .. "," .. count) end 
            update(ETodayDeviceName, ETodayIDX, EToday, count)
        end
        if ETotalIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(ETotalDeviceName, ETotalIDX, ETotal, count) " .. ETotalDeviceName .. "," .. ETotalIDX .. "," .. ETotal .. "," .. count) end 
            --update(ETotalDeviceName, ETotalIDX, ETotal, count)
            update(ETotalDeviceName, ETotalIDX, PacTot .. ";" .. ETotal*1000, count)
        end
        if FrequencyIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(FrequencyDeviceName, FrequencyIDX, Frequency, count) " .. FrequencyDeviceName .. "," .. FrequencyIDX .. "," .. Frequency .. "," .. count) end 
            update(FrequencyDeviceName, FrequencyIDX, Frequency, count)
        end
        if OperatingTimeIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(OperatingTimeDeviceName, OperatingTimeIDX, OperatingTime, count) " .. OperatingTimeDeviceName .. "," .. OperatingTimeIDX .. "," .. OperatingTime .. "," .. count) end 
            update(OperatingTimeDeviceName, OperatingTimeIDX, OperatingTime, count)
        end
        if FeedInTimeIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(FeedInTimeDeviceName, FeedInTimeIDX, FeedInTime, count) " .. FeedInTimeDeviceName .. "," .. FeedInTimeIDX .. "," .. FeedInTime .. "," .. count) end 
            update(FeedInTimeDeviceName, FeedInTimeIDX, FeedInTime, count)  
        end
        if BT_SignalIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(BT_SignalDeviceName, BT_SignalIDX, BT_Signal, count) " .. BT_SignalDeviceName .. "," .. BT_SignalIDX .. "," .. BT_Signal .. "," .. count) end 
            update(BT_SignalDeviceName, BT_SignalIDX, BT_Signal, count)
        end
        if ConditionIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(ConditionDeviceName, ConditionIDX, Condition, count) " .. ConditionDeviceName .. "," .. ConditionIDX .. "," .. Condition .. "," .. count) end 
            update(ConditionDeviceName, ConditionIDX, Condition, count)
            end
        if GridRelayIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(GridRelayDeviceName, GridRelayIDX, GridRelay, count) " .. GridRelayDeviceName .. "," .. GridRelayIDX .. "," .. GridRelay .. "," .. count) end 
            update(GridRelayDeviceName, GridRelayIDX, GridRelay, count)
        end
        if TemperatureIDX ~=0 then
            count= count +1 
            if Debug=="YES" then print("Lua Calculate PacX: update(temperatureDeviceName, temperatureIDX, temperature, count) " .. temperatureDeviceName .. "," .. temperatureIDX .. "," .. temperature .. "," .. count) end 
            update(temperatureDeviceName, temperatureIDX, temperature, count)
        end
    

return commandArray
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
zenit
Posts: 17
Joined: Wednesday 25 March 2015 17:40
Target OS: Linux
Domoticz version: Beta
Location: Berg aan de Maas
Contact:

Re: SBFSpot (SMA) Inverter Hardware

Post by zenit »

Hi Brutus,

Thanks for the lua script!
I've been fiddeling around with, but it seems I just can't get it to work. I filled in the correct values at the start of it, i think. SBFspot is installed and working, Every day a csv-file is generated with data in it that I can read.
Running on a proxmox server with VM Linuxmint 4 / Debian buster installed. I am in noway a coder or programmer but can work my way through the internet.

Code: Select all

local SBFSpotSystemName = "My system name" 
local SBFSpotSMAData = "/home/pi/smadata" 


I got some errors on "scraping the csv-file" , so I changed line 104 from:

Code: Select all

local CSVfile = SBFSpotSMAData .. os.date("%Y") .. '/' .. SBFSpotSystemName .. '-Spot-SingleLine.csv' 
to :

Code: Select all

local CSVfile = SBFSpotSMAData  ..'/'.. os.date("%Y") .. '/' .. SBFSpotSystemName .. '-Spot-'.. os.date("%Y%m%d") ..'.csv'
It seems dat the data can be read, no error about this in domoticz log.
But now I'm getting another other error:

Code: Select all

 Error: EventSystem: in Script_device_calculate_Pac: [string "---------------------------------------------..."]:177: bad argument #1 to 'gsub' (string expected, got nil)
Maybe you could " shine a light on it" . Or maybe you could share your settings.
Thanks in advance.
User avatar
Brutus
Posts: 249
Joined: Friday 26 September 2014 9:33
Target OS: Windows
Domoticz version:
Location: Netherlands
Contact:

Re: SBFSpot (SMA) Inverter Hardware

Post by Brutus »

Your SBFSpotSystemName in the scrips is the same as in the SBFspot.cfg under "Plantname"?

I have these settings:

SBFSpot.cfg:

Code: Select all

# Plantname
Plantname=Brutus Energie Plant

# OutputPath (Place to store CSV files)
# 
# Windows: C:\Users\Public\SMAdata\%Y
# Linux  : /home/pi/smadata/%Y
# %Y %m and %d will be expanded to Year Month and Day
OutputPath=C:\Users\Domoticz\Documents\SBFspot\SMAdata\%Y
Lua Script:

Code: Select all

local SBFSpotSystemName = "Brutus Energie Plant" 
local SBFSpotSMAData = "C:\\Users\\Domoticz\\Documents\\SBFspot\\SMAData\\" 
Your "SBFSpotSMAData" location looks good. I Use Windows so the used paths in my script are a little different.

The script needs to be a "time" script. So it runs every minute. SBFSpot does that to.
As for the error at line 177 i think it can't find the "Pdc1" in the output full so check the solutions given above.

Greetings Brutus
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
User avatar
zenit
Posts: 17
Joined: Wednesday 25 March 2015 17:40
Target OS: Linux
Domoticz version: Beta
Location: Berg aan de Maas
Contact:

Re: SBFSpot (SMA) Inverter Hardware

Post by zenit »

Hi,

My settings seem to be OK.
I noticed that in the generated csv-file the value/column for "Pac1" is 0, while Pac2 and Pac3 are generated when the inverter starts.
Maybe it is a SBFspot issue with this type of inverter "STP4.0-3AV-40".

When is use:

Code: Select all

/usr/local/bin/sbfspot.3/SBFspot -v -finq -nocsv
the values seem to be right, and data is generated, but somehow it fails to export " Pac1" in the csv,

Nevermind, at the moment i'm looking into another plugin " SMA-ModbusTCPIP" .
Maybe this can " bring" me what i want.

Thanks for your help!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest