Turn flow on/off via iphone

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

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.

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

2 Likes

Thank you, this has really helped me :slight_smile:.

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.

1 Like

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

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.

Which one?

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

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.

2 Likes

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).

Really not a good idea for a home alarm system!

Thanks for all the replies, I apreciate it! :slight_smile:

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.

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.

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.

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.

[{"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":""}]
3 Likes

Thank you, this is what i needed :slight_smile: