# Basic help sending an MQTT payload via a slider

**URL:** <https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516>\
**Category:** General\
**Created:** [1 April 2021 18:30 UTC](https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516 "2021-04-01T18:30:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesd256](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jamesd256](https://discourse.nodered.org/u/jamesd256)\
**Post date:** [1 April 2021 18:30 UTC](https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516/1 "2021-04-01T18:30:25Z")

</div>

Hi,

Just migrating a dashboard I had set up inside HA so that it becomes just an MQTT based version.

In the HA version, I'm connecting a dashboard slider to a call service node, and can manipulate the payload on the call service side like this:

```auto

{ "brightness_pct":msg.payload	}

```

With the MQTT approach, apparently I cannot manipulate the payload on either side. On the slider side, payload is just hard wired to 'Current state', and on the MQTT side, there doesn't seem to be anywhere to set the payload that goes to the MQTT topic. I can see in MQTT Explorer, my light is showing

```auto

set = 49

```

When I need it to say

```auto
set = {"brightness_pct": 49}

```

I tried putting the payload in the topic field, but it's not substituting the variable msg.payload.

Here's where I'm being thick. I found this solution:

> [@Value from slider](https://discourse.nodered.org/t/value-from-slider/20757/4):
>
> Hi, I tried it but there is only the value from the slider in the massage, so the massage is for example "1". But I need to add a string to this massage so that it looks like this :"brightness:1". I hope someone can help me. Thanks danny\_v1

But I don't know how to implement it ☹

I put a template node between my slider and MQTT out, and I put this value in the Template field:

```auto
brightness_pct:{{payload}}

```

But the debug shows the output of the template node is exactly the same as the output from the slider. No I don't understand template nodes yet, sorry being a noob. I'll get there.

---

<div class="post-metadata">

**Author:** ![jamesd256](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jamesd256](https://discourse.nodered.org/u/jamesd256)\
**Post date:** [1 April 2021 18:39 UTC](https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516/2 "2021-04-01T18:39:49Z")

</div>

I should type out my questions and not post, sorry.

I can see now template node was referring to the function template not the dashboard template node. Now it makes sense.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 April 2021 19:38 UTC](https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516/3 "2021-04-01T19:38:53Z")

</div>

I think this might be a simpler solution. Insert a Change node between the slider and the MQTT node configured like this.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3b7d9f8dfb7084bb90d1a7f781dea74dc578c328.png)

---

<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:** [15 April 2021 19:39 UTC](https://discourse.nodered.org/t/basic-help-sending-an-mqtt-payload-via-a-slider/43516/4 "2021-04-15T19:39:38Z")

</div>

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