Wyrm.ModBusClient.GivEnergy 1.0.2

dotnet add package Wyrm.ModBusClient.GivEnergy --version 1.0.2
                    
NuGet\Install-Package Wyrm.ModBusClient.GivEnergy -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Wyrm.ModBusClient.GivEnergy" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Wyrm.ModBusClient.GivEnergy" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Wyrm.ModBusClient.GivEnergy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Wyrm.ModBusClient.GivEnergy --version 1.0.2
                    
#r "nuget: Wyrm.ModBusClient.GivEnergy, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Wyrm.ModBusClient.GivEnergy@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Wyrm.ModBusClient.GivEnergy&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Wyrm.ModBusClient.GivEnergy&version=1.0.2
                    
Install as a Cake Tool

Wyrm.ModBusClient.GivEnergy

A client for accessing GivEnergy inverters using ModBus TCP. This currently only supports reading register data. IMPORTANT NOTE: This has only been tested on a GivEnergy Hybrid Gen3 Inverter with a single battery and single meter. Thanks to Dewet22 for the work on the https://github.com/dewet22/givenergy-modbus/ project that was used to produce this.

Usage

Add the GivEnergy client into dependency injection using the AddGivEnergyClient extension method.

using Wyrm.ModBusClient.GivEnergy.DependencyInjection;
...
services.AddGivEnergyClient();

By default, it is added as a Singleton but you can specify the lifetime.

services.AddGivEnergyClient(ServiceLifetime.Scoped);

Then inject the IGivEnergyClient interface into your class.

Call ConnectAsync before calling any of the methods. Send requests on a different thread to the one receiving responses. Make sure you Close the client when finished with it.

Functions

WaitForResponseAsync

This waits for a response from the inverter. It returns when one is received. Each response indicates the Serial Number and WiFi Adapter to distinguish it. The 'ResponseDataType' indicates what class the 'ResponseData' is. You will need to cast the response data to the relevant class to access the data values.

RequestInverterDataAsync

This requests that the inverter send specific data for a specific sub-device. Only a range of device indexes are allowed for each data type.

! Response Data Type Device Indices
BatteryData2 0 to 5
MeterData2 0 to 8
LowVoltageBCUData2 0 !
InverterData* 0
InverterProperties* 0

SendReadRegistersAsync

This is a more flexible version of RequestInverterDataAsync. You can specify the device address, whether to read holding registers (Inverter Properties) or input registers (Data), and the start address to read from. It will issue a request to read 60 registers from the start address (usually that is itself a multiple of 60).

SendCustomPduAsync

This allows a PDU that isn't a read registers one to be issued. GivEnergy inverters send a response that apparently needs to be echoed back. You'll get a GivEnergyClientException thrown by the WaitForResponseAsync method if it receives something it doesn't recognise, and you can then send that bak using the SendCustomPduAsync method.

...
catch (GivEnergyClientException ex)
{
    var dataSpan = ex.ErrorData.Span;
    if (dataSpan.Length == 13 && dataSpan[0] == 1 && dataSpan[1] == 1 && dataSpan[^1] == 1)
    {
        await client.SendCustomPduAsync(ex.ErrorData);
    }
    ...
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 84 9/29/2026
1.0.1 92 9/16/2026
1.0.0 91 9/15/2026