NodeRED Termux API Example

Show notification and demonstrate NodeRED Termux API functions.

[{"id":"ac72ddaa.78aa7","type":"inject","z":"c392465d.6016d8","name":"Start","topic":"","payload":"Click me to next commands","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":720,"wires":[["86472098.b46b"]]},{"id":"86472098.b46b","type":"termux-notification","z":"c392465d.6016d8","name":"","topic":"","nid":"","title":"Click on message to see more commands","content":"","action":true,"button1":"Battery","button1close":false,"button2":"Network","button2close":false,"button3":"Location","button3close":false,"priority":"high","sound":true,"vibrate":"","x":270,"y":720,"wires":[["d7f419b6.932698","a2b6d91c.f969a8","df06a0fb.e0eaa"]]},{"id":"d7f419b6.932698","type":"switch","z":"c392465d.6016d8","name":"","property":"label","propertyType":"msg","rules":[{"t":"eq","v":"Battery","vt":"str"},{"t":"eq","v":"Network","vt":"str"},{"t":"eq","v":"Location","vt":"str"}],"checkall":"true","outputs":3,"x":370,"y":800,"wires":[["d934dfa1.4177d"],["f3502032.1be99"],["f6a0ea39.0b0e08"]]},{"id":"a2b6d91c.f969a8","type":"switch","z":"c392465d.6016d8","name":"","property":"button","propertyType":"msg","rules":[{"t":"eq","v":"action","vt":"str"},{"t":"eq","v":"button1","vt":"str"},{"t":"eq","v":"button2","vt":"str"},{"t":"eq","v":"button3","vt":"str"}],"checkall":"true","outputs":4,"x":370,"y":660,"wires":[["ea89a4d9.2abfd8"],[],[],[]]},{"id":"672504d6.ce1e4c","type":"comment","z":"c392465d.6016d8","name":"switch from button","info":"","x":310,"y":600,"wires":[]},{"id":"d934dfa1.4177d","type":"termux-battery-status","z":"c392465d.6016d8","name":"","topic":"","x":540,"y":760,"wires":[["2f29d28d.3806de"]]},{"id":"f3502032.1be99","type":"termux-telephony-deviceinfo","z":"c392465d.6016d8","name":"","topic":"","x":540,"y":800,"wires":[["7781d7c8.ca8038"]]},{"id":"f6a0ea39.0b0e08","type":"termux-location","z":"c392465d.6016d8","name":"","topic":"","provider":"network","request":"once","x":520,"y":840,"wires":[["1a2fe1b8.b78e6e"]]},{"id":"ea89a4d9.2abfd8","type":"termux-notification","z":"c392465d.6016d8","name":"","topic":"","nid":"","title":"","content":"Other Commands","action":true,"button1":"Dialog","button1close":false,"button2":"Clipboard Get","button2close":false,"button3":"Vibrate","button3close":false,"priority":"high","sound":true,"vibrate":"","x":130,"y":540,"wires":[["2f7e5cc4.758534"]]},{"id":"2f7e5cc4.758534","type":"switch","z":"c392465d.6016d8","name":"","property":"button","propertyType":"msg","rules":[{"t":"eq","v":"action","vt":"str"},{"t":"eq","v":"button1","vt":"str"},{"t":"eq","v":"button2","vt":"str"},{"t":"eq","v":"button3","vt":"str"}],"checkall":"true","outputs":4,"x":310,"y":520,"wires":[["a058b8af.41bfe8"],["d01b45af.079868"],["b2aa0c59.b0282","a058b8af.41bfe8"],["5189083d.0e14b8","a058b8af.41bfe8"]]},{"id":"df06a0fb.e0eaa","type":"debug","z":"c392465d.6016d8","name":"","active":true,"console":"false","complete":"true","x":690,"y":660,"wires":[]},{"id":"d01b45af.079868","type":"termux-dialog","z":"c392465d.6016d8","name":"","topic":"","hint":"","title":"Set text","textarea":false,"password":false,"x":370,"y":420,"wires":[["a030b6c3.5e3928"]]},{"id":"a030b6c3.5e3928","type":"termux-notification","z":"c392465d.6016d8","name":"","topic":"","nid":"","title":"","content":"","action":true,"button1":"Speak","button1close":false,"button2":"Toast","button2close":false,"button3":"Back","button3close":false,"priority":"high","sound":true,"vibrate":"","x":530,"y":420,"wires":[["cd9158f7.7ef228"]]},{"id":"cd9158f7.7ef228","type":"switch","z":"c392465d.6016d8","name":"","property":"button","propertyType":"msg","rules":[{"t":"eq","v":"action","vt":"str"},{"t":"eq","v":"button1","vt":"str"},{"t":"eq","v":"button2","vt":"str"},{"t":"eq","v":"button3","vt":"str"}],"checkall":"true","outputs":4,"x":690,"y":420,"wires":[["a058b8af.41bfe8"],["ff931677.43c8a8","a058b8af.41bfe8"],["88fc4beb.b9f868","a058b8af.41bfe8"],["a058b8af.41bfe8"]]},{"id":"a058b8af.41bfe8","type":"link out","z":"c392465d.6016d8","name":"","links":["69e079f1.86e418"],"x":855,"y":560,"wires":[]},{"id":"69e079f1.86e418","type":"link in","z":"c392465d.6016d8","name":"Start","links":["a058b8af.41bfe8","b487eef8.2c65e"],"x":135,"y":680,"wires":[["86472098.b46b"]]},{"id":"ff931677.43c8a8","type":"termux-tts-speak","z":"c392465d.6016d8","name":"","topic":"","engine":"","language":"","pitch":1,"rate":1,"stream":"notification","text":"","x":890,"y":360,"wires":[]},{"id":"88fc4beb.b9f868","type":"termux-toast","z":"c392465d.6016d8","name":"","topic":"","short":false,"x":870,"y":420,"wires":[]},{"id":"b2aa0c59.b0282","type":"termux-clipboard-get","z":"c392465d.6016d8","name":"","topic":"","x":500,"y":480,"wires":[["a058b8af.41bfe8","e0622b79.6b9d28"]]},{"id":"e0622b79.6b9d28","type":"termux-toast","z":"c392465d.6016d8","name":"","topic":"","short":false,"x":690,"y":480,"wires":[]},{"id":"5189083d.0e14b8","type":"termux-vibrate","z":"c392465d.6016d8","name":"","topic":"","duration":1000,"force":false,"x":700,"y":600,"wires":[]},{"id":"cdfeb8c7.076d58","type":"comment","z":"c392465d.6016d8","name":"switch from button label","info":"","x":320,"y":840,"wires":[]},{"id":"b487eef8.2c65e","type":"link out","z":"c392465d.6016d8","name":"","links":["69e079f1.86e418"],"x":935,"y":780,"wires":[]},{"id":"2f29d28d.3806de","type":"template","z":"c392465d.6016d8","name":"Show percentage","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Battery percentage: {{payload.percentage}}","x":770,"y":760,"wires":[["b487eef8.2c65e"]]},{"id":"7781d7c8.ca8038","type":"template","z":"c392465d.6016d8","name":"Show operator","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Operator name: {{payload.network_operator_name}}","x":760,"y":800,"wires":[["b487eef8.2c65e"]]},{"id":"1a2fe1b8.b78e6e","type":"template","z":"c392465d.6016d8","name":"Show Location","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Latitude: {{payload.latitude}} Longitude: {{payload.longitude}}","x":760,"y":840,"wires":[["b487eef8.2c65e"]]}]

Flow Info

Created 7 years, 7 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • comment (x2)
  • debug (x1)
  • inject (x1)
  • link in (x1)
  • link out (x2)
  • switch (x4)
  • template (x3)
Other

Tags

  • termux
  • android
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option