A Node-RED flow to decrease your data precision according to the values passing through.
The expected payload format in input and output is:
type Payload = {
sensorId: string;
valueName: string;
date: string;
value: number;
precision?: number;
}[];
const myPayload: Payload = [
{
date: '2026-06-25T09:13:51.000Z',
precision: 100,
sensorId: 'rpi-temp',
value: 19,
valueName: 't',
},
{
date: '2026-06-25T09:13:51.000Z',
precision: 10,
sensorId: 'rpi-temp',
value: 500,
valueName: 't',
},
];This package uses ease-precision-drop under the hood so refer to its documentation if your need to better understand the drop functions.
Use docker to spawn your local Node-RED instance:
docker run -it -p 1880:1880 --name mynodered nodered/node-redInstall dependencies:
npm iBuilds the module and creates a .tgz package in the current directory.
npm run build
npm packPut it in the docker container:
docker container cp ./dvgroup-precision-drop-node-red-1.0.0.tgz mynodered:/dataAnd install it:
docker exec -ti mynodered bash
$ cd /data
$ npm i ./dvgroup-precision-drop-node-red-1.0.0.tgz
$ exit