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


#41

Dear @cflurin and @Andrei also other frineds,
I have one more question . I done my project almost everything is ok. But when I look page donut or bar chart looking big size.

İs it possible to change warning icon like buton, which is enadble green disable red.

Thanks for your advance ..


#42

did you try a search of the forum? maybe something like change ui color


#43

It's not interested about ui color.

I want to use button for donut, but this button should change value changed. Value 1 is active, value 0 is inactive.


#44


#45

May be you are looking after this:
How to adjust button colors according to "some device" state


#46

Dear @hotNipi I want to do this without button click. I want to connect a cable to GPIO port it should be active ( green ), when I disconnect passive ( red )


#47

So you need just an indicator. There isn't any "ready for use" dashboard node for that purpose.
But You can use ui_template node for this. Yes it requires a bit scripting to get it done but at the end you will get exactly what you need.
Here is thread about making "LED" indicators
https://discourse.nodered.org/t/simple-led-indicator-on-dashboard/1375
But with ui_teplate node you can make kind of everything what is possible with html, css and javascript


#48

Or I need to find a kind of thing which is working like gauge or donut,


#49

So you look at how the color of the donut rings changes and then use some css to hide the value that would normally show. Then send the value for the red or green. Done.


#50

Im not interesting color of the donut. Color of the donut is ok.
I dont want to use donut or other type of compass or level. I just want to show warning situation and normal situation with button. Is it possible ? When I disconnect cable button should change color to red and when I connect cable again it sholud be avtive and green. Just want to this.


#51

I've already posted a solution here:

Just change the dsm configuration:

{
    "triggerInput": "payload",
    "currentState": "running",
    "states": {
        "stopped": {
            "0": "running"
        },
        "running": {
            "1": "stopped"
        }
    },
    "methods": {
        "onBeforeTransition": "msg.pyload = msg.payload.toString();",
        "0": "sta.fill='green';msg.background='green';msg.label='Everything is OK';",
        "1": "sta.fill='red';msg.background='red';msg.label='Warning!';"
    }
}

#52

Ahh sorry I didn’t read it carefully enough. It’s what happens when a 17 month granddaughter spends the night in your bed...I definitely need a second cup of coffee...wait...:thinking: did I already have a second cup...


#53

Thank you very much, you rock brother. Thats working.


#54

Again me sorry everybody.

After some test now I have one more problem..

GPIO02 ve GPIO03 ports working perfectly when I disconnect cable donut change color and gives error
but I cant use any other ports.

Because I have 4 signal output, and made this design but I tried all ports not working except 3 and 5 . ANy solution for me?
Thank you.

[{"id":"5fa211e8.7401e","type":"dsm","z":"1ecb654.7ecff9b","name":"state right","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"0\": \"sta.fill='green';msg.background='green';msg.label='1st Everything is OK';\",\n        \"1\": \"sta.fill='red';msg.background='red';msg.label='1st Warning!';\"\n    }\n}","x":886,"y":75,"wires":[["d05ca3fe.fa7de","b73afafa.977fc8"]]},{"id":"f4015f8a.b963d","type":"rpi-gpio in","z":"1ecb654.7ecff9b","name":"Raspberry PI 3","pin":"3","intype":"tri","debounce":"25","read":false,"x":607,"y":85,"wires":[["5fa211e8.7401e"]]},{"id":"d05ca3fe.fa7de","type":"ui_button","z":"1ecb654.7ecff9b","name":"","group":"6a41e602.c50388","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":1081,"y":131,"wires":[[]]},{"id":"b73afafa.977fc8","type":"ui_gauge","z":"1ecb654.7ecff9b","name":"","group":"6a41e602.c50388","order":0,"width":0,"height":0,"gtype":"donut","title":"","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00af00"],"seg1":"","seg2":"","x":1079,"y":70,"wires":[]},{"id":"80d758da.0f1c58","type":"dsm","z":"1ecb654.7ecff9b","name":"state right","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"0\": \"sta.fill='green';msg.background='green';msg.label='2nd Everything is OK';\",\n        \"1\": \"sta.fill='red';msg.background='red';msg.label='2nd Warning!';\"\n    }\n}","x":876,"y":246,"wires":[["c1f57169.80457","d13d04c7.d1e938"]]},{"id":"121bda4b.614256","type":"rpi-gpio in","z":"1ecb654.7ecff9b","name":"Raspberry PI 5","pin":"5","intype":"tri","debounce":"25","read":false,"x":597,"y":256,"wires":[["80d758da.0f1c58"]]},{"id":"c1f57169.80457","type":"ui_button","z":"1ecb654.7ecff9b","name":"","group":"6b80c93e.6b75f8","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":1071,"y":302,"wires":[[]]},{"id":"d13d04c7.d1e938","type":"ui_gauge","z":"1ecb654.7ecff9b","name":"","group":"6b80c93e.6b75f8","order":0,"width":0,"height":0,"gtype":"donut","title":"","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00af00"],"seg1":"","seg2":"","x":1069,"y":241,"wires":[]},{"id":"6c4fc23d.9d3c3c","type":"dsm","z":"1ecb654.7ecff9b","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 = ' 3rd Error';\"\n ],\n \"1\": [\n \"msg.ui_control = {'options':{'levelColors': ['#ff0000','#ff0000','#ff0000']}};\",\n \"msg.background = 'red';\",\n \"msg.label = ' Warning 3rd Error!';\"\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":884,"y":405,"wires":[["bb7229fa.020198","41a1391c.c0f7b8"]]},{"id":"a553da2.5b4a828","type":"rpi-gpio in","z":"1ecb654.7ecff9b","name":"Raspberry PI 21","pin":"8","intype":"tri","debounce":"25","read":false,"x":605,"y":415,"wires":[["6c4fc23d.9d3c3c"]]},{"id":"bb7229fa.020198","type":"ui_button","z":"1ecb654.7ecff9b","name":"","group":"bf0e3d71.9734b","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":1079,"y":461,"wires":[[]]},{"id":"41a1391c.c0f7b8","type":"ui_gauge","z":"1ecb654.7ecff9b","name":"","group":"bf0e3d71.9734b","order":0,"width":0,"height":0,"gtype":"donut","title":"","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00af00"],"seg1":"","seg2":"","x":1077,"y":400,"wires":[]},{"id":"3ed0ed88.313d52","type":"dsm","z":"1ecb654.7ecff9b","name":"state right","sm_config":"{\n    \"triggerInput\": \"payload\",\n    \"currentState\": \"running\",\n    \"states\": {\n        \"stopped\": {\n            \"0\": \"running\"\n        },\n        \"running\": {\n            \"1\": \"stopped\"\n        }\n    },\n    \"methods\": {\n        \"onBeforeTransition\": \"msg.pyload = msg.payload.toString();\",\n        \"0\": \"sta.fill='green';msg.background='green';msg.label='4th Everything is OK';\",\n        \"1\": \"sta.fill='red';msg.background='red';msg.label='4th Warning!';\"\n    }\n}","x":893,"y":553,"wires":[["e1e21069.b497b","e942cd22.b0614"]]},{"id":"68975b2d.2c2c54","type":"rpi-gpio in","z":"1ecb654.7ecff9b","name":"Raspberry PI 3","pin":"23","intype":"tri","debounce":"25","read":false,"x":613,"y":566,"wires":[["3ed0ed88.313d52"]]},{"id":"e1e21069.b497b","type":"ui_button","z":"1ecb654.7ecff9b","name":"","group":"25971350.4bb48c","order":0,"width":0,"height":0,"passthru":false,"label":"{{msg.label}}","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"","payloadType":"str","topic":"","x":1087,"y":612,"wires":[[]]},{"id":"e942cd22.b0614","type":"ui_gauge","z":"1ecb654.7ecff9b","name":"","group":"25971350.4bb48c","order":0,"width":0,"height":0,"gtype":"donut","title":"","label":"","format":"","min":0,"max":"1","colors":["#00f900","#e6e600","#00af00"],"seg1":"","seg2":"","x":1085,"y":551,"wires":[]},{"id":"6a41e602.c50388","type":"ui_group","z":"","name":"Assembly Lines ","tab":"ed5b6d19.3a506","disp":true,"width":"6","collapse":false},{"id":"6b80c93e.6b75f8","type":"ui_group","z":"","name":"Hol 6","tab":"ed5b6d19.3a506","disp":true,"width":"6","collapse":false},{"id":"bf0e3d71.9734b","type":"ui_group","z":"","name":"Montaj Bantları1","tab":"ed5b6d19.3a506","disp":true,"width":"6","collapse":false},{"id":"25971350.4bb48c","type":"ui_group","z":"","name":"Montaj Bantları2","tab":"ed5b6d19.3a506","disp":true,"width":"6","collapse":false},{"id":"ed5b6d19.3a506","type":"ui_tab","z":"","name":"Montaj Bantları","icon":"dashboard"}]```

#55

Is anyone here ?


#56

If you put a debug node on the failing GPIO In nodes do you see anything when you change the input?


#57

Have just looked at the flow and the two that you say don't work are preallocated to SCLK and TxD so unless you disable these features on the Pi setup then it may be that you can't use them in node-red. You can see they are pre-allocated because they are marked accodingly in the GPIO In node config. Try using unnallocated ones, which are the green ones. I see that you say that some of them do work, but still better to use the free ones unless you know what the significance of the others is.


#58

When I use just for digital input 1/0 valur not working greens ports..
I dont know why these ports not working

Is this green ports just using for like sensors , motor, flame sensors ... etc ?


#59

The green ports are free for you to do anything you like with. Do you mean you have tried green ones and they don't work? If so what have you connected to them and have you put a debug node on the GPIO node to see if there is any output at all?


#60

Yes like what you saying, when I connect greens not working., maybe possible to error raspberry ports.