Recently some forum members helped me controlling my garage door openers via Node-RED, which works fine at the moment. However using the dashboard for this purpose is currently a bit impractical: I need to grab my smartphone, open the dashboard app, navigate to the button to open the ports. So the whole process is a bit slow ...
So the wife asked: is it possible to have the dashboard open a popup dialog automatically (to ask whether the garage door should be opened), as soon as we approach our house at e.g. 200 meters. Although there are nice tutorials (e.g. to use the OwnTracks app) to determine your location, I would like to create a custom UI node because:
I always try to avoid having to install multiple tools to get the job done.
I would like to have it fully integrated into Node-RED to be able to control everything.
I just like to develop fun stuff ...
So the last two hours I quickly wrote a node-red-contrib-ui-geolocation node:
Since it is fully experimental, it is not on Github available yet.
Would like to have in the future multiple trigger types (to specify when a message needs to be send to my Node-RED flow):
Currently it shows some ugly output in the dashboard:
And it sends an output message already to my Node-RED flow:
But I don't know at the moment whether it is useful anyway to continue the development of this node... Because this would mean my Node-RED dashboard should be active all the time on my smartphone. So there might be issues with power consumption, connection lost, gsm in sleep mode, and so on ...
Would like to know how I can use the dashboard to make things like this possible?
As you spotted already, as this is running browser side it has to keep running and consuming power. Dedicated apps like owntracks run in the background nicely and can be set to report at intervals as well.
Feel free to try using dashboard and do the experiment if you have time....
(Or maybe just ask siri,Alexa etc to turn on the heating)
As an experiment I tried this a while ago. Unfortunately, by the time a signal is confirmed and a connection is made I had been sitting waiting for some seconds (longer than it would take to manually press the remote). Went back to a manual system.
Some things are just not worth the hassle of trying to automate with iot, imo.
For a completely different approach, have you thought about using a phone app such as Telegram (or pushcuts if you happen to be on iOS as it fits perfectly for this use case) and get an incoming message/notification send to this app with a link inside connecting to your node-red install that offers the open/close aspect?
So keep all the logic handling inside node-red as much as possible, then trigger an outgoing message to the device. On iOS, especially iOS 13, you can utilise location triggers for this, such as arriving at/leaving location, without too much overhead. However I don’t know a good equivalent for other platforms. I have my own tracker with me if I need to
Another option that hasn’t been mentioned yet: a beacon on a keychain, with periodic scanning done by a local device that warns node-red when a specific beacon comes in range or goes out of range.
Another possibility, although not 100% reliable, might be something based on WUDS (Wifi User Detection System). It means having Wifi scanning enabled on your phone, but you can then check the MAC address and use that to signal your garage doors.
There are a few implementations around, mostly based on Raspberry Pi and Python, but I did a quick hack into C++ for an ESP8266, and it works pretty well.
I suppose if it's the phone doing the scanning there is nothing to prevent you detecting someone else's access point a bit away from your house to give you extra time :-)... though of course you need to ensure it knows that you are arriving and not leaving ...
I have a Dragino Lora GPS tracker, the LGT-92-LI version, updates every minute (can be changed) to The Things Network, drop it in the car. Lasts about 10 days. Unless you drive with 120km/h to your home, it could be useful. Coverage in BE is ok-ish depending on where you are. But yes, siri can do it automagically.
@dceejay: Tja thought so... But hoped there was perhaps a solution using background worker or whatever.
But seems I will have to abandon this mechanism. What a pitty...
Well that might be an interesting idea. Then I don't have to try finding any buttons to press. Will need to start playing with this ... Thanks!
@paulohlp: that could indeed be a solution. Similar to the proposals of @molesworth and @bakman2 . But the advantage of an app is that everybody in our familly always have their smartphone with them. E.g. when we go for a walk or ... we just need our smart phone and we will be able to open the garage door. But good proposal!
@afelix: yes but I need to make sure that the garage door is opening automatically. I just want to get a 'proposal' to open it. For example when I accidentally pass by my house with the car, I don't want the doors to open automatically ...
@paulohlp: IFTT could indeed warn my Node-RED flow automatically, but then my Node-RED flow still cannot show a popup on my Smartphone (to let me choose whether I want to open the door or not). Or did I misunderstood your idea?
The "WUDS" approach I mentioned has the device in your house, and it detects when a phone with WiFi scanning enabled comes close. It pretends to be a WiFi access point, and phones or other devices will send "probe" packets to get info.
In my version I white-list my own and friends and family's devices, and only raise an alert when an unknown device with a high signal strength is detected. (I also have a green-list for e.g. the postman, so I know if I'm likely to have mail when I get home )
For your application you'd do the opposite, and could trigger events when a family phone is detected - although as @dceejay mentioned, you'd need some logic to figure out whether it's someone arriving.
I'm now thinking about what I can do in my setup when a "friendly" device appears...
Most of the suggestions here suffer from a timing problem. Many of the ones for phones also suffer from a power problem. IFTTT only claims a time accuracy to 15 minutes. Telegram is better but is ocassionally delayed by maybe 10-20sec (a lot at 200m @ 2-30kph).
Also, you cannot really guarantee GPS either, especially on a phone since they will prefer to manage power over location accuracy. Best I've ever been able to do is a geofence of about 500m where we are. That might work for you but not really for us as we are in a dense urban area.
Owntracks would be best since you can also work out whether you are coming or going. Or maybe ESP-Now (I've not tried that).
Hi Bart - I'm interested in the node-red-contrib-ui-geolocation I would like to use it to get my location from the UI so I can log the location for commissioning a device.
What you have shown in your post is ideal, is there any chance you could release the node please.
In my first post above you can find the link to the Javascript Geolocation API. It is very easy, and indeed you can call it in a template node (if a button is clicked).