Values from the dashboard to a node

Hello,
at first I have to say, that I have not so much experience with node-red. But I think someone can help me about my question.
Currently I switch on/off a fan depending on the actual humidity with fix on/off values.
I would like to change the on/off values on the dashboard.
The flow looks like this:


The function like this:
image

So now i would like to set the value "62" in the dashboard and not directly in the code.
Is this possible?

Thanks

You could place a 'Slider' widget on your dashboard and send the slider-value to 'context' flow-variable.
Then in your function node you could 'get' the flow-variable from 'context' and use it in your 'if-else' construct.

slider

slider_dash

[{"id":"c85ddfd9b2124e4a","type":"tab","label":"Flow 37","disabled":false,"info":"","env":[]},{"id":"621917ccd2dff99f","type":"ui_slider","z":"c85ddfd9b2124e4a","name":"","label":"Humidity","tooltip":"","group":"4045eb716a4077f5","order":0,"width":"1","height":"6","passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":270,"y":200,"wires":[["6f7acfa33ad6d7ee"]]},{"id":"6f7acfa33ad6d7ee","type":"change","z":"c85ddfd9b2124e4a","name":"","rules":[{"t":"set","p":"humidity","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":200,"wires":[[]]},{"id":"4045eb716a4077f5","type":"ui_group","name":"Default","tab":"bf43de97.2470a8","order":5,"disp":true,"width":"6","collapse":false,"className":""},{"id":"bf43de97.2470a8","type":"ui_tab","name":"Owntracks","icon":"dashboard","order":1}]

Note: I've shown the orientation of the slider as vertical, you can alter it to horizontal (to save space).

slider_horz

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