# Change Inject Node To Dashboard Button For HTTP

**URL:** <https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139>\
**Category:** Dashboard\
**Created:** [1 February 2020 13:10 UTC](https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139 "2020-02-01T13:10:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Randy](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@Randy](https://discourse.nodered.org/u/Randy)\
**Post date:** [1 February 2020 13:10 UTC](https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139/1 "2020-02-01T13:10:05Z")

</div>

I found this flow that controls my Sonoff Mini from the palette using inject nodes. But how do I do that using dashboard buttons instead?

```auto
[{"id":"38075045.5bd73","type":"inject","z":"6bbeac55.3f39d4","name":"on","topic":"","payload":"{\"deviceid\": \"1000a5098b\",\"data\": {\"switch\": \"on\" }} ","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":157.10000610351562,"y":100,"wires":[["2101dfac.b2134"]]},{"id":"2101dfac.b2134","type":"http request","z":"6bbeac55.3f39d4","name":"","method":"POST","ret":"obj","url":"http://192.168.1.27:8081/zeroconf/switch","tls":"","x":396.10003662109375,"y":154.1999969482422,"wires":[[]]},{"id":"ef5051b5.77645","type":"inject","z":"6bbeac55.3f39d4","name":"off","topic":"","payload":"{\"deviceid\":\"1000a5098b\",\"data\":{\"switch\":\"off\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":159,"y":147.00000286102295,"wires":[["2101dfac.b2134"]]}]

```

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [1 February 2020 13:28 UTC](https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139/2 "2020-02-01T13:28:26Z")

</div>

I would rather use a dashboard switch node.

![r-2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc3ec6bcf39cd7e2933c612e095c81b93e2b8af3.png)

The configuration for the ui\_switch could be like the one below.

Edit: corrected (but anyway not tested)

 ![r-1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/9/792a1f3c33acb99b3a198daeb4948c91269968e1.png)

---

<div class="post-metadata">

**Author:** ![Randy](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@Randy](https://discourse.nodered.org/u/Randy)\
**Post date:** [1 February 2020 16:04 UTC](https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139/3 "2020-02-01T16:04:09Z")

</div>

That worked for executing on/off from the dashboard. Thanks!

---

<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 February 2020 16:04 UTC](https://discourse.nodered.org/t/change-inject-node-to-dashboard-button-for-http/21139/4 "2020-02-15T16:04:20Z")

</div>

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