Bergdahl.Growcube.Client 1.0.0

dotnet add package Bergdahl.Growcube.Client --version 1.0.0
                    
NuGet\Install-Package Bergdahl.Growcube.Client -Version 1.0.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="Bergdahl.Growcube.Client" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bergdahl.Growcube.Client" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Bergdahl.Growcube.Client" />
                    
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 Bergdahl.Growcube.Client --version 1.0.0
                    
#r "nuget: Bergdahl.Growcube.Client, 1.0.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 Bergdahl.Growcube.Client@1.0.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=Bergdahl.Growcube.Client&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Bergdahl.Growcube.Client&version=1.0.0
                    
Install as a Cake Tool

Bergdahl.Growcube.Client

Bergdahl.Growcube.Client

A modern, fully asynchronous .NET client for the Elecrow GrowCube, based on a reverse-engineered TCP protocol.

This library is domain-driven, event-based, and designed for long-running services and automation scenarios.

.NET 8

Async / await throughout

Domain events only (no raw protocol exposure)

Strongly typed commands and events

Curve/history retrieval with normalization helpers

Installation

dotnet add package Bergdahl.Growcube.Clientd

Basic usage

Create and connect a client

using Bergdahl.Growcube.Client;

var client = new GrowcubeClient(new GrowcubeClientOptions
{
    Host = "192.168.1.42",   // IP of your GrowCube
    AutoSyncTimeOnConnect = true
});

await client.ConnectAsync();

⚠️ The GrowCube only supports one active TCP client at a time. The official mobile app must not be connected at the same time.

Listening for events

The GrowCube continuously emits state and telemetry. You consume this via ListenAsync():

using Bergdahl.Growcube.Client.Events;

await foreach (var ev in client.ListenAsync())
{
    switch (ev)
    {
        case SensorReadingEvent s:
            Console.WriteLine(
                $"Channel {s.Channel}: {s.MoisturePercent}% moisture, pump open: {s.PumpOpen}");
            break;

        case WaterStateEvent w when w.WaterWarning:
            Console.WriteLine("⚠️ Water tank warning");
            break;

        case DeviceVersionEvent v:
            Console.WriteLine($"Firmware {v.FirmwareVersion}, DeviceId {v.DeviceId}");
            break;
    }
}

All events are domain-level. Unknown or future messages are surfaced as UnknownEvent.

Watering

Water immediately for a duration

await client.WaterAsync(
    GrowcubeChannel.A,
    TimeSpan.FromSeconds(5));

Scheduled (manual) watering

await client.SetScheduledWateringAsync(
    GrowcubeChannel.A,
    duration: TimeSpan.FromSeconds(6),
    interval: TimeSpan.FromHours(48));

Smart watering (moisture-based)

await client.SetSmartWateringAsync(
    GrowcubeChannel.A,
    minMoisture: 20,
    maxMoisture: 40,
    allowDaylight: true);

Disable watering

await client.DisableWateringAsync(GrowcubeChannel.A);

Curve / history data

The GrowCube stores per-day moisture history (“curve data”).

Retrieve curve data
var days = await client.GetCurveDataAsync(
    GrowcubeChannel.A,
    timeout: TimeSpan.FromSeconds(10));

Each item represents one day:

CurveDataEvent
{
    Channel,
    Date,
    Values   // IReadOnlyList<int>
}
Normalize curve data into a time series

Use the extension helpers in Bergdahl.Growcube.Client.Curve:

using Bergdahl.Growcube.Client.Curve;

var series = days
    .DeduplicateByDate()
    .ToTimeSeries(TimeSpan.FromMinutes(30));

foreach (var point in series)
{
    Console.WriteLine($"{point.Timestamp}: {point.Value}");
}

Wi-Fi configuration

await client.SetWifiAsync("MySSID", "MyPassword");

⚠️ Expect the connection to drop after sending Wi-Fi settings.

Discovery

using Bergdahl.Growcube.Client.Discovery;

var devices = await GrowcubeDiscovery.DiscoverAsync(
    "192.168.1.0/24",
    TimeSpan.FromMilliseconds(500));

foreach (var ip in devices)
    Console.WriteLine($"Found GrowCube at {ip}");
´´´

## Related repositories

 - Protocol reverse-engineering notes:
   https://github.com/jonnybergdahl/Hacking_GrowCube

 - Original Python client:
   https://github.com/jonnybergdahl/Python-growcube-client

## License

MIT, see LICENSE file for details.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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.0 136 12/28/2025