Dashboard input for upper and lower threshold hysteresis

Hi,

I am controlling a peltier heating element in conjunction with a thermometer to regulate the temperature of a heat exchanger using node-red-contrib-hysteresis. It works perfectly but it requires the upper and lower threshold to be inputted in the hysteresis node. Is there anyway I could use the text input node of dashboard to send the upper and lower threshold to the hysteresis node instead of setting it manually in the hysteresis node?

Thanks a lot. I feel like I have tried everything to no avail.

Hi and welcome to Node-Red.

You didn't specify if you want to use one or two (text) nodes for the input.

So the easiest way would be to have two. One the lower and the second the upper limit.

In the node's settings you select the mode and set it to number.

If you want to use only one node, then it gets a bit tricky. But not impossible.
You would have to leave the node's mode to text which would allow you to use a special character as a delimiter for the two values.

The hysteresis node:

Yes the documentation is a bit poor for me to understand.

How do you set the values with inject nodes?

EXPORT the flow and paste it here after reading this: How to post code

Thank you for your reply,

Using the text node on number mode and having two inputs would work fine with me. The values for the hysteresis can be set using the inject node, but I generally read the raw temperature data from the sensor. I shall include both in the code below.

So in this example, how could I set the upper and lower threshold using the inject node?

[
    {
        "id": "a0a5fb88.c4d95",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "eb852bf.e0770d8",
        "type": "hysteresis",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "ThresholdType": "fixed",
        "ThresholdRising": "36",
        "ThresholdFalling": "38",
        "TopicThreshold": "",
        "TopicCurrent": "",
        "ThresholdDeltaRising": "",
        "ThresholdDeltaFalling": "",
        "InitialMessage": false,
        "OutRisingType": "pay",
        "OutRisingValue": "",
        "OutFallingType": "pay",
        "OutFallingValue": "",
        "OutTopicType": "top",
        "OutTopicValue": "",
        "x": 220,
        "y": 240,
        "wires": [
            [
                "1d74aee2.332291",
                "96c8167f.c81aa"
            ]
        ]
    },
    {
        "id": "1d74aee2.332291",
        "type": "function",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "func": "msg.payload = msg.hystdirection\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 240,
        "wires": [
            [
                "efdea502.5d96f8"
            ]
        ]
    },
    {
        "id": "efdea502.5d96f8",
        "type": "switch",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "high",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "low",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 490,
        "y": 240,
        "wires": [
            [
                "419e940c.b457a4"
            ],
            [
                "d04e5270.f5fce"
            ]
        ]
    },
    {
        "id": "419e940c.b457a4",
        "type": "change",
        "z": "a0a5fb88.c4d95",
        "name": "Off",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 650,
        "y": 180,
        "wires": [
            [
                "8ac765e8.628cb8"
            ]
        ]
    },
    {
        "id": "d04e5270.f5fce",
        "type": "change",
        "z": "a0a5fb88.c4d95",
        "name": "On",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "100",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 650,
        "y": 300,
        "wires": [
            [
                "8ac765e8.628cb8"
            ]
        ]
    },
    {
        "id": "8ac765e8.628cb8",
        "type": "rpi-gpio out",
        "z": "a0a5fb88.c4d95",
        "name": "Red (Heater)",
        "pin": "32",
        "set": false,
        "level": "0",
        "freq": "",
        "out": "pwm",
        "x": 830,
        "y": 240,
        "wires": []
    },
    {
        "id": "a3ea80cb.df824",
        "type": "rpi-ds18b20",
        "z": "a0a5fb88.c4d95",
        "topic": "",
        "array": false,
        "name": "",
        "x": 90,
        "y": 320,
        "wires": [
            [
                "eb852bf.e0770d8"
            ]
        ]
    },
    {
        "id": "10b4d234.d3189e",
        "type": "inject",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "topic": "",
        "payload": "33",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 60,
        "wires": [
            [
                "eb852bf.e0770d8"
            ]
        ]
    },
    {
        "id": "2a564c02.c6290c",
        "type": "inject",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "topic": "",
        "payload": "50",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 120,
        "wires": [
            [
                "eb852bf.e0770d8"
            ]
        ]
    },
    {
        "id": "96c8167f.c81aa",
        "type": "debug",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 360,
        "y": 160,
        "wires": []
    },
    {
        "id": "8712ea62.029fa",
        "type": "inject",
        "z": "a0a5fb88.c4d95",
        "name": "",
        "topic": "",
        "payload": "37",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 180,
        "wires": [
            [
                "eb852bf.e0770d8"
            ]
        ]
    }
]

You didn't read the link did you?

Use the</> button to paste code.

I will try to import it, but am not holding my breath it will work.

It worked, but only through luck I think.

Ok, so how do you set the initial values?

It won't deploy until the threshold node is set correctly.

It looks like the only input accepted is the payload & thresholds are set only in the config see here

You might want to ask the author of he could implement it (on the github issues pages)

I see the issue!

I shall reach out to the author and ask if he can implement it and post an update on here if he does.

Thanks!

Thanks for your help, it seems that Steve-Mcl found the issue. I am going to contact the author and see if I can get him to assist.

No problems.

I looked at the node in the library. It hasn't had work for more than a year.

You may not get much support. But good luck.

Hey Steve... That's a different node though.

Possibly better, but different to the one used in this thread.

Is it?

The op said...

I see what you mean but I think there has been some renaming.
Click the link and look in the code at line 2. It says hysteresis.

I traced it by going here on the flows library and clicking the GitHub link then I clicked the code link and looked at the code.........

Scratch that, you are right.

First time I did that it somehow lead to that first link I posted. How random. No idea how! Think there has been done jiggery pokery in the past as the Google search for node-red-contrib-hysteresis lead me to that first link

I realise pretty much none of what I've just wrote will make much sense but I'll finish by saying, Sorry to mislead you all :flushed:

Hey, don't worry. I've made that mistake before with other things.

I went to the library and entered hysteresis and found the node.

It is a poor node and not maintained.

You came along and posted the link and when I went there it wasn't the same place I was just at.

Anyway, no problems.

The one you posted is better supported anyway it would seem.

Assuming you are talking about https://flows.nodered.org/node/node-red-contrib-hysteresis then it says that it does allow the hysteresis to be specified in the message. Does not not work? If you think it doesn't then make a mini flow just using inject nodes to enter threshold and data values and post that here, telling us what should happen and what does happen.

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