Code Monkey home page Code Monkey logo

froniussolarclient's Introduction

FroniusSolarClient Build Status

A .NET Client wrapper for the Fronius Solar API to obtain data from various Fronius devices (inverters, SensorCards, StringControls) in a defined format through a central facility which acts as a proxy(e.g. FroniusDatalogger Web or Fronius Solar web).

Getting Started

Install the NuGet package

Install-Package FroniusSolarClient.Core

using FroniusSolarClient.Entities.SolarAPI.V1;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

// Configure logger
var serviceProvider = new ServiceCollection()
    .AddLogging(build => build.AddConsole())
    .Configure<LoggerFilterOptions>(opt => opt.MinLevel = LogLevel.Debug)
    .BuildServiceProvider();

var client = new SolarClient("IP_ADDRESS", 1, serviceProvider.GetService<ILogger<SolarClient>>());

see examples

Logging

Internal logging has been implemented so you can parse in your own logger implementation see Microsoft.Extensions.Logging

Implementation

Realtime Requests

Archive Data Requests

Realtime Requests

These requests will be provided where direct access to the realtime data of the devices is possible. This is currently the case for the Fronius Datalogger Web and the Fronius Datamanager.

GetInverterRealtimeData

This request does not care about the configured visibility of single inverters. All inverters are reported.

  • CumulationInverterData - Values which are cumulated to generate a system overview.
  • CommonInverterData - Values which are provided by all types of Fronius inverters.
  • P3InverterData (3PInverterData) - Values which are provided by 3phase Fronius inverters.
  • MinMaxInverterData - Minimum and Maximum values of various inverter values.

GetPowerFlowRealtimeData

This request provides detailed information about the local energy grid. The values replied represent the current state. Because of data has multiple asynchronous origins it is a matter of facts that the sum of all powers (grid,load and generate) will differ from zero. This request does not care about the configured visibility of single inverters. All inverters are reported.

Archive Data Requests

Archive requests are provided whenever access to historic device-data is possible. The Datalogger web can only provide what is stored in its internal memory and has not been overwritten by newer data yet, it can loose data due to capacity reasons. The number of days stored is dependant on the number of connected units that are logging data.

Channels

Each channel is handled and requested by name. Most of the channels are recorded in constant cyclic intervals which can be set between 5 and 30 minutes. Only Digital_PowerManagementRelay_Out_1, InverterErrors, InverterEvents and Hybrid_Operating_State are event triggered and may occur every time.

Name Unit
TimeSpanInSec sec
Digital_PowerManagementRelay_Out_1 1
EnergyReal_WAC_Sum_Produced Wh
InverterEvents struct
InverterErrors struct
Current_DC_String_1 1A
Current_DC_String_2 1A
Voltage_DC_String_1 1V
Voltage_DC_String_2 1V
Temperature_Powerstage deg C
Voltage_AC_Phase_1 1V
Voltage_AC_Phase_2 1V
Voltage_AC_Phase_3 1V
Current_AC_Phase_1 1A
Current_AC_Phase_2 1A
Current_AC_Phase_3 1A
PowerReal_PAC_Sum 1W
EnergyReal_WAC_Minus_Absolute 1Wh
EnergyReal_WAC_Plus_Absolute 1Wh
Meter_Location_Current 1
Temperature_Channel_1 1
Temperature_Channel_2 1
Digital_Channel_1 1
Digital_Channel_2 1
Radiation 1
Digital_PowerManagementRelay_Out_1 1
Hybrid_Operating_State 1

Examples

GetInverterRealtimeData

Get CommonInverterData

var response = client.GetCommonInverterData();

Console.WriteLine($"{response.Head.Status.Code} at {response.Head.Timestamp}");
Console.WriteLine(response.Body.Data.TotalEnergy);

Provide device id and scope

var response = client.GetCommonInverterData(2, Scope.System);

GetArchiveData

Get channel Voltage_AC_Phase data over the past 24 hours

var channels = new List<Channel> { Channel.Voltage_AC_Phase_1, Channel.Voltage_AC_Phase_2, Channel.Voltage_AC_Phase_3 };

var response = client.GetArchiveData(DateTime.Now.AddDays(-1), DateTime.Now, channels);

or between 2 dates

var dateFrom = DateTime.Parse("01/08/2019");
var dateTo = DateTime.Parse("05/08/2019");

var response = client.GetArchiveData(dateFrom, dateTo, channels);

Query intervals are restricted to a maximum of 16 days and the number of parallel queries is system wide restricted to 4 clients.

Other Examples

See Program.cs for more examples

froniussolarclient's People

Contributors

f2calv avatar seanonet avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

froniussolarclient's Issues

Archive Request - Series Type Parameter not working

SeriesType Parameter needs to be named in Query string in order to work. (Currently being ignored)

Proposed fix:
InverterArchiveDataService.cs
Line 51

return $"?Scope={scope}&StartDate={startDate.ToString("d.M.yyyy")}&EndDate={endDate.ToString("d.M.yyyy")}&HumanReadable={humanReadable.ToString()}&SeriesType={seriesType.ToString()}{deviceClassParam}" + $"&{channelParam}";

    }

P_Grid and P_Load not integers

When not integer values in the response these two properties (P_Grid and P_Load) generate an error.

Defining them as decimal solves the issue. Proposed fix:

In PowerFlowRealtimeData.cs

` [JsonProperty("P_Grid")]
public decimal PGrid { get; set; }

    /// <summary>
    /// This value is null if no meter is enabled ( + generator, - consumer ) 
    /// </summary>
    [JsonProperty("P_Load")]
    public **decimal** PLoad { get; set; }

`

FroniusSolarClient.SolarClient[0]: An error occured: Input string 'xx.xxxxx' is not a valid integer. Path 'Body.Data.Site.rel_SelfConsumption', line 24, position 54.

Hi,

I'm confronted with this error message, when trying to GetPowerFlowRealtimeData() of my Fronius Symo 15.0-3-M. Fetching other data like GetCommonInverterData() works fine. I'm using version 0.4.0 of the package within an ASP.Net Core (.net5) application. Probably it has something to do with the firmware version of the Inverter? I updated the firmware just yesterday to version 3.18.7-1.
Any other ideas?

Thank you very much!
Patrick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.