• Docs
  • Home

›Messages

Messages

  • Set Property Fixed
  • Delete Message Property
  • Move Property
  • Map Range

Data Formats

  • Convert to/from JSON
  • Convert to/from XML
  • Convert to/from YAML
  • Generate CSV output
  • Parse CSV input
  • Simple GET request
  • Split text

Flow Control

  • Trigger On Start
  • Trigger At Interval
  • Trigger At Time
  • Route On Property
  • Route On Context
  • Operate On Array
  • Trigger Timeout
  • Trigger Placeholder
  • Rate Limit Messages
  • Rate Limit Message Stream
  • Report By Exception
  • Join Streams

Error handling

  • Retry On Error
  • Trigger On Error

HTTP Endpoints

  • Create Endpoint
  • Handle Query Parameters
  • Handle Url Parameters
  • Access Headers
  • Serve JSON
  • Serve Local File
  • Post Data
  • Post Form Data
  • Post JSON
  • Cookies

HTTP Requests

  • GET Request
  • Set URL
  • Set URL using Template
  • Set Query String
  • Parse JSON
  • Binary Response
  • Set Request Header

MQTT

  • MQTT broker
  • Publish Message
  • Set the topic
  • Publish Retained Message
  • Subscribe to a topic
  • Receive a parsed JSON message

OData

  • Define a Metadata Model
  • Define Metadata Model using EDM
  • Convert Request to Query
  • Read Only OData Service
  • Create an OData Service

Sequelize

  • Execute a Query

Auth

  • Basic Authentication
  • Generate JWT
  • Verify JWT

JSONata

  • JSONata Node
  • JSONata Explorer

Breakpoint

  • Introduction
  • How to Use

OpenAPI

  • Introduction
  • OpenAPI Router
  • OpenAPI Client

Release Management

  • Upload Download Release Management

Designer

  • Designer

Monitor

  • Introduction
  • How To Use

CI/CD

  • Introduction
  • Installation

Map a property between different numeric ranges

Problem

You want to scale a number from one numeric range to another. For example, a sensor reading in the range 0 - 1023 should be mapped to a voltage range of 0 - 5.

Solution

Use the Range node to map between the defined ranges.

Example

Flow JSON

[{"id":"80dae67d.b4d8f8","type":"inject","z":"535331d8.55c1f","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"x":130,"y":380,"wires":[["81f13534.456348"]]},{"id":"81f13534.456348","type":"range","z":"535331d8.55c1f","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"name":"","x":350,"y":420,"wires":[["e80b61d7.4b399"]]},{"id":"cb21de23.75a2f","type":"inject","z":"535331d8.55c1f","name":"","topic":"","payload":"512","payloadType":"num","repeat":"","crontab":"","once":false,"x":130,"y":420,"wires":[["81f13534.456348"]]},{"id":"342552de.255a1e","type":"inject","z":"535331d8.55c1f","name":"","topic":"","payload":"1023","payloadType":"num","repeat":"","crontab":"","once":false,"x":130,"y":460,"wires":[["81f13534.456348"]]},{"id":"e80b61d7.4b399","type":"debug","z":"535331d8.55c1f","name":"","active":true,"console":"false","complete":"false","x":550,"y":420,"wires":[]}]

Discussion

The Range node can be used to linearly scale between two different numberic ranges.

By default, the result is not constrained to the range defined in the node. This means using the voltage example above, a value of 2046 would map to a result of 10.

The node can be configured to constrain the result to the target range, or apply simple modulo arithmetic so the value wraps within the target range.

← Move PropertyConvert to/from JSON →
  • Problem
  • Solution
  • Example
  • Discussion
Copyright © 2021 Cyber Group