rangenode

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rangenode contains the range node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RangeConfig

type RangeConfig struct {
	// Action is "scale" (default, extrapolate freely), "drop"
	// (discard out-of-range messages), "clamp" (clamp to the input
	// range) or "roll" (wrap into the input range)
	Action string `json:"action"`
	// Property is the dotted path into the payload; "payload" (the
	// default) targets the whole payload
	Property string  `json:"property"`
	MinIn    float64 `json:"minin"`
	MaxIn    float64 `json:"maxin"`
	MinOut   float64 `json:"minout"`
	MaxOut   float64 `json:"maxout"`
	// Round rounds the scaled result to the nearest integer
	Round bool `json:"round"`
}

RangeConfig holds configuration for the range node — the Node-RED range equivalent. MinIn/MaxIn define the input range, MinOut/MaxOut the output range the value is linearly mapped to.

type RangeNode

type RangeNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

RangeNode linearly maps a numeric payload property from an input range to an output range, with an optional out-of-range action applied to the input range before scaling.

func NewRangeNode

func NewRangeNode(node nodestore.NodeInterface, config *RangeConfig) *RangeNode

NewRangeNode creates a new range node

func (*RangeNode) Execute

Execute reads the configured property, applies the out-of-range action, scales the value and writes it back. A non-numeric value or a value dropped by the "drop" action ends the message here (nil output); a missing property passes the message through unchanged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL