A node-red-contrib-dsm question

#1

I have a question about the dsm node. I am looking at the hysteresis example on the wiki [1] and I want to change it so that it only sends a message on the way down and does nothing on the way up.
I tried

        "cross_high": [
            "msg = null;",
            "sm.fill = 'green';"
        ],

but then it just passed on the original message.

[1] https://github.com/cflurin/node-red-contrib-dsm/wiki/Hysteresis

#2

There is a dsm variable called output for this purpose.

Try:

        "cross_high": [
            "output = false;",
            "sm.fill = 'green';"
        ],
#3

Perfect, thanks. I missed that.
An excellent node, it just takes a bit of time to get one's head round.

#4

Thanks! I know I should improve the documentation. First I had to learn how to handle the data and methods. In the meantime, I hope the examples can help.

1 Like