# How Can I Make Logic 1 and Logic 0 graphical with Node red and RPi 3

**URL:** <https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697>\
**Category:** Dashboard\
**Created:** [19 July 2018 14:40 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697 "2018-07-19T14:40:49Z")\
**Posts on this page:** 20\
**Page:** 2

<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:** [31 July 2018 14:11 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/21 "2018-07-31T14:11:23Z")

</div>

It is not trivial but still possible . Try flow below:

```auto
[{"id":"b954bdf6.7ca99","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"de3905bc.b94e48","type":"dsm","z":"b954bdf6.7ca99","name":"pump (forum)","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"running\",\n \"states\": {\n \"stopped\": {\n \"1\": \"running\"\n },\n \"running\": {\n \"0\": \"stopped\"\n }\n },\n \"methods\": {\n \"0\": \"sta.fill='red';\",\n \"1\": \"sta.fill='green';\"\n }\n}\n","x":380,"y":230,"wires":[["55e0c831.9bfc38","579cadf6.da28c4","61219a50.6c5804"]]},{"id":"55e0c831.9bfc38","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":690,"y":240,"wires":[]},{"id":"26b12a92.7bc486","type":"dsm","z":"b954bdf6.7ca99","name":"pump","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"1\": \"sta.fill='red';\",\n \"0\": \"sta.fill='green';\"\n }\n}","x":366,"y":344,"wires":[["fb78b749.0678b8","78a9a1d1.82666","74564550.acddbc"]]},{"id":"fb78b749.0678b8","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":610,"y":360,"wires":[]},{"id":"579cadf6.da28c4","type":"ui_button","z":"b954bdf6.7ca99","name":"","group":"dae20864.9f1898","order":2,"width":0,"height":0,"passthru":false,"label":"Everything is OK","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":490,"y":60,"wires":[[]]},{"id":"78a9a1d1.82666","type":"ui_button","z":"b954bdf6.7ca99","name":"","group":"27357b0e.7ff314","order":0,"width":0,"height":0,"passthru":false,"label":"Warning!!!!!!!!!!!!!!!!!!","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":597,"y":310,"wires":[[]]},{"id":"55646978.bdf258","type":"inject","z":"b954bdf6.7ca99","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[["de3905bc.b94e48","26b12a92.7bc486"]]},{"id":"7e533f32.69977","type":"inject","z":"b954bdf6.7ca99","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":300,"wires":[["de3905bc.b94e48","26b12a92.7bc486"]]},{"id":"61219a50.6c5804","type":"function","z":"b954bdf6.7ca99","name":"Set gauge color","func":"if (msg.payload == 1) {\n msg.ui_control = {\"options\":{\"levelColors\": [\"#00ff00\",\"#00ff00\",\"#808080\"]}}\n} else if (msg.payload == 0) {\n msg.ui_control = {\"options\":{\"gaugeColor\":\"#00ff00\"}}\n}\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":160,"wires":[["83493f96.278c5","f1adb18f.4a81"]]},{"id":"83493f96.278c5","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":830,"y":120,"wires":[]},{"id":"f1adb18f.4a81","type":"ui_gauge","z":"b954bdf6.7ca99","name":"","group":"dae20864.9f1898","order":1,"width":0,"height":0,"gtype":"donut","title":"Left","label":"units","format":"{{value}}","min":"0","max":"1","colors":["#ffffff","#ffffff","#ffffff"],"seg1":"","seg2":"","x":850,"y":180,"wires":[]},{"id":"74564550.acddbc","type":"function","z":"b954bdf6.7ca99","name":"Set gauge color","func":"if (msg.payload == 1) {\n msg.ui_control = {\"options\":{\"levelColors\": [\"#ffffff\",\"#ffffff\",\"#ff0000\"]}}\n} \nreturn msg;","outputs":1,"noerr":0,"x":640,"y":420,"wires":[["78b2570d.c92d98","81de412b.ca197"]]},{"id":"78b2570d.c92d98","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":850,"y":380,"wires":[]},{"id":"81de412b.ca197","type":"ui_gauge","z":"b954bdf6.7ca99","name":"","group":"27357b0e.7ff314","order":1,"width":0,"height":0,"gtype":"donut","title":"Right","label":"units","format":"{{value}}","min":"0","max":"1","colors":["#ffffff","#ffffff","#ffffff"],"seg1":"","seg2":"","x":870,"y":440,"wires":[]},{"id":"dae20864.9f1898","type":"ui_group","z":"","name":"Test 1","tab":"a3e07da6.f8a64","order":1,"disp":true,"width":"6","collapse":false},{"id":"27357b0e.7ff314","type":"ui_group","z":"","name":"Test 2","tab":"a3e07da6.f8a64","order":2,"disp":true,"width":"6","collapse":false},{"id":"a3e07da6.f8a64","type":"ui_tab","z":"","name":"Monitoring System","icon":"dashboard"}]

```

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [31 July 2018 14:24 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/22 "2018-07-31T14:24:13Z")

</div>

Try this:

```auto
[{"id":"2b6c1d8a.560de2","type":"dsm","z":"895bbff8.0e6c4","name":"state right","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"onBeforeTransition\": \"msg.payload = msg.payload.toString();\",\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'stopped' ? 'red' : 'green'\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"sm.currentState === 'stopped' ? 'state1' : 'state0'\"\n }\n }\n }\n}\n","x":330,"y":660,"wires":[["aecef770.af0668","55ca9d2a.31a6a4","ef386a1c.699008"]]},{"id":"aecef770.af0668","type":"debug","z":"895bbff8.0e6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":543,"y":660,"wires":[]},{"id":"2f3234b7.75285c","type":"rpi-gpio in","z":"895bbff8.0e6c4","name":"Raspberry PI 3","pin":"3","intype":"tri","debounce":"25","read":false,"x":142,"y":721,"wires":[["2b6c1d8a.560de2","7ce3bed9.29bf3"]]},{"id":"55ca9d2a.31a6a4","type":"ui_gauge","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"gtype":"donut","title":"Montage","label":"units","format":"{{value}}","min":0,"max":"1","colors":["#00f900","#e6e600","#00ff40"],"seg1":"","seg2":"","x":532,"y":608,"wires":[]},{"id":"7ce3bed9.29bf3","type":"dsm","z":"895bbff8.0e6c4","name":"state left","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"onBeforeTransition\": \"msg.payload = msg.payload === 0 ? '1' : '0';\",\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'stopped' ? 'red' : 'green'\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"sm.currentState === 'stopped' ? 'state1' : 'state0'\"\n }\n }\n }\n}","x":330,"y":780,"wires":[["ed0f908c.e2c09","a9654171.14791","56aad3e.06b422c"]]},{"id":"ed0f908c.e2c09","type":"debug","z":"895bbff8.0e6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":536,"y":785,"wires":[]},{"id":"a9654171.14791","type":"ui_gauge","z":"895bbff8.0e6c4","name":"","group":"c22dbd6a.ea0f1","order":1,"width":0,"height":0,"gtype":"donut","title":"Montage","label":"units","format":"{{value}}","min":"0","max":"1","colors":["#ff0000","#e6e600","#ff2600"],"seg1":"","seg2":"","x":534,"y":842,"wires":[]},{"id":"ef386a1c.699008","type":"ui_button","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"passthru":false,"label":"Everything is OK","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":551,"y":575,"wires":[[]]},{"id":"56aad3e.06b422c","type":"ui_button","z":"895bbff8.0e6c4","name":"","group":"c22dbd6a.ea0f1","order":2,"width":0,"height":0,"passthru":false,"label":"Warning!!!!!!!!!!!!!!!!!!","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":557,"y":740,"wires":[[]]},{"id":"3b5c2ca9.2fce64","type":"ui_group","z":"","name":"Test 1","tab":"8e6943f5.019c6","order":1,"disp":true,"width":"6","collapse":false},{"id":"c22dbd6a.ea0f1","type":"ui_group","z":"","name":"Test 2","tab":"8e6943f5.019c6","order":2,"disp":true,"width":"6","collapse":false},{"id":"8e6943f5.019c6","type":"ui_tab","z":"","name":"Monitoring System","icon":"dashboard"}]

```

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [31 July 2018 14:28 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/23 "2018-07-31T14:28:54Z")

</div>

Great! The option settings is a way to go, I didn't know that.

---

<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:** [31 July 2018 14:36 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/24 "2018-07-31T14:36:24Z")

</div>

> [@cflurin](#):
>
> Great! The option settings is a way to go, I didn't know that.

Indeed, this is detailed here: [node-red-dashboard/config-fields.md at master · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md)

However you found a trivial solution ! Looks like you just changed the payload to string ?

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [31 July 2018 14:50 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/25 "2018-07-31T14:50:18Z")

</div>

> [@Andrei](#):
>
> ````auto
> [{"id":"b954bdf6.7ca99","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"de3905bc.b94e48","type":"dsm","z":"b954bdf6.7ca99","name":"pump (forum)","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"running\",\n \"states\": {\n \"stopped\": {\n \"1\": \"running\"\n },\n \"running\": {\n \"0\": \"stopped\"\n }\n },\n \"methods\": {\n \"0\": \"sta.fill='red';\",\n \"1\": \"sta.fill='green';\"\n }\n}\n","x":380,"y":230,"wires":[["55e0c831.9bfc38","579cadf6.da28c4","61219a50.6c5804"]]},{"id":"55e0c831.9bfc38","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":690,"y":240,"wires":[]},{"id":"26b12a92.7bc486","type":"dsm","z":"b954bdf6.7ca99","name":"pump","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"1\": \"sta.fill='red';\",\n \"0\": \"sta.fill='green';\"\n }\n}","x":366,"y":344,"wires":[["fb78b749.0678b8","78a9a1d1.82666","74564550.acddbc"]]},{"id":"fb78b749.0678b8","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":610,"y":360,"wires":[]},{"id":"579cadf6.da28c4","type":"ui_button","z":"b954bdf6.7ca99","name":"","group":"dae20864.9f1898","order":2,"width":0,"height":0,"passthru":false,"label":"Everything is OK","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":490,"y":60,"wires":[[]]},{"id":"78a9a1d1.82666","type":"ui_button","z":"b954bdf6.7ca99","name":"","group":"27357b0e.7ff314","order":0,"width":0,"height":0,"passthru":false,"label":"Warning!!!!!!!!!!!!!!!!!!","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":597,"y":310,"wires":[[]]},{"id":"55646978.bdf258","type":"inject","z":"b954bdf6.7ca99","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[["de3905bc.b94e48","26b12a92.7bc486"]]},{"id":"7e533f32.69977","type":"inject","z":"b954bdf6.7ca99","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":300,"wires":[["de3905bc.b94e48","26b12a92.7bc486"]]},{"id":"61219a50.6c5804","type":"function","z":"b954bdf6.7ca99","name":"Set gauge color","func":"if (msg.payload == 1) {\n msg.ui_control = {\"options\":{\"levelColors\": [\"#00ff00\",\"#00ff00\",\"#808080\"]}}\n} else if (msg.payload == 0) {\n msg.ui_control = {\"options\":{\"gaugeColor\":\"#00ff00\"}}\n}\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":160,"wires":[["83493f96.278c5","f1adb18f.4a81"]]},{"id":"83493f96.278c5","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":830,"y":120,"wires":[]},{"id":"f1adb18f.4a81","type":"ui_gauge","z":"b954bdf6.7ca99","name":"","group":"dae20864.9f1898","order":1,"width":0,"height":0,"gtype":"donut","title":"Left","label":"units","format":"{{value}}","min":"0","max":"1","colors":["#ffffff","#ffffff","#ffffff"],"seg1":"","seg2":"","x":850,"y":180,"wires":[]},{"id":"74564550.acddbc","type":"function","z":"b954bdf6.7ca99","name":"Set gauge color","func":"if (msg.payload == 1) {\n msg.ui_control = {\"options\":{\"levelColors\": [\"#ffffff\",\"#ffffff\",\"#ff0000\"]}}\n} \nreturn msg;","outputs":1,"noerr":0,"x":640,"y":420,"wires":[["78b2570d.c92d98","81de412b.ca197"]]},{"id":"78b2570d.c92d98","type":"debug","z":"b954bdf6.7ca99","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":850,"y":380,"wires":[]},{"id":"81de412b.ca197","type":"ui_gauge","z":"b954bdf6.7ca99","name":"","group":"27357b0e.7ff314","order":1,"width":0,"height":0,"gtype":"donut","title":"Right","label":"units","format":"{{value}}","min":"0","max":"1","colors":["#ffffff","#ffffff","#ffffff"],"seg1":"","seg2":"","x":870,"y":440,"wires":[]},{"id":"dae20864.9f1898","type":"ui_group","z":"","name":"Test 1","tab":"a3e07da6.f8a64","order":1,"disp":true,"width":"6","collapse":false},{"id":"27357b0e.7ff314","type":"ui_group","z":"","name":"Test 2","tab":"a3e07da6.f8a64","order":2,"disp":true,"width":"6","collapse":false},{"id":"a3e07da6.f8a64","type":"ui_tab","z":"","name":"Monitoring System","icon":"dashboard"}] ```
> 
> ````

Dear Andrei can we inject this trigging operation Raspberry GPIO.

When I disconnect cable pin 3 will trigging and when I connect cable not tricking

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [31 July 2018 14:55 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/26 "2018-07-31T14:55:06Z")

</div>

Dear cflurin didnt worked.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [31 July 2018 14:58 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/27 "2018-07-31T14:58:34Z")

</div>

> [@wtrk](#):
>
> Dear cflurin didnt worked.

Really? it works for me.

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [31 July 2018 14:59 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/28 "2018-07-31T14:59:11Z")

</div>

ok I will test it again

---

<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:** [31 July 2018 14:59 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/29 "2018-07-31T14:59:47Z")

</div>

Hi @wtrk,

It is not possible for me to use / test Raspberry nodes (since I do not have one of these devices). Because of that I have to simulate the GPIO pins. with inject nodes. Of course, you have to remove those inject nodes to test the flow. I could check the latest flow you posted but I need you to edit the post to include 3 backticks before and after the code (otherwise I am unable to import the flow). You could test the latest flow from @cflurin as it is was changed to work as you want.

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [31 July 2018 15:03 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/30 "2018-07-31T15:03:42Z")

</div>

@cflurin both of donut same time activating and deactivating. I try to make one of them active other one deactive.

When deactive change position deactive to active other donut also should change.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [31 July 2018 15:04 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/31 "2018-07-31T15:04:27Z")

</div>

> [@Andrei](#):
>
> Looks like you just changed the payload to string ?

Right! the dsm expects a string "0" or "1" It did work but at start I got an undefined warning.  
So first the value is converted to a string.

---

<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:** [31 July 2018 15:17 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/32 "2018-07-31T15:17:15Z")

</div>

> [@wtrk](#):
>
> both of donut same time activating and deactivating. I try to make one of them active other one deactive.
> 
> When deactive change position deactive to active other donut also should change.

cflurin flow is working for me...

 ![node-red-04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/10f6e96f60152159d2d8af79862bbc3575cb675b.gif)

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [31 July 2018 15:38 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/33 "2018-07-31T15:38:45Z")

</div>

@wtrk if it still doesn't work for you, delete all yours versions (first do a backup) and import the flow again.

Edit: which `dsm` version are you using?

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [1 August 2018 05:23 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/34 "2018-08-01T05:23:59Z")

</div>

my dsm version is 0.7.1

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [1 August 2018 05:28 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/35 "2018-08-01T05:28:01Z")

</div>

> [@wtrk](#):
>
> my dsm version is 0.7.1

Update to version 0.8.0 using the `Manage palette`

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [1 August 2018 06:39 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/36 "2018-08-01T06:39:25Z")

</div>

After update dsm version now it is working. Thank you for yor support.

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [1 August 2018 07:12 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/37 "2018-08-01T07:12:42Z")

</div>

Given that you use the donuts to show the state you might also use only one donut (@andrei'  
s ui\_control setting):

```auto
[{"id":"de780d41.a9457","type":"dsm","z":"895bbff8.0e6c4","name":"state right","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"onBeforeTransition\": \"msg.payload = msg.payload.toString();\",\n \"0\": [\n \"msg.ui_control = {'options':{'levelColors': ['#009000','#009000','#009000']}};\",\n \"msg.background = 'green';\",\n \"msg.label = 'Everything is OK';\"\n ],\n \"1\": [\n \"msg.ui_control = {'options':{'levelColors': ['#ff0000','#ff0000','#ff0000']}};\",\n \"msg.background = 'red';\",\n \"msg.label = 'Warning!';\"\n ],\n \"onAfterTransition\": \"msg.payload = '1';\",\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'running' ? 'green' : 'red';\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"sm.currentState\"\n }\n }\n }\n}","x":370,"y":660,"wires":[["9111aef8.91f09","7d8ca3d4.eb9c7c","55206e9a.96d1e"]]},{"id":"9111aef8.91f09","type":"debug","z":"895bbff8.0e6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":590,"y":700,"wires":[]},{"id":"162219b.fb00de6","type":"rpi-gpio in","z":"895bbff8.0e6c4","name":"Raspberry PI 3","pin":"3","intype":"tri","debounce":"25","read":false,"x":160,"y":660,"wires":[["de780d41.a9457"]]},{"id":"7d8ca3d4.eb9c7c","type":"ui_gauge","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"gtype":"donut","title":"Montage","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00ff40"],"seg1":"","seg2":"","x":580,"y":660,"wires":[]},{"id":"55206e9a.96d1e","type":"ui_button","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":570,"y":620,"wires":[[]]},{"id":"3b5c2ca9.2fce64","type":"ui_group","z":"","name":"Test","tab":"8e6943f5.019c6","order":1,"disp":true,"width":"6","collapse":false},{"id":"8e6943f5.019c6","type":"ui_tab","z":"","name":"One Donut","icon":"dashboard"}]

```

In the ui open the tab `one donut`

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [1 August 2018 10:13 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/38 "2018-08-01T10:13:58Z")

</div>

> [@cflurin](#):
>
> ````auto
> [{"id":"de780d41.a9457","type":"dsm","z":"895bbff8.0e6c4","name":"state right","sm_config":"{\n \"triggerInput\": \"payload\",\n \"currentState\": \"stopped\",\n \"states\": {\n \"stopped\": {\n \"0\": \"running\"\n },\n \"running\": {\n \"1\": \"stopped\"\n }\n },\n \"methods\": {\n \"onBeforeTransition\": \"msg.payload = msg.payload.toString();\",\n \"0\": [\n \"msg.ui_control = {'options':{'levelColors': ['#009000','#009000','#009000']}};\",\n \"msg.background = 'green';\",\n \"msg.label = 'Everything is OK';\"\n ],\n \"1\": [\n \"msg.ui_control = {'options':{'levelColors': ['#ff0000','#ff0000','#ff0000']}};\",\n \"msg.background = 'red';\",\n \"msg.label = 'Warning!';\"\n ],\n \"onAfterTransition\": \"msg.payload = '1';\",\n \"status\": {\n \"fill\": {\n \"get\": \"sm.currentState === 'running' ? 'green' : 'red';\"\n },\n \"shape\": \"dot\",\n \"text\": {\n \"get\": \"sm.currentState\"\n }\n }\n }\n}","x":370,"y":660,"wires":[["9111aef8.91f09","7d8ca3d4.eb9c7c","55206e9a.96d1e"]]},{"id":"9111aef8.91f09","type":"debug","z":"895bbff8.0e6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":590,"y":700,"wires":[]},{"id":"162219b.fb00de6","type":"rpi-gpio in","z":"895bbff8.0e6c4","name":"Raspberry PI 3","pin":"3","intype":"tri","debounce":"25","read":false,"x":160,"y":660,"wires":[["de780d41.a9457"]]},{"id":"7d8ca3d4.eb9c7c","type":"ui_gauge","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"gtype":"donut","title":"Montage","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00ff40"],"seg1":"","seg2":"","x":580,"y":660,"wires":[]},{"id":"55206e9a.96d1e","type":"ui_button","z":"895bbff8.0e6c4","name":"","group":"3b5c2ca9.2fce64","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":570,"y":620,"wires":[[]]},{"id":"3b5c2ca9.2fce64","type":"ui_group","z":"","name":"Test","tab":"8e6943f5.019c6","order":1,"disp":true,"width":"6","collapse":false},{"id":"8e6943f5.019c6","type":"ui_tab","z":"","name":"One Donut","icon":"dashboard"}]```
> 
> ````

Dear @cflurin this is perfect thank you very much..

---

<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 August 2018 10:33 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/39 "2018-08-01T10:33:15Z")

</div>

Hi @wtrk, please use3 backticts (```) before and after the code you are posting so it will display correctly for people to import and test. If possible please edit the earlier post.

---

<div class="post-metadata">

**Author:** ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)\
**Post date:** [1 August 2018 11:24 UTC](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697/40 "2018-08-01T11:24:02Z")

</div>

> [@Andrei](#):
>
> Hi @wtrk, please use3 backticts (```) before and after the code you are posting so it will display correctly for people to import and test. If possible please edit the earlier post.

OK done it, thank you for all your attention and helps.

[Previous page](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697.md?page=1)

[Next page](https://discourse.nodered.org/t/how-can-i-make-logic-1-and-logic-0-graphical-with-node-red-and-rpi-3/1697.md?page=3)
