# Turn flow on/off via iphone

**URL:** <https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395>\
**Category:** General\
**Created:** [26 February 2019 08:01 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395 "2019-02-26T08:01:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [26 February 2019 08:01 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/1 "2019-02-26T08:01:33Z")

</div>

Hello,  
Im making a home security alarm for a school project and I want to turn the project on/off via my mobile phone.  
I have looked on the internet but havent found anything usefull so far.  
Does anyone know if it is possible?  
I am using Iphone.

Kind regards,  
Zeno

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [26 February 2019 08:50 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/2 "2019-02-26T08:50:41Z")

</div>

I assume you want to turn it on and off from outside your local net, if so the easiest way, without having to worry about exposing your system to the internet is to use the Telegram node.

> **[node-red-contrib-telegrambot](https://flows.nodered.org/node/node-red-contrib-telegrambot)**
>
> Telegram bot nodes.

There are lot's of examples on the page and others here have done similar things.

---

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [26 February 2019 09:20 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/3 "2019-02-26T09:20:13Z")

</div>

Thank you, this has really helped me 🙂.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 February 2019 10:18 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/4 "2019-02-26T10:18:43Z")

</div>

Of assuming you are on the same network  
there’s the homekit nodes and you can use the homekit app (or even better the homekit app called Eve)  
Or if you could trigger your flow using a http-in node  
you could use a safari page that you save to the home screen  
With this assuming you are on iOS12 you can also use the Shortcut app from Apple to get siri to trigger the page.

---

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [26 February 2019 10:53 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/5 "2019-02-26T10:53:06Z")

</div>

So if I am on a VPN to my home I can use this method?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2019 11:09 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/6 "2019-02-26T11:09:42Z")

</div>

> [@anon4382222](#):
>
> I want to turn the project on/off via my mobile phone.

What do you mean by turning the project on/off? If you are on a vpn to your private network you can use the node red dashboard and view that in the browser on your phone to interact in whatever you want with your flows.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [26 February 2019 11:11 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/7 "2019-02-26T11:11:57Z")

</div>

Which one?

---

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [26 February 2019 11:43 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/8 "2019-02-26T11:43:05Z")

</div>

If i would make a vpn to my home network I would be able to use the homekit app?

---

<div class="post-metadata">

**Author:** ![Robbo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robbo/32/4491_2.png) [@Robbo](https://discourse.nodered.org/u/Robbo)\
**Post date:** [26 February 2019 12:40 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/9 "2019-02-26T12:40:29Z")

</div>

Another method would be to use one of the many MQTT dashboards (like Home Remote) and then use a external broker like CloudMQTT. No need for opening ports or VPN then.

The Homekit method will work remotely if you have setup a Apple device like iPad/AppleTV/HomePod on the local network to be the bridge.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 February 2019 13:33 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/10 "2019-02-26T13:33:39Z")

</div>

> [@anon4382222](#):
>
> So if I am on a VPN to my home I can use this method?

If that is the case, you can use many methods - a simple Dashboard for example.

Telegram gives you a secure channel without needing a VPN (which brings its own issues).

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 February 2019 13:34 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/11 "2019-02-26T13:34:29Z")

</div>

> [@Robbo](#):
>
> Another method would be to use one of the many MQTT dashboards (like Home Remote) and then use a external broker like CloudMQTT. No need for opening ports or VPN then.

Really not a good idea for a home alarm system!

---

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [26 February 2019 13:45 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/12 "2019-02-26T13:45:43Z")

</div>

Thanks for all the replies, I apreciate it! 🙂

---

<div class="post-metadata">

**Author:** ![Robbo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robbo/32/4491_2.png) [@Robbo](https://discourse.nodered.org/u/Robbo)\
**Post date:** [26 February 2019 14:10 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/13 "2019-02-26T14:10:26Z")

</div>

I'm sure Mr Burglar will be quite familiar and aware you have a custom home made system using MQTT with CloudMQTT or whatever external bridge you decide to use and have the hacking abilities to get around the authentication or TLS system that it provides. I think it will be pretty safe myself. If you think Mr Burglar is really adapt at those, then there's no reason they should be a remote disarm either as you could get that to use physical local stuff, etc.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [26 February 2019 16:59 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/14 "2019-02-26T16:59:06Z")

</div>

> [@Robbo](#):
>
> Mr Burglar

Well everyone has to make their own risk assessment. The real point is that low-risk, low impact systems have a nasty tendency to drift towards higher risk over time. At the same time, the risks increase as attacker knowledge and tools improve.

It wouldn't be the first time that people have been burgled on the basis of, lets say, social media. So yes, at the moment the risk is very low indeed, but will that be the case when you've left it running for 2 years and the world has moved on?

In my day-job, I see some of the underbelly of all this stuff and I feel that it is important to remind people of the risks.

A few months ago, almost nobody in this forum expected to see a coordinated hacking campaign against Internet facing implementations of Node-RED. None-the-less it happened.

---

<div class="post-metadata">

**Author:** ![Robbo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robbo/32/4491_2.png) [@Robbo](https://discourse.nodered.org/u/Robbo)\
**Post date:** [26 February 2019 17:10 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/15 "2019-02-26T17:10:30Z")

</div>

If it was a commercial gone security system then it wouldn’t be viable of course, but for a DIY system the burglar wouldn’t have a clue what systems you have used. In the end most systems can be disabled by cutting your telephone cables, jamming phone/WiFi/etc. signals and squirting foam in your alarm that no one would pay attention to in the first place.

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 February 2019 19:06 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/16 "2019-02-26T19:06:05Z")

</div>

Here's a quick lash-up for a NR flow using the telegram node to control a set of LEDs arranged like a traffic light signal on a WeMos D1 Mini breadboard.  
You can modify the "control action" to control something a bit more interesting than a set of LEDs.  
You will need to install the Telegram app on your mobile phone and set-up the "bot".  
The flow sends an in-line keyboard to your phone that sets up three buttons that will enable you to control the corresponding LEDs connected to a WeMos D1 Mini.

I hope you find this screenshot and flow useful.

 ![ScreenShot030](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5b724a63014c0ca3e9756d6c689c01df903460e2.png)

```auto
[{"id":"5a0551ff.d8fc28","type":"telegram event","z":"3a0044e9.7e57bc","name":"","bot":"8c9e51ff.e69e08","event":"callback_query","autoanswer":true,"x":180,"y":340,"wires":[["f1202281.e315c","8bab54b1.a5515","66ec2f88.3efd28","702874df.c52de4"]]},{"id":"3d29ea20.b65ca6","type":"telegram sender","z":"3a0044e9.7e57bc","name":"show inline keyboard","bot":"8c9e51ff.e69e08","x":720,"y":140,"wires":[["540b658c.2f7064"]]},{"id":"e40d1203.8693f8","type":"function","z":"3a0044e9.7e57bc","name":"initial inline keyboard message","func":"// context.global.keyboard = { pending : true, messageId : msg.payload.messageId };\n\nvar opts = {\n reply_to_message_id: msg.payload.messageId,\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"RED - \" + flow.get(\"red\") ,\n \"callback_data\": \"red\" \n }, \n {\n \"text\": \"YELLOW - \" + flow.get(\"yellow\"),\n \"callback_data\": \"yellow\" \n },\n {\n \"text\": \"GREEN - \" + flow.get(\"green\"),\n \"callback_data\": \"green\" \n }\n]]\n })\n};\n\nmsg.payload.content = 'Click to toggle LEDs';\nmsg.payload.options = opts;\n\nreturn [msg];\n","outputs":"1","noerr":0,"x":450,"y":140,"wires":[["3d29ea20.b65ca6"]]},{"id":"987c8fb4.be7e1","type":"telegram command","z":"3a0044e9.7e57bc","name":"/start","command":"/start","bot":"8c9e51ff.e69e08","strict":false,"x":150,"y":160,"wires":[["e40d1203.8693f8"],[]]},{"id":"be868f52.d4394","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query","func":"var red = flow.get(\"red\") || \"off\";\nvar yellow = flow.get(\"yellow\") || \"off\";\nvar green = flow.get(\"green\") || \"off\";\n\n// msg.payload.reply_to_message_Id = msg.payload.messageId;\n\n// This is a sample switch to demonstrate the handling of the user input.\n// msg.payload.options = context.global.keyboard.messageId;\n// msg.payload.type = 'editMessageReplyMarkup';\n// msg.payload.options = {parse_mode: \"Markdown\"};\n\nmsg.payload.options = {reply_to_message_id: msg.payload.messageId};\n\nmsg.payload.type = 'message';\n\nmsg.payload.content= \"- - - Status report for LEDs - - -\\r\\n\\r\\n\";\nmsg.payload.content += \"RED led = \" + red + \"\\r\\n\";\nmsg.payload.content += \"YEL led = \" + yellow + \"\\r\\n\";\nmsg.payload.content += \"GRN led = \" + green + \"\\r\\n\";\nmsg.payload.content += \"\\r\\n- - - End of status report - - -\\r\\n\";\n\nreturn [msg];","outputs":1,"noerr":0,"x":610,"y":340,"wires":[["5af6f94f.291c48"]]},{"id":"cc1866de.733b7","type":"telegram sender","z":"3a0044e9.7e57bc","name":"answer callback query","bot":"8c9e51ff.e69e08","x":1040,"y":340,"wires":[["82e7f9b9.9dd768","74dab1ae.dff4"]]},{"id":"540b658c.2f7064","type":"debug","z":"3a0044e9.7e57bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":910,"y":140,"wires":[]},{"id":"82e7f9b9.9dd768","type":"debug","z":"3a0044e9.7e57bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1250,"y":340,"wires":[]},{"id":"74dab1ae.dff4","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":220,"wires":[["e40d1203.8693f8"]]},{"id":"be1b818d.cb2bb8","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/15","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":440,"wires":[]},{"id":"8132eb24.b6952","type":"inject","z":"3a0044e9.7e57bc","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"1","x":170,"y":80,"wires":[["fb34f30d.36e15"]]},{"id":"fb34f30d.36e15","type":"function","z":"3a0044e9.7e57bc","name":"","func":"flow.set(\"red\",\"off\");\nflow.set(\"yellow\",\"off\");\nflow.set(\"green\",\"off\");\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":80,"wires":[[]]},{"id":"f1202281.e315c","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for RED led","func":"var red = flow.get(\"red\")|| \"off\";\n\nif (msg.payload.content == \"red\")\n{\n if (red == \"off\")\n {\n red = \"on\";\n msg.payload = 1;\n node.status({fill:\"red\",shape:\"dot\"});\n }\n\n else\n {\n red = \"off\";\n msg.payload = 0;\n node.status({});\n }\n flow.set(\"red\",red);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":460,"y":440,"wires":[["be1b818d.cb2bb8"]]},{"id":"8bab54b1.a5515","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":340,"wires":[["be868f52.d4394"]]},{"id":"59869912.0aa24","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/13","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":500,"wires":[]},{"id":"66ec2f88.3efd28","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for YELLOW led","func":"var yellow = flow.get(\"yellow\")|| \"off\";\n\nif (msg.payload.content == \"yellow\")\n{\n if (yellow == \"off\")\n {\n yellow = \"on\";\n msg.payload = 1;\n node.status({fill:\"yellow\",shape:\"dot\"});\n }\n\n else\n {\n yellow = \"off\";\n msg.payload = 0;\n node.status({});\n }\n flow.set(\"yellow\",yellow);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":480,"y":500,"wires":[["59869912.0aa24"]]},{"id":"933358fb.2c4218","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/12","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":560,"wires":[]},{"id":"702874df.c52de4","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for GREEN led","func":"var green = flow.get(\"green\")|| \"off\";\n\nif (msg.payload.content == \"green\")\n{\n if (green == \"off\")\n {\n green = \"on\";\n msg.payload = 1;\n node.status({fill:\"green\",shape:\"dot\"});\n }\n\n else\n {\n green = \"off\";\n msg.payload = 0;\n node.status({});\n }\n flow.set(\"green\",green);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":470,"y":560,"wires":[["933358fb.2c4218"]]},{"id":"5af6f94f.291c48","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":340,"wires":[["cc1866de.733b7"]]},{"id":"8c9e51ff.e69e08","type":"telegram bot","z":"","botname":"rgb_leds_bot","usernames":"","chatids":"","baseapiurl":"","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"","socksusername":"","sockspassword":"","bothost":"","localbotport":"","publicbotport":"","privatekey":"","certificate":"","useselfsignedcertificate":false,"verboselogging":false},{"id":"6a53712f.418b4","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.140","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<div class="post-metadata">

**Author:** ![anon4382222](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@anon4382222](https://discourse.nodered.org/u/anon4382222)\
**Post date:** [12 March 2019 07:23 UTC](https://discourse.nodered.org/t/turn-flow-on-off-via-iphone/8395/17 "2019-03-12T07:23:33Z")

</div>

> [@dynamicdave](#):
>
> [{"id":"5a0551ff.d8fc28","type":"telegram event","z":"3a0044e9.7e57bc","name":"","bot":"8c9e51ff.e69e08","event":"callback\_query","autoanswer":true,"x":180,"y":340,"wires":[["f1202281.e315c","8bab54b1.a5515","66ec2f88.3efd28","702874df.c52de4"]]},{"id":"3d29ea20.b65ca6","type":"telegram sender","z":"3a0044e9.7e57bc","name":"show inline keyboard","bot":"8c9e51ff.e69e08","x":720,"y":140,"wires":[["540b658c.2f7064"]]},{"id":"e40d1203.8693f8","type":"function","z":"3a0044e9.7e57bc","name":"initial inline keyboard message","func":"// context.global.keyboard = { pending : true, messageId : msg.payload.messageId };\n\nvar opts = {\n reply\_to\_message\_id: msg.payload.messageId,\n reply\_markup: JSON.stringify({\n "inline\_keyboard": [[\n {\n "text": "RED - " + flow.get("red") ,\n "callback\_data": "red" \n }, \n {\n "text": "YELLOW - " + flow.get("yellow"),\n "callback\_data": "yellow" \n },\n {\n "text": "GREEN - " + flow.get("green"),\n "callback\_data": "green" \n }\n]]\n })\n};\n\nmsg.payload.content = 'Click to toggle LEDs';\nmsg.payload.options = opts;\n\nreturn [msg];\n","outputs":"1","noerr":0,"x":450,"y":140,"wires":[["3d29ea20.b65ca6"]]},{"id":"987c8fb4.be7e1","type":"telegram command","z":"3a0044e9.7e57bc","name":"/start","command":"/start","bot":"8c9e51ff.e69e08","strict":false,"x":150,"y":160,"wires":[["e40d1203.8693f8"],]},{"id":"be868f52.d4394","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query","func":"var red = flow.get("red") || "off";\nvar yellow = flow.get("yellow") || "off";\nvar green = flow.get("green") || "off";\n\n// msg.payload.reply\_to\_message\_Id = msg.payload.messageId;\n\n// This is a sample switch to demonstrate the handling of the user input.\n// msg.payload.options = context.global.keyboard.messageId;\n// msg.payload.type = 'editMessageReplyMarkup';\n// msg.payload.options = {parse\_mode: "Markdown"};\n\nmsg.payload.options = {reply\_to\_message\_id: msg.payload.messageId};\n\nmsg.payload.type = 'message';\n\nmsg.payload.content= "- - - Status report for LEDs - - -\r\n\r\n";\nmsg.payload.content += "RED led = " + red + "\r\n";\nmsg.payload.content += "YEL led = " + yellow + "\r\n";\nmsg.payload.content += "GRN led = " + green + "\r\n";\nmsg.payload.content += "\r\n- - - End of status report - - -\r\n";\n\nreturn [msg];","outputs":1,"noerr":0,"x":610,"y":340,"wires":[["5af6f94f.291c48"]]},{"id":"cc1866de.733b7","type":"telegram sender","z":"3a0044e9.7e57bc","name":"answer callback query","bot":"8c9e51ff.e69e08","x":1040,"y":340,"wires":[["82e7f9b9.9dd768","74dab1ae.dff4"]]},{"id":"540b658c.2f7064","type":"debug","z":"3a0044e9.7e57bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":910,"y":140,"wires":},{"id":"82e7f9b9.9dd768","type":"debug","z":"3a0044e9.7e57bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1250,"y":340,"wires":},{"id":"74dab1ae.dff4","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":220,"wires":[["e40d1203.8693f8"]]},{"id":"be1b818d.cb2bb8","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/15","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":440,"wires":},{"id":"8132eb24.b6952","type":"inject","z":"3a0044e9.7e57bc","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"1","x":170,"y":80,"wires":[["fb34f30d.36e15"]]},{"id":"fb34f30d.36e15","type":"function","z":"3a0044e9.7e57bc","name":"","func":"flow.set("red","off");\nflow.set("yellow","off");\nflow.set("green","off");\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":80,"wires":[]},{"id":"f1202281.e315c","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for RED led","func":"var red = flow.get("red")|| "off";\n\nif (msg.payload.content == "red")\n{\n if (red == "off")\n {\n red = "on";\n msg.payload = 1;\n node.status({fill:"red",shape:"dot"});\n }\n\n else\n {\n red = "off";\n msg.payload = 0;\n node.status({});\n }\n flow.set("red",red);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":460,"y":440,"wires":[["be1b818d.cb2bb8"]]},{"id":"8bab54b1.a5515","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":340,"wires":[["be868f52.d4394"]]},{"id":"59869912.0aa24","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/13","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":500,"wires":},{"id":"66ec2f88.3efd28","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for YELLOW led","func":"var yellow = flow.get("yellow")|| "off";\n\nif (msg.payload.content == "yellow")\n{\n if (yellow == "off")\n {\n yellow = "on";\n msg.payload = 1;\n node.status({fill:"yellow",shape:"dot"});\n }\n\n else\n {\n yellow = "off";\n msg.payload = 0;\n node.status({});\n }\n flow.set("yellow",yellow);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":480,"y":500,"wires":[["59869912.0aa24"]]},{"id":"933358fb.2c4218","type":"mqtt out","z":"3a0044e9.7e57bc","name":"","topic":"/node23/gpio/12","qos":"","retain":"","broker":"6a53712f.418b4","x":790,"y":560,"wires":},{"id":"702874df.c52de4","type":"function","z":"3a0044e9.7e57bc","name":"evaluate callback query for GREEN led","func":"var green = flow.get("green")|| "off";\n\nif (msg.payload.content == "green")\n{\n if (green == "off")\n {\n green = "on";\n msg.payload = 1;\n node.status({fill:"green",shape:"dot"});\n }\n\n else\n {\n green = "off";\n msg.payload = 0;\n node.status({});\n }\n flow.set("green",green);\n}\n\n \nreturn msg;","outputs":1,"noerr":0,"x":470,"y":560,"wires":[["933358fb.2c4218"]]},{"id":"5af6f94f.291c48","type":"delay","z":"3a0044e9.7e57bc","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":340,"wires":[["cc1866de.733b7"]]},{"id":"8c9e51ff.e69e08","type":"telegram bot","z":"","botname":"rgb\_leds\_bot","usernames":"","chatids":"","baseapiurl":"","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"","socksusername":"","sockspassword":"","bothost":"","localbotport":"","publicbotport":"","privatekey":"","certificate":"","useselfsignedcertificate":false,"verboselogging":false},{"id":"6a53712f.418b4","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.140","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Thank you, this is what i needed 🙂
