SparkplugNet.nanoFramework 1.6.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package SparkplugNet.nanoFramework --version 1.6.0
                    
NuGet\Install-Package SparkplugNet.nanoFramework -Version 1.6.0
                    
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="SparkplugNet.nanoFramework" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SparkplugNet.nanoFramework" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="SparkplugNet.nanoFramework" />
                    
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 SparkplugNet.nanoFramework --version 1.6.0
                    
#r "nuget: SparkplugNet.nanoFramework, 1.6.0"
                    
#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 SparkplugNet.nanoFramework@1.6.0
                    
#: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=SparkplugNet.nanoFramework&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=SparkplugNet.nanoFramework&version=1.6.0
                    
Install as a Cake Tool

SparkplugNet for .NET nanoFramework

This project supports Sparkplug B Edge Nodes on stable .NET nanoFramework 1.x. It runs over MQTT 3.1.1 on IPv4 TCP and includes node and attached device lifecycles, command callbacks, metric aliases, rebirth, and the Sparkplug 2.2 and 3.0 Primary Host STATE formats.

The codec supports scalar metrics, byte and file values, and explicit nulls. Box values using the matching C# types, such as short for Int16, long for Int64, and Unix milliseconds as ulong for DateTime. Topics, groups, and edge and device IDs use Sparkplug B. This implementation is scoped to the Edge Node role and plain TCP. Templates, datasets, arrays, metadata, property sets, and TLS are outside its current scope.

In Sparkplug 3.0, data messages omit metric data types and fill missing metric timestamps with the payload timestamp. Pass the source's birth metrics to SparkplugBCodec.Decode when decoding a payload with omitted types. The Edge Node resolves incoming commands against the metrics of the addressed node or device.

Install

Install the SparkplugNet.nanoFramework NuGet package in a nanoFramework application, or build the project from source.

Build

Use the nanoFramework Visual Studio extension and run these commands from the repository root in a Visual Studio Developer PowerShell with NuGet CLI available.

nuget restore src/SparkplugNet.nanoFramework/packages.config -PackagesDirectory packages
msbuild src/SparkplugNet.nanoFramework/SparkplugNet.nanoFramework.nfproj /p:Configuration=Release

To use a source build, add the .nfproj as a project reference. Deploy the application to a device with networking enabled. Configure the network and UTC clock before connecting. Use a broker address reachable from the device.

Publish metrics

using SparkplugNet.NanoFramework;

var options = new MqttConnectionOptions("192.168.1.50", "plant-1-sensor-1");
using (var node = new SparkplugNode(options, "Plant 1", "Sensor 1"))
{
    node.Connect(new[] { new Metric("temperature", MetricDataType.Float, 20.5f) { Alias = 1 } });
    node.PublishNodeData(new[] { new Metric("temperature", MetricDataType.Float, 21.0f) });

    while (node.IsConnected)
    {
        node.Poll(1000);
    }
}

Call Poll regularly on the same thread as the other node methods. It processes commands and keeps the MQTT session alive. When you specify a Primary Host ID, wait for IsOnline before publishing data. If the Primary Host goes offline, the client closes the session. The application can call Connect again to start a new session. Save NextBirthDeathSequence and pass it as initialBdSeq to preserve the birth/death sequence across restarts.

Run the desktop test project to check codec interoperability with the standard SparkplugNet protobuf implementation. The HiveMQ CE and Eclipse Sparkplug TCK setup provides a broker for exercising the Edge Node.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
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.6.1 92 11/30/2026
1.6.0 106 11/24/2026
1.5.0 101 11/23/2026