Slider in the dashboard

Hi all,

I have a problem with the slider in dashboard. I want to get the value of the slider in my flow, so I can use the value to interact with other nodes.....okay...I'll explain it:
I have a temperature sensor on my grove base hat. This one gives me a msg.payload.temperature. On my dashboard I want to have a slider to setting up the temperature I want. The function node has to improve, if the slider value is higher or lower than the real temperature in the room and have to send a message to a grove servo motor......like an automatic heating control.....
Sorry for my bad english !!!:frowning:

Greets Steven

Which bit is the problem? To get the slider value in the flow just feed the output of slider node into wherever you need it. Start by feeding it into a debug node and see what it shows.

Okay.....the slider gives me a msg.payload......an how can I compare it with the msg.payload from my temperature sensor. I have the following flow.....and what do insert the slider in my flow to adjust the temperature in my "Temperatureinstellung"-function !!!

[{"id":"912d9af5.bae1b8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"531f558c.04a7bc","type":"grove-led","z":"912d9af5.bae1b8","name":"","port_number":"5","x":920,"y":360,"wires":[]},{"id":"8b82bdd3.4dc37","type":"grove-ultrasonic-ranger","z":"912d9af5.bae1b8","name":"","port_number":"16","x":350,"y":360,"wires":[["82d22b3a.e847b","2433b155.0f95f6"]]},{"id":"5eb597a7.158ab8","type":"grove-temperature-humidity-sensor-sht3x","z":"912d9af5.bae1b8","name":"","x":400,"y":160,"wires":[["2fe48072.9f901","ad1f3a05.bcbab8","d84e58f3.fe509"]]},{"id":"a93ee800.d2c258","type":"grove-servo","z":"912d9af5.bae1b8","name":"","port_number":"18","x":1190,"y":100,"wires":[]},{"id":"2433b155.0f95f6","type":"function","z":"912d9af5.bae1b8","name":"LED an/aus","func":"m = msg.payload;\nif (m < 20){\nreturn {payload:1};\n\n}\nelse\n{return {payload:0};\n}\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":360,"wires":[["531f558c.04a7bc","764b2319.9a5e3c"]]},{"id":"82d22b3a.e847b","type":"debug","z":"912d9af5.bae1b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":710,"y":320,"wires":[]},{"id":"2fe48072.9f901","type":"debug","z":"912d9af5.bae1b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":710,"y":60,"wires":[]},{"id":"7b933aa.69200c4","type":"inject","z":"912d9af5.bae1b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":360,"wires":[["8b82bdd3.4dc37"]]},{"id":"d84e58f3.fe509","type":"function","z":"912d9af5.bae1b8","name":"Temperatur","func":"msg.payload = msg.payload.temperature;\n\nreturn msg;\n","outputs":1,"noerr":0,"x":710,"y":120,"wires":[["4e0398eb.112ab","ddb54f4f.21cf78","a2ffa65d.7bd2f8"]]},{"id":"ad1f3a05.bcbab8","type":"function","z":"912d9af5.bae1b8","name":"Luftfeuchtigkeit","func":"msg.payload = msg.payload.humidity;\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":180,"wires":[["a02646a4.0816c","ab42d587.0cca38"]]},{"id":"4e0398eb.112ab","type":"debug","z":"912d9af5.bae1b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":60,"wires":[]},{"id":"a02646a4.0816c","type":"debug","z":"912d9af5.bae1b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":930,"y":180,"wires":[]},{"id":"ddb54f4f.21cf78","type":"ui_gauge","z":"912d9af5.bae1b8","name":"Temperatur","group":"6b09131.d4db4ec","order":2,"width":0,"height":0,"gtype":"gage","title":"Temperatur","label":"°C","format":"{{value}}","min":0,"max":"40","colors":["#0000ff","#ff8000","#ca3838"],"seg1":"15","seg2":"25","x":930,"y":140,"wires":[]},{"id":"ab42d587.0cca38","type":"ui_gauge","z":"912d9af5.bae1b8","name":"Luftfeuchtigkeit","group":"6b09131.d4db4ec","order":3,"width":0,"height":0,"gtype":"gage","title":"Luftfeuchtigkeit","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":940,"y":220,"wires":[]},{"id":"764b2319.9a5e3c","type":"debug","z":"912d9af5.bae1b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":320,"wires":[]},{"id":"8f552b84.04b698","type":"inject","z":"912d9af5.bae1b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":160,"wires":[["5eb597a7.158ab8"]]},{"id":"68628fb3.75fc98","type":"ui_slider","z":"912d9af5.bae1b8","name":"","label":"slider","tooltip":"","group":"6b09131.d4db4ec","order":2,"width":0,"height":0,"passthru":false,"outs":"all","topic":"einstellung","min":0,"max":10,"step":1,"x":550,"y":240,"wires":[[]]},{"id":"a2ffa65d.7bd2f8","type":"function","z":"912d9af5.bae1b8","name":"Heizungseinstellung","func":"temp = msg.payload;\nif (temp<20)\n{return {payload: 120};}\nelse if (temp<21){return {payload:60};}\nelse if (temp>21){return {payload:0};}\nreturn msg;\n","outputs":1,"noerr":0,"x":960,"y":100,"wires":[["a93ee800.d2c258","b983074e.641c18"]]},{"id":"b983074e.641c18","type":"debug","z":"912d9af5.bae1b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":60,"wires":[]},{"id":"6b09131.d4db4ec","type":"ui_group","z":"","name":"Temperatur und Luftfeuchtigkeit","tab":"f7685c59.22516","disp":true,"width":"10","collapse":false},{"id":"f7685c59.22516","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

To compare the values you will first have to get the values from both messages (the sensor and the slider) into a combined message. This post will give you an idea how to do that. https://cookbook.nodered.org/basic/join-streams
Start by importing the flow there and play with it to see how it works. For your case you will also want to set the And For Every Subsequent Message checkbox in the Join node.

Thanks, Colin, I think that's soving my problem !!! Great !!!!!!! :slight_smile:

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