AutomationPipelines 0.2.0

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

AutomationPipelines

Composable, reactive, and layered logic pipelines for C# automation

In complex systems, multiple conditions often need to influence a single behavior. Instead of funneling all logic into a single block, AutomationPipelines encourages clean separation of concerns using a flexible, node-based pipeline model.

At its core is the Pipeline<TState> class, which coordinates a chain of self-contained logic units (IPipelineNode<TState>). Each node can independently process input, produce output, or opt out entirely—while maintaining full support for dependency injection.

Why use AutomationPipelines?

  • Modular Logic: Each pipeline node is a focused class with a single responsibility.
  • Dependency Injection Support: Nodes can depend on external services, entities, or sensors—perfect for reactive systems like NetDaemon or Home Assistant.
  • Prioritized Overrides: Later nodes in the pipeline can override the output of earlier ones, enabling intuitive layering and override mechanisms.
  • Reactive and Self-Contained: Nodes are notified when input changes and can independently decide their output—or disable themselves to pass values through untouched.

This approach leads to cleaner, more maintainable automation logic—especially in event-driven or rules-based environments.

Real-World Usage

This library was designed with automation platforms like NetDaemon in mind but is suitable for any scenario where behavior is built from layered rules and inputs.

Check out CodeCasa on GitHub for real-world examples and usage patterns.

Example

[NetDaemonApp]
internal class PipelineTest
{
    public PipelineTest(IPipeline<string> messagesPipeline)
    {
        messagesPipeline
            .RegisterNode<DefaultMessageNode>()
            .RegisterNode<OfficeLightsMessageNode>()
            .RegisterNode<CherryOnTopMessageNode>()
            .SetOutputHandler(Console.WriteLine);
    }
}

// Provides a default message when no other conditions are met
public class DefaultMessageNode : PipelineNode<string>
{
    public DefaultMessageNode()
    {
        Output = "Default message";
    }
}

// Overrides message if the office lights are turned on
public class OfficeLightsMessageNode : PipelineNode<string>
{
    public OfficeLightsMessageNode(LightEntities lightEntities)
    {
        lightEntities.OfficeLights.SubscribeOnOff(
            () => Output = "ON",
            DisableNode
        );
    }
}

// Modifies the incoming message by appending a "cherry on top"
public class CherryOnTopMessageNode : PipelineNode<string>
{
    protected override void InputReceived(string? input)
    {
        Output = string.IsNullOrEmpty(input)
            ? "Just a cherry"
            : $"{input} with a cherry on top";
    }
}

In this example:

  • The DefaultMessageNode sets an initial message.
  • The OfficeLightsMessageNode conditionally overrides it based on light state.
  • The CherryOnTopMessageNode decorates the result with additional context.

The output handler is called whenever the final result changes, keeping logic reactive and centralized.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.

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
0.2.0 118 5/11/2025
0.1.0 97 5/11/2025