# Use Switch to show current state

**URL:** <https://discourse.nodered.org/t/use-switch-to-show-current-state/31665>\
**Category:** Dashboard\
**Created:** [17 August 2020 14:31 UTC](https://discourse.nodered.org/t/use-switch-to-show-current-state/31665 "2020-08-17T14:31:30Z")\
**Posts on this page:** 3\
**Page:** 2

<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:** [17 August 2020 20:26 UTC](https://discourse.nodered.org/t/use-switch-to-show-current-state/31665/21 "2020-08-17T20:26:46Z")

</div>

Originally you had

> [@alexmacabu](#):
>
> The output of my UI-Switch nodes are:  
> Switch 1 On payload {"lamp1":"1"}  
> Switch 1 On payload {"lamp1":"0"}

You appear to have changed that for some reason, if you look at what you have coming in from mqtt you will see they don't match. I suggest changing the switch node back to what you had before.  
I had assumed you were sending strings, but I see they are objects, so you won't need the JSON nodes on the inputs

---

<div class="post-metadata">

**Author:** ![alexmacabu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/alexmacabu/32/27328_2.png) [@alexmacabu](https://discourse.nodered.org/u/alexmacabu)\
**Post date:** [18 August 2020 17:29 UTC](https://discourse.nodered.org/t/use-switch-to-show-current-state/31665/22 "2020-08-18T17:29:35Z")

</div>

Sorry for keeping you waiting for the answer, yesterday I've reached the 24h reply limit for new users... Well, good news! I've managed to solve it by changing the value from 1 and 0 to True and False, both on Python and NodeRED. So now my ui-Switch node sends {"lamp1":true} or {"lamp1":false}  
Your tip about using debug nodes to compare the messages comming in and comming out really helped me to understrand what was wrong! Thanks so much I wouldn't made it without you!

---

<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:** [1 September 2020 17:29 UTC](https://discourse.nodered.org/t/use-switch-to-show-current-state/31665/23 "2020-09-01T17:29:38Z")

</div>

Closed on 1 September 2020 17:29 UTC

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

[Previous page](https://discourse.nodered.org/t/use-switch-to-show-current-state/31665.md?page=1)
