How to cycle several inputs to one output?

Hello,
I need bit help here :slight_smile:
I have three inputs (temperature, water temperature and humidity) and want them display on oled display in cycle like 10second each and then redraw display with another input and so on.

how to achieve that? inputs does not matter, they are there, for drawing to the oled display I'm using node-red-contrib-oled
Currently I was playing with cycle node, which does kind of what I want to achieve but there is no option how to set time for which one input will be visible.

Is there anything like that out there or how to do that with standard nodes?
Thanks for help.

K.

I think I might use node-red-contrib-dsm to do the cycling (there is an example in its docs for how to cycle states based on a timer if I remember correctly), then I might use three node-red-contrib-simple-gate nodes to block/all messages in each message path on their way to the display.

Yeah I found out DSM earlier today.
Got it working kind of, maybe some tweaks would be appreciated, not certainly sure if my approach is the right one

[{"id":"de4a4846.34f248","type":"inject","z":"510a9c0f.a4d2e4","name":"5m","topic":"","payload":"true","payloadType":"bool","repeat":"300","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[[]]},{"id":"f88a52f0.db5a9","type":"inject","z":"510a9c0f.a4d2e4","name":"3m","topic":"","payload":"true","payloadType":"bool","repeat":"180","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":160,"wires":[["ea48713c.b2adb"]]},{"id":"f00bfe36.dc7ea","type":"inject","z":"510a9c0f.a4d2e4","name":"10m","topic":"","payload":"true","payloadType":"bool","repeat":"600","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["cc75f9d9.749bc8"]]},{"id":"e9f45454.7ab7c8","type":"inject","z":"510a9c0f.a4d2e4","name":"manual trigger","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["cc75f9d9.749bc8","ea48713c.b2adb"]]},{"id":"ea48713c.b2adb","type":"rpi-dht22","z":"510a9c0f.a4d2e4","name":"DHT","topic":"rpi-dht22","dht":22,"pintype":"0","pin":"22","x":290,"y":160,"wires":[["b242ce13.d6f5c","51ce7eb5.b92ff"]]},{"id":"51ce7eb5.b92ff","type":"change","z":"510a9c0f.a4d2e4","name":"temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":120,"wires":[["b1c04dbf.c5865"]]},{"id":"b242ce13.d6f5c","type":"change","z":"510a9c0f.a4d2e4","name":"humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"humidity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":160,"wires":[["52a57ffb.4e282"]]},{"id":"52a57ffb.4e282","type":"function","z":"510a9c0f.a4d2e4","name":"round(0)","func":"msg.payload = parseFloat(msg.payload).toFixed(0)\nglobal.set(\"humidity\",msg.payload)\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":160,"wires":[["73de7ae0.c03194"]]},{"id":"b1c04dbf.c5865","type":"function","z":"510a9c0f.a4d2e4","name":"round(1)","func":"msg.payload = parseFloat(msg.payload).toFixed(1)\nglobal.set(\"air\",msg.payload)\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":120,"wires":[["d3989494.11abf8"]]},{"id":"74b1b930.354428","type":"function","z":"510a9c0f.a4d2e4","name":"round(1)","func":"msg.payload = parseFloat(msg.payload).toFixed(1)\nglobal.set(\"water\",msg.payload)\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":200,"wires":[["8605484d.01e6b8"]]},{"id":"cc75f9d9.749bc8","type":"sensor-ds18b20","z":"510a9c0f.a4d2e4","name":"Water","topic":"","sensorid":"28-031661a80eff","timer":"1","repeat":false,"x":290,"y":200,"wires":[["74b1b930.354428"]]},{"id":"4f338980.bae668","type":"function","z":"510a9c0f.a4d2e4","name":"display","func":"msg.payload = { \"size\":6, \"x\":1,\"y\":1,\"text\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":1180,"y":160,"wires":[["3ea9d466.7417ec"]]},{"id":"3ea9d466.7417ec","type":"String","z":"510a9c0f.a4d2e4","name":"","display":"a2be6fc9.f0fc68","x":1330,"y":160,"wires":[]},{"id":"d3989494.11abf8","type":"function","z":"510a9c0f.a4d2e4","name":"air.string","func":"var air= global.get(\"air\");\nmsg.payload=air;\nmsg.payload=String(msg.payload);\nmsg.payload +=\"°\";\nmsg.topic=\"timerA\";\nreturn msg;","outputs":1,"noerr":0,"x":800,"y":120,"wires":[["8b1fed31.10758"]]},{"id":"73de7ae0.c03194","type":"function","z":"510a9c0f.a4d2e4","name":"humidity.string","func":"var humidity= global.get(\"humidity\");\nmsg.payload=humidity;\nmsg.payload=String(msg.payload);\nmsg.payload +=\"%\";\nmsg.topic=\"timerC\";\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":160,"wires":[["8b1fed31.10758"]]},{"id":"8605484d.01e6b8","type":"function","z":"510a9c0f.a4d2e4","name":"water.string","func":"var water= global.get(\"water\");\nmsg.payload=water;\nmsg.payload=String(msg.payload);\nmsg.payload +=\"°\";\nmsg.topic=\"timerB\";\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":200,"wires":[["8b1fed31.10758"]]},{"id":"8b1fed31.10758","type":"dsm","z":"510a9c0f.a4d2e4","name":"timer","sm_config":"{\n    \"data\": {\n        \"delay1\": 1000,\n        \"delay2\": 2000\n    },\n    \"methods\": {\n        \"delay1\": {\n            \"name\": \"setData\"\n        },\n        \"delay2\": {\n            \"name\": \"setData\"\n        },\n        \"timer1\": {\n            \"name\": \"timer\",\n            \"param\": \"delay1\"\n        },\n        \"timerA\": {\n            \"name\": \"timer\",\n            \"param\": 5000\n        },\n        \"timerB\": {\n            \"name\": \"timer\",\n            \"param\": 10000\n        },\n        \"timerC\": {\n            \"name\": \"timer\",\n            \"param\": 15000\n        },        \n        \"timer2\": {\n            \"name\": \"timer\",\n            \"param\": \"delay2\",\n            \"do\": \"node.status({});\"\n        },\n        \"timer3\": {\n            \"name\": \"timer\",\n            \"param\": 3000,\n            \"send\": {\n                \"get\": \"'time over - '+msg.payload;\"\n            }\n        },\n        \"resetTimer3\": {\n            \"name\": \"resetTimer\",\n            \"param\": \"timer3\"\n        },\n        \"watchdog1\": {\n            \"name\": \"watchdog\",\n            \"param\": 5000\n        },\n        \"status\": {\n            \"fill\": \"blue\",\n            \"shape\": \"dot\",\n            \"text\": {\n                \"get\": \"msg.topic\"\n            }\n        }\n    }\n}\n","x":1020,"y":160,"wires":[["8d548dba.da006","4f338980.bae668"]]},{"id":"8d548dba.da006","type":"debug","z":"510a9c0f.a4d2e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1190,"y":240,"wires":[]},{"id":"a75cec90.e5643","type":"inject","z":"510a9c0f.a4d2e4","name":"10s","topic":"","payload":"true","payloadType":"bool","repeat":"15","crontab":"","once":false,"onceDelay":0.1,"x":670,"y":300,"wires":[["d3989494.11abf8","8605484d.01e6b8","73de7ae0.c03194"]]},{"id":"a2be6fc9.f0fc68","type":"oled-config","z":"","name":"OLED","width":"128","height":"64","address":"3c"}]

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