# Roller shutter: Use slider to move up and down

**URL:** <https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583>\
**Category:** General\
**Created:** [6 July 2020 06:58 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583 "2020-07-06T06:58:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 06:58 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/1 "2020-07-06T06:58:45Z")

</div>

Hi all,

I am a little bit stuck. I would like to use a slider to move my roller shutter without MQTT. I have the right URL which works well, but here is my challenge:

The URL in my http-request-node is like: "[http://192.168.XXX.XXX/roller/0?go=to\_pos&roller\_pos=](http://192.168.XXX.XXX/roller/0?go=to_pos&roller_pos=)"

THe value for the position should be provided by the slider - the payload is the number which could be used. But I do not get it, how I use the msg.payload from the slider to complete the above url - how would you solve it?

I treid to use a function and combine the values to one variable and return it as one value form the function to the http-request-node. But the function node only gives out an error message that it tried to return a string.

Does anyone have a clue , hint for me? 🙂

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 08:15 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/2 "2020-07-06T08:15:09Z")

</div>

you can use the template mustashe,

```auto
http://192.168.xxx.xxx/roller/0?go=to_pos&roller_pos={{payload.whateverelement}}

```

or

make sure you return a object  
so in your function return {"payload": your\_var};

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 08:30 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/3 "2020-07-06T08:30:43Z")

</div>

How do I know which "element" I have to use? Now it looks better, but the http-request-node says "invalid payload".

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 08:32 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/4 "2020-07-06T08:32:32Z")

</div>

put a debug after the slider node and post the output message.

It is most likely just "payload".

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 08:37 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/5 "2020-07-06T08:37:30Z")

</div>

Maybe this helps:

```auto
[{"id":"f812e60c.6453c","type":"ui_slider","z":"f1a51433.4fb368","name":"Küchenslider","label":"","tooltip":"","group":"bd3c2028.1a693","order":4,"width":"6","height":"1","passthru":true,"outs":"end","topic":"","min":0,"max":"100","step":1,"x":430,"y":180,"wires":[["27a93478.46fee4"]]},{"id":"b5cae51e.e66648","type":"http request","z":"f1a51433.4fb368","name":"Küchenfenster_Slider_Position","method":"GET","ret":"obj","paytoqs":true,"url":"http://192.168.XXX.20/roller/0?go=to_pos&roller_pos={{payload.msg}}","tls":"","persist":false,"proxy":"","authType":"basic","x":810,"y":160,"wires":[["b12aeef3.f11cc"]]},{"id":"b12aeef3.f11cc","type":"debug","z":"f1a51433.4fb368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":850,"y":320,"wires":[]},{"id":"4a87804b.ff31a","type":"debug","z":"f1a51433.4fb368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":320,"wires":[]},{"id":"27a93478.46fee4","type":"function","z":"f1a51433.4fb368","name":"","func":"var message = msg.payload;\nvar url = \"http://192.168.xxx.20/roller/0?go=to_pos&roller_pos=\";\n//msg = url.toString() + message.toString();\nreturn {\"payload\": message};\n\n\n//x = msg.toString(8);\n//return \"http://192.168.178.20/roller/0?go=to_pos&roller_pos=\"+ msg.toString();\n\n//msg1 = (\"http://192.168.xxx.20/roller/0?go=to_pos&roller_pos=\"+ x);\n//return msg1;","outputs":1,"noerr":0,"x":610,"y":220,"wires":[["4a87804b.ff31a","b5cae51e.e66648"]]},{"id":"bd3c2028.1a693","type":"ui_group","z":"","name":"Rolläden","tab":"f2bb749e.fdb478","order":1,"disp":true,"width":"18","collapse":false},{"id":"f2bb749e.fdb478","type":"ui_tab","z":"","name":"Rolläden","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 08:42 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/6 "2020-07-06T08:42:06Z")

</div>

PLEASE PUT ``` BEFORE AND AFTER THE CODE ON NEW LINE SO CODE IS FORMATTED CORRECTLY and there is an easy link to click to copy your flow

that is the node exported. We need to seed the output from the slider node.  
like this

 ![Screenshot_20200706-094119](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e343de5358222679b4c8289ba109847ab3462ea2.png)

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 08:44 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/7 "2020-07-06T08:44:29Z")

</div>

I get the output from the slider, but the http-request-node does not work as I expected. I updated my post with the exported code, did you recognize it? 🙂

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 08:45 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/8 "2020-07-06T08:45:33Z")

</div>

Post your code like below

```  
your code  
```

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 08:46 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/9 "2020-07-06T08:46:33Z")

</div>

_\> [{"id":"f812e60c.6453c","type":"ui\_slider","z":"f1a51433.4fb368","name":"Küchenslider","label":"","tooltip":"","group":"bd3c2028.1a693","order":4,"width":"6","height":"1","passthru":true,"outs":"end","topic":"","min":0,"max":"100","step":1,"x":430,"y":180,"wires":[["27a93478.46fee4"]]},{"id":"b5cae51e.e66648","type":"http request","z":"f1a51433.4fb368","name":"Küchenfenster\_Slider\_Position","method":"GET","ret":"obj","paytoqs":true,"url":"[http://192.168.XXX.20/roller/0?go=to\_pos&roller\_pos={{payload.msg}](http://192.168.XXX.20/roller/0?go=to_pos&roller_pos=%7B%7Bpayload.msg%7D)}","tls":"","persist":false,"proxy":"","authType":"basic","x":810,"y":160,"wires":[["b12aeef3.f11cc"]]},{"id":"b12aeef3.f11cc","type":"debug","z":"f1a51433.4fb368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":850,"y":320,"wires":},{"id":"4a87804b.ff31a","type":"debug","z":"f1a51433.4fb368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":320,"wires":},{"id":"27a93478.46fee4","type":"function","z":"f1a51433.4fb368","name":"","func":"var message = msg.payload;\nvar url = "[http://192.168.xxx.20/roller/0?go=to\_pos&roller\_pos=](http://192.168.xxx.20/roller/0?go=to_pos&roller_pos=)";\n//msg = url.toString() + message.toString();\nreturn {"payload": message};\n\n\n//x = msg.toString(8);\n//return "[http://192.168.xxx.20/roller/0?go=to\_pos&roller\_pos=](http://192.168.xxx.20/roller/0?go=to_pos&roller_pos=)"+ msg.toString();\n\n//msg1 = ("[http://192.168.xxx.20/roller/0?go=to\_pos&roller\_pos=](http://192.168.xxx.20/roller/0?go=to_pos&roller_pos=)"+ x);\n//return msg1;","outputs":1,"noerr":0,"x":610,"y":220,"wires":[["4a87804b.ff31a","b5cae51e.e66648"]]},{"id":"bd3c2028.1a693","type":"ui\_group","z":"","name":"Rolläden","tab":"f2bb749e.fdb478","order":1,"disp":true,"width":"18","collapse":false},{"id":"f2bb749e.fdb478","type":"ui\_tab","z":"","name":"Rolläden","icon":"dashboard","disabled":false,"hidden":false}]_

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 08:47 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/10 "2020-07-06T08:47:46Z")

</div>

3 back ticks before and after on new line. back tick is left of the 1 key on keyboard, normally

The function is most likely over writting the msg.payload.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [6 July 2020 08:48 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/11 "2020-07-06T08:48:55Z")

</div>

The function node is unnecessary here as far as I understand. Just connect the slider node directly to http request. Set the request URL to: `http://192.168.xxx.xxx/roller/0?go=to_pos&roller_pos={{payload}}`

If this works, I would also consider adding a delay node in between to not overwhelm the roller shutters when moving the slider to the target position. This is if the slider constantly sends values when moved (I don't remember how it works tbh).

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 09:00 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/12 "2020-07-06T09:00:58Z")

</div>

i f i directly connect it:

"Invalid payload"

Code:

```auto
[{"id":"b058fa45.3251c8","type":"ui_slider","z":"f1a51433.4fb368","name":"Küchenslider","label":"","tooltip":"","group":"bd3c2028.1a693","order":4,"width":"6","height":"1","passthru":true,"outs":"end","topic":"","min":0,"max":"100","step":1,"x":290,"y":180,"wires":[["666ccb61.a3b414"]]},{"id":"1c89ddd2.83bfda","type":"http request","z":"f1a51433.4fb368","name":"Küchenfenster_Slider_Position","method":"GET","ret":"obj","paytoqs":true,"url":"http://192.168.178.20/roller/0?go=to_pos&roller_pos={{payload}}","tls":"","persist":false,"proxy":"","authType":"basic","x":850,"y":180,"wires":[["8674576b.1f7f9"]]},{"id":"8674576b.1f7f9","type":"debug","z":"f1a51433.4fb368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":890,"y":340,"wires":[]},{"id":"666ccb61.a3b414","type":"delay","z":"f1a51433.4fb368","name":"delay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":120,"wires":[["1c89ddd2.83bfda"]]},{"id":"bd3c2028.1a693","type":"ui_group","z":"","name":"Rolläden","tab":"f2bb749e.fdb478","order":1,"disp":true,"width":"18","collapse":false},{"id":"f2bb749e.fdb478","type":"ui_tab","z":"","name":"Rolläden","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 09:03 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/13 "2020-07-06T09:03:21Z")

</div>

^^^ are not ``` Please edit your post and add the back ticks . It makes life easier for people trying to help you.

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 09:05 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/14 "2020-07-06T09:05:05Z")

</div>

Got it, sorry 🙂

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 09:07 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/15 "2020-07-06T09:07:31Z")

</div>

In the http request block untick append msg.payload as query string parameters, als are your shelly's using username and password?

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [6 July 2020 09:09 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/16 "2020-07-06T09:09:27Z")

</div>

unticking the "append msg.payload" worked for me! mmh, interesting. Thanks a lot guys!

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 July 2020 09:14 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/17 "2020-07-06T09:14:41Z")

</div>

You can pass the query as a payload, so if you create the msg.payload in your function node like below.

```auto
msg.payload ={ "go": "to_pos", "roller_pos": msg.payload}

```

then if you tick append msg.payload, then your url would be

```auto
http://192.168.xxx.xxx/roller/0

```

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [6 July 2020 09:14 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/18 "2020-07-06T09:14:49Z")

</div>

The append msg.payload option attempts to parse a payload object into query parameters. So in this case you'd need a node to send a payload:

```auto
{
  "go": "to_pos", 
  "roller_pos": <number_from_slider> 
}

```

.. and then have the URL as just: [http://192.168.xxx.xxx/roller/0](http://192.168.xxx.xxx/roller/0). The `go` and `roller_pos` query parameters would be generated from the payload. But nevermind that now it you already got it working.

Edit: like @E1cid replied faster.

---

<div class="post-metadata">

**Author:** ![Sempel](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sempel](https://discourse.nodered.org/u/Sempel)\
**Post date:** [7 July 2020 19:37 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/19 "2020-07-07T19:37:34Z")

</div>

Thanks to all helping to to better understand 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 July 2020 19:37 UTC](https://discourse.nodered.org/t/roller-shutter-use-slider-to-move-up-and-down/29583/20 "2020-07-21T19:37:41Z")

</div>

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