Messages passing through flow Unaffected

I have a slide potentiometer connected over a network connection, sadly it only gives out a value randomly (though in order...) between 0 and 1000. I want to turn this so it is a linear count from 0 to 100 as integers.

I have created a flow that pretty much does this however I occasionally get numbers passed through to the debug which have not been round to integers and I can't work out why. I have modified my flow slightly to have a UI slider for ease of sharing but the de bug fault is identical.

Any ideas on why some numbers seem to pass from the easing to the debug without being affected by any of the other node would be greatly appreciated.

[
    {
        "id": "bf569dbfc3bc07ed",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c45a3989ff80c7a4",
        "type": "easing",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "easingType": "linear",
        "outputType": "overTime",
        "duration": "0.01",
        "interval": "1",
        "numberOfValues": 10,
        "x": 490,
        "y": 160,
        "wires": [
            [
                "5ad993757d3cf233"
            ]
        ]
    },
    {
        "id": "6c2f66a6d5b678c3",
        "type": "calculator",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "rdec",
        "constant": "0",
        "round": true,
        "truncate": false,
        "decimals": 0,
        "decimals2": 0,
        "x": 780,
        "y": 160,
        "wires": [
            [
                "0a5ef89e47b953d7"
            ]
        ]
    },
    {
        "id": "5ad993757d3cf233",
        "type": "calculator",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "div",
        "constant": "10",
        "round": false,
        "truncate": false,
        "decimals": 0,
        "decimals2": 0,
        "x": 610,
        "y": 160,
        "wires": [
            [
                "6c2f66a6d5b678c3"
            ]
        ]
    },
    {
        "id": "7beb0f4d70593695",
        "type": "function",
        "z": "bf569dbfc3bc07ed",
        "name": "function 63",
        "func": "// Initialize a context variable to store the previous timestamp\nvar previousTimestamp = context.get('previousTimestamp');\n\n// Get the current timestamp from the received message\nvar currentTimestamp = msg.payload.timestamp;\n\nif (previousTimestamp !== undefined) {\n    // Calculate the time difference in milliseconds\n    var timeDifference = currentTimestamp - previousTimestamp;\n\n    // Store the current timestamp as the previous timestamp for the next calculation\n    context.set('previousTimestamp', currentTimestamp);\n\n    // Convert the time difference to a more human-readable format (e.g., seconds)\n    var secondsDifference = timeDifference / 1000; // Convert milliseconds to seconds\n\n    // Update the message payload with the time difference\n    var timedifference = secondsDifference;\n} else {\n    // Initial timestamp, just store it for future reference\n    context.set('previousTimestamp', currentTimestamp);\n\n    // No time difference to calculate on the first message\n    return null; // Return null to prevent further processing for the first message\n}\n\n// Initialize a context variable to store the previous payload\nvar previousPayload = Number(context.get('previousPayload'))\n\n// Get the current payload from the received message\nvar currentPayload = Number(msg.payload.position)\n\nvar interval = (previousPayload-currentPayload)/timeDifference\n\n// Store the current payload as the previous payload for the next calculation\ncontext.set('previousPayload', currentPayload);\n\n// Create an output object containing both current and previous payloads\nvar output = {\n    from: previousPayload,\n    to: currentPayload,\n    duration: timeDifference,\n};\n\n// Update the message payload with the output object\nmsg.payload = output;\n\n// Pass the updated message to the next node\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 160,
        "wires": [
            [
                "c45a3989ff80c7a4"
            ]
        ]
    },
    {
        "id": "ddde0b321c989a29",
        "type": "function",
        "z": "bf569dbfc3bc07ed",
        "name": "function 64",
        "func": "var timestamp = new Date().getTime();\n\nmsg.payload = {\n    position: msg.payload,\n    timestamp: timestamp\n};\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 190,
        "y": 160,
        "wires": [
            [
                "7beb0f4d70593695"
            ]
        ]
    },
    {
        "id": "14c9110402cb054e",
        "type": "ui_slider",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "label": "slider",
        "tooltip": "",
        "group": "a80bda808bcfa70d",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "all",
        "topic": "topic",
        "topicType": "msg",
        "min": 0,
        "max": "1000",
        "step": "30",
        "className": "",
        "x": 50,
        "y": 160,
        "wires": [
            [
                "ddde0b321c989a29"
            ]
        ]
    },
    {
        "id": "0a5ef89e47b953d7",
        "type": "rbe",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 950,
        "y": 160,
        "wires": [
            [
                "397801287e57bd83"
            ]
        ]
    },
    {
        "id": "397801287e57bd83",
        "type": "switch",
        "z": "bf569dbfc3bc07ed",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "",
                "vt": "prev"
            },
            {
                "t": "neq",
                "v": "",
                "vt": "prev"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1070,
        "y": 160,
        "wires": [
            [],
            [
                "477603fc3e6944bf"
            ]
        ]
    },
    {
        "id": "477603fc3e6944bf",
        "type": "debug",
        "z": "bf569dbfc3bc07ed",
        "name": "debug 83",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1200,
        "y": 160,
        "wires": []
    },
    {
        "id": "7ae57ad07b38e925",
        "type": "comment",
        "z": "bf569dbfc3bc07ed",
        "name": "Actual Flow Starts Here",
        "info": "",
        "x": 380,
        "y": 120,
        "wires": []
    },
    {
        "id": "7004d5b2273d3447",
        "type": "comment",
        "z": "bf569dbfc3bc07ed",
        "name": "Simulating Network Input",
        "info": "",
        "x": 130,
        "y": 120,
        "wires": []
    },
    {
        "id": "a80bda808bcfa70d",
        "type": "ui_group",
        "name": "Config",
        "tab": "56d8f6d2b30a99c1",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "56d8f6d2b30a99c1",
        "type": "ui_tab",
        "name": "Configuration",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

I can not test your flow as there are 2 contrib nodes that i do not have installed.
Saying that does this flow not do what you require

[{"id":"14c9110402cb054e","type":"ui_slider","z":"bf569dbfc3bc07ed","name":"","label":"slider","tooltip":"","group":"a80bda808bcfa70d","order":4,"width":0,"height":0,"passthru":false,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"1000","step":"30","className":"","x":50,"y":160,"wires":[["7293c4acfd3bb760"]]},{"id":"7293c4acfd3bb760","type":"change","z":"bf569dbfc3bc07ed","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.position","tot":"msg"},{"t":"set","p":"payload.timestamp","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":220,"y":160,"wires":[["d6ce43a6e8225014"]]},{"id":"d6ce43a6e8225014","type":"range","z":"bf569dbfc3bc07ed","minin":"0","maxin":"1000","minout":"0","maxout":"100","action":"clamp","round":true,"property":"payload.position","name":"","x":390,"y":160,"wires":[["0a5ef89e47b953d7"]]},{"id":"0a5ef89e47b953d7","type":"rbe","z":"bf569dbfc3bc07ed","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload.position","topi":"topic","x":550,"y":160,"wires":[["477603fc3e6944bf"]]},{"id":"477603fc3e6944bf","type":"debug","z":"bf569dbfc3bc07ed","name":"debug 83","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":160,"wires":[]},{"id":"7ae57ad07b38e925","type":"comment","z":"bf569dbfc3bc07ed","name":"Actual Flow Starts Here","info":"","x":420,"y":120,"wires":[]},{"id":"a80bda808bcfa70d","type":"ui_group","name":"Config","tab":"56d8f6d2b30a99c1","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"56d8f6d2b30a99c1","type":"ui_tab","name":"Configuration","icon":"dashboard","disabled":false,"hidden":false}]

As to your issue possibly a bug in the contrib node/s

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.