Node-Red

Post Reply
User avatar
Truos
Posts: 28
Joined: 12 Jul 2018, 07:48

Node-Red

Post by Truos »

Hi,

I'm using the new official Node-Red nodes for revpi


Export of the a UI test. to controll LEDs and relay using PiTest.
Surley it can be done with the new nodes instead and writing the bits needed only?

I know it's probarly a basic question but still. :D

Code: Select all

[{"id":"d161093.5accd78","type":"smooth","z":"df95f2ec.3c4358","name":"","property":"payload","action":"mean","count":"10","round":"0","mult":"single","reduce":false,"x":700,"y":40,"wires":[["9def7570.c8b98"]]},{"id":"d45cf586.60a3c8","type":"ui_gauge","z":"df95f2ec.3c4358","name":"CPU Temp","group":"9aee9f99.934b8","order":6,"width":0,"height":0,"gtype":"gage","title":"CPU Temp","label":"degrees C","format":"{{value}}","min":0,"max":"120","colors":["#00b500","#e6e600","#ca3838"],"seg1":"60","seg2":"80","x":870,"y":80,"wires":[]},{"id":"9def7570.c8b98","type":"ui_chart","z":"df95f2ec.3c4358","name":"CPU Temp","group":"9aee9f99.934b8","order":4,"width":0,"height":0,"label":"CPU Temp","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":870,"y":40,"wires":[[]]},{"id":"6703145d.fbd8b4","type":"ui_text","z":"df95f2ec.3c4358","group":"1206783c.0f3bf","order":9,"width":0,"height":0,"name":"RevPiStatus","label":"RevPiStatus","format":"{{msg.payload}}","layout":"row-spread","x":750,"y":440,"wires":[]},{"id":"1f161631.aa0232","type":"ui_text","z":"df95f2ec.3c4358","group":"1206783c.0f3bf","order":9,"width":0,"height":0,"name":"RevPiIOCycle","label":"RevPiIOCycle","format":"{{msg.payload}}","layout":"row-spread","x":760,"y":380,"wires":[]},{"id":"6c1f956d.62fb74","type":"ui_text","z":"df95f2ec.3c4358","group":"1206783c.0f3bf","order":9,"width":0,"height":0,"name":"Core_Frequency","label":"Core_Frequency","format":"{{msg.payload}}0 Mhz","layout":"row-spread","x":770,"y":320,"wires":[]},{"id":"a4559d72.cec32","type":"ui_text","z":"df95f2ec.3c4358","group":"1206783c.0f3bf","order":9,"width":0,"height":0,"name":"Core_Temperature","label":"Core_Temperature","format":"{{msg.payload}}","layout":"row-spread","x":770,"y":260,"wires":[]},{"id":"b58842ae.f734b8","type":"ui_button","z":"df95f2ec.3c4358","name":"A1 Green","group":"266ca3b6.7e520c","order":14,"width":0,"height":0,"passthru":false,"label":"Green","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o ","payload":"","payloadType":"str","topic":"","x":340,"y":580,"wires":[["f1c318ec.1a1ea"]]},{"id":"1a63338c.08e254","type":"revpi-single-input","z":"df95f2ec.3c4358","server":"9aa6dbe6.f154a","inputpin":"Core_Temperature","x":360,"y":60,"wires":[["d161093.5accd78","d45cf586.60a3c8"]]},{"id":"7ecc6d6d.772d34","type":"revpi-single-input","z":"df95f2ec.3c4358","server":"9aa6dbe6.f154a","inputpin":"Core_Temperature","x":380,"y":260,"wires":[["a4559d72.cec32"]]},{"id":"8458bb45.e3f0f8","type":"revpi-single-input","z":"df95f2ec.3c4358","server":"9aa6dbe6.f154a","inputpin":"Core_Frequency","x":380,"y":320,"wires":[["6c1f956d.62fb74"]]},{"id":"bfa5acc0.d47688","type":"revpi-single-input","z":"df95f2ec.3c4358","server":"9aa6dbe6.f154a","inputpin":"RevPiIOCycle","x":360,"y":380,"wires":[["1f161631.aa0232"]]},{"id":"9a254550.14f36","type":"revpi-single-input","z":"df95f2ec.3c4358","server":"9aa6dbe6.f154a","inputpin":"RevPiStatus","x":360,"y":440,"wires":[["6703145d.fbd8b4"]]},{"id":"3d182b1a.442ee4","type":"ui_button","z":"df95f2ec.3c4358","name":"A1 Red","group":"266ca3b6.7e520c","order":14,"width":0,"height":0,"passthru":false,"label":"Red","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":340,"y":620,"wires":[["324b9201.df1d6e"]]},{"id":"138ced61.94db4b","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,0,0 && piTest -s 6,1,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A1 off","x":1070,"y":500,"wires":[[],[],[]]},{"id":"f1c318ec.1a1ea","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,0,1 && piTest -s 6,1,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A1 green","x":1080,"y":560,"wires":[[],[],[]]},{"id":"324b9201.df1d6e","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,0,0 && piTest -s 6,1,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A1 red","x":1070,"y":620,"wires":[[],[],[]]},{"id":"c05dc3f3.8159c8","type":"ui_button","z":"df95f2ec.3c4358","name":"A1 Orange","group":"266ca3b6.7e520c","order":14,"width":0,"height":0,"passthru":false,"label":"Orange","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":350,"y":660,"wires":[["244f31b5.8a7cfe"]]},{"id":"58a0e2a0.b5f59c","type":"ui_button","z":"df95f2ec.3c4358","name":"A1 Off","group":"266ca3b6.7e520c","order":14,"width":0,"height":0,"passthru":false,"label":"Off","tooltip":"","color":"","bgcolor":"","icon":"fa-power-off ","payload":"","payloadType":"str","topic":"","x":330,"y":540,"wires":[["138ced61.94db4b"]]},{"id":"244f31b5.8a7cfe","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,0,1 && piTest -s 6,1,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A1 orange","x":1080,"y":680,"wires":[[],[],[]]},{"id":"e7970f37.a3c318","type":"ui_button","z":"df95f2ec.3c4358","name":"A2 Green","group":"926df2e0.deb7a","order":14,"width":0,"height":0,"passthru":false,"label":"Green","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o ","payload":"","payloadType":"str","topic":"","x":340,"y":840,"wires":[["65be367e.d0f328"]]},{"id":"dd52b22e.d171b8","type":"ui_button","z":"df95f2ec.3c4358","name":"A2 Red","group":"926df2e0.deb7a","order":14,"width":0,"height":0,"passthru":false,"label":"Red","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":340,"y":880,"wires":[["6c56fd6f.b1835c"]]},{"id":"5ab1334c.9e64dc","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,2,0 && piTest -s 6,3,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A2 off","x":1070,"y":760,"wires":[[],[],[]]},{"id":"65be367e.d0f328","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,2,1 && piTest -s 6,3,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A2 green","x":1080,"y":820,"wires":[[],[],[]]},{"id":"6c56fd6f.b1835c","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,2,0 && piTest -s 6,3,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A2 red","x":1070,"y":880,"wires":[[],[],[]]},{"id":"c65ea92e.d22818","type":"ui_button","z":"df95f2ec.3c4358","name":"A2 Orange","group":"926df2e0.deb7a","order":14,"width":0,"height":0,"passthru":false,"label":"Orange","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":350,"y":920,"wires":[["b3d0e8fd.2cc8d"]]},{"id":"137244b6.bc43c3","type":"ui_button","z":"df95f2ec.3c4358","name":"A2 Off","group":"926df2e0.deb7a","order":14,"width":0,"height":0,"passthru":false,"label":"Off","tooltip":"","color":"","bgcolor":"","icon":"fa-power-off ","payload":"","payloadType":"str","topic":"","x":330,"y":800,"wires":[["5ab1334c.9e64dc"]]},{"id":"b3d0e8fd.2cc8d","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,2,1 && piTest -s 6,3,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A2 orange","x":1080,"y":940,"wires":[[],[],[]]},{"id":"47c99e7f.ced0c","type":"ui_button","z":"df95f2ec.3c4358","name":"A3 Green","group":"5ef24952.ee1ee8","order":14,"width":0,"height":0,"passthru":false,"label":"Green","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o ","payload":"","payloadType":"str","topic":"","x":340,"y":1100,"wires":[["fa310cff.6e7468"]]},{"id":"859def7.ea2ee9","type":"ui_button","z":"df95f2ec.3c4358","name":"A3 Red","group":"5ef24952.ee1ee8","order":14,"width":0,"height":0,"passthru":false,"label":"Red","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":340,"y":1140,"wires":[["c9afc78d.2a3028"]]},{"id":"7e9d35a1.d27a3c","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,4,0 && piTest -s 6,5,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A3 off","x":1070,"y":1020,"wires":[[],[],[]]},{"id":"fa310cff.6e7468","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,4,1 && piTest -s 6,5,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A3 green","x":1080,"y":1080,"wires":[[],[],[]]},{"id":"c9afc78d.2a3028","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,4,0 && piTest -s 6,5,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A3 red","x":1070,"y":1140,"wires":[[],[],[]]},{"id":"4e22c31b.f8e45c","type":"ui_button","z":"df95f2ec.3c4358","name":"A3 Orange","group":"5ef24952.ee1ee8","order":14,"width":0,"height":0,"passthru":false,"label":"Orange","tooltip":"","color":"","bgcolor":"","icon":"fa-lightbulb-o","payload":"","payloadType":"str","topic":"","x":350,"y":1180,"wires":[["898b8c94.1e50a8"]]},{"id":"1c922b8d.897b54","type":"ui_button","z":"df95f2ec.3c4358","name":"A3 Off","group":"5ef24952.ee1ee8","order":14,"width":0,"height":0,"passthru":false,"label":"Off","tooltip":"","color":"","bgcolor":"","icon":"fa-power-off ","payload":"","payloadType":"str","topic":"","x":330,"y":1060,"wires":[["7e9d35a1.d27a3c"]]},{"id":"898b8c94.1e50a8","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,4,1 && piTest -s 6,5,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"LED A3 orange","x":1080,"y":1200,"wires":[[],[],[]]},{"id":"ffc00f52.9a343","type":"ui_switch","z":"df95f2ec.3c4358","name":"","label":"Relay","tooltip":"","group":"39208054.34032","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"0","onvalueType":"str","onicon":"","oncolor":"","offvalue":"1","offvalueType":"str","officon":"","offcolor":"","x":330,"y":1300,"wires":[["5ccda5f.f98d3dc"]]},{"id":"7c553261.668a74","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,6,0","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Relay Closed","x":1080,"y":1260,"wires":[[],[],[]]},{"id":"5ccda5f.f98d3dc","type":"switch","z":"df95f2ec.3c4358","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":1300,"wires":[["7c553261.668a74"],["bd83d694.754288"]]},{"id":"bd83d694.754288","type":"exec","z":"df95f2ec.3c4358","command":"piTest -s 6,6,1","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Relay Open","x":1070,"y":1340,"wires":[[],[],[]]},{"id":"9aee9f99.934b8","type":"ui_group","z":"","name":"Health","tab":"ec00119e.454d6","order":2,"disp":true,"width":"12","collapse":false},{"id":"1206783c.0f3bf","type":"ui_group","z":"","name":"Test","tab":"ec00119e.454d6","order":2,"disp":true,"width":"6","collapse":false},{"id":"266ca3b6.7e520c","type":"ui_group","z":"","name":"LED A1","tab":"ec00119e.454d6","order":3,"disp":true,"width":"2","collapse":false},{"id":"9aa6dbe6.f154a","type":"revpi-server","z":"","host":"localhost","port":"8000"},{"id":"926df2e0.deb7a","type":"ui_group","z":"","name":"LED A2","tab":"ec00119e.454d6","order":4,"disp":true,"width":"2","collapse":false},{"id":"5ef24952.ee1ee8","type":"ui_group","z":"","name":"LED A3","tab":"ec00119e.454d6","order":5,"disp":true,"width":"2","collapse":false},{"id":"39208054.34032","type":"ui_group","z":"","name":"Relay","tab":"ec00119e.454d6","order":6,"disp":true,"width":"2","collapse":false},{"id":"ec00119e.454d6","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
Edit: Changed the code flow
User avatar
dirk
KUNBUS
Posts: 2126
Joined: 15 Dec 2016, 13:19

Re: Node-Red

Post by dirk »

Hi Truos, I have tested your example. I think I understand your point now. You mean can this construct so set or reset a LED be enhanced?

Code: Select all

piTest -s 6,0,0 && piTest -s 6,1,0
You mean i.e. by switching from EXEC-Node to some kind of native LED Nodes?
User avatar
Truos
Posts: 28
Joined: 12 Jul 2018, 07:48

Re: Node-Red

Post by Truos »

Yes, is it possible to use the "revpi-output" node?
User avatar
dirk
KUNBUS
Posts: 2126
Joined: 15 Dec 2016, 13:19

Re: Node-Red

Post by dirk »

Hi, maybe your ideas will lead to a new feature in the next release of the RevPi Nodes for Node-RED. Currently all I can say is that you could write yourself some nicer looking functions that hide the bit handling on a central place instead of all the EXEC nodes.
Post Reply