Not New but I am Stumped
-
- Posts: 26
- Joined: Mon Jan 20, 2014 11:58 am
Not New but I am Stumped
Trying to do some DIY geofencing. I have Ubiquiti UDM Pro and supported UI network gear (including APs). I simply want to know if my and the wife's IP have gotten close enough to the WiFi network to connect and then trigger against that knowledge. I have looked at Life360 and GeoFence Plug-ins. Also played around with simple shell script pinging the IP of my iPhone but doesn't seem consistent enough to Trigger against. Have static IP on phone. There are many things I want Idigo to do when I am home or away. What is everyone else doing for this Use case?
Re: Not New but I am Stumped
Apple Shortcuts has geofencing capability; however, it requires intervention by the device user to allow the trigger to fire each time (this is considered a safety feature which I totally understand). I don't presently use geofencing for automation, but I have set up fences with the Home Remote app for iPhone and it has been very solid.
I came here to drink milk and kick ass....and I've just finished my milk.
[My Plugins] - [My Forums]
[My Plugins] - [My Forums]
-
- Posts: 513
- Joined: Wed Feb 29, 2012 12:57 pm
Re: Not New but I am Stumped
I do this using virtual devices published to HomeKit with HomekitLink Siri. That way you can run automations from the Home app without needing to authorise each time. Means outside lights come on when my wife or I get home etc. very easy to configure. You set triggers in indigo for when the virtual devices switch on and off.
- Different Computers
- Posts: 2602
- Joined: Sat Jan 02, 2016 10:07 am
- Location: East Coast
- Contact:
Re: Not New but I am Stumped
please make sure you are NOT using a private IP address option on any iOS device you might be using for presence detection. When connecting to your home network, that is.
Sonoma on a Mac Mini M1 running Airfoil Pro, Bond Home, Camect, Roku Network Remote, Hue Lights, DomoPad, Adapters, Home Assistant Agent, HomeKitLinkSiri, EPS Smart Dimmer, Fantastic Weather, Nanoleaf, LED Simple Effects, Grafana. UnifiAP
-
- Posts: 26
- Joined: Mon Jan 20, 2014 11:58 am
Re: Not New but I am Stumped
Will look at the HomeKit idea but I feel that I'm so close with some ping action. I have a shell script doing the heavy lifting of the ping, writing either True or False in /tmp/pingresults. How do I read that file so I can stick it into a variable?
Also tried doing a ping right inside the Condition of a new Schedule by using Python to run the ping. Leveraged ChatGPT and got a working python script I could run on my Mac but that script won't work inside the Schedule (Condition area). Is there a collection of generic Python scripts somewhere in the Forums for me to just get my head around how Python works inside Indigo. I have read through a bunch of the area called Indigo Object Model Reference.....but just looking for some practical scripts from top to bottom to do some interesting things. Any links in the Forum or just some raw (redacted if necessary) python from within Indigo Triggers or Schedules would be appreciated.
Also tried doing a ping right inside the Condition of a new Schedule by using Python to run the ping. Leveraged ChatGPT and got a working python script I could run on my Mac but that script won't work inside the Schedule (Condition area). Is there a collection of generic Python scripts somewhere in the Forums for me to just get my head around how Python works inside Indigo. I have read through a bunch of the area called Indigo Object Model Reference.....but just looking for some practical scripts from top to bottom to do some interesting things. Any links in the Forum or just some raw (redacted if necessary) python from within Indigo Triggers or Schedules would be appreciated.
Re: Not New but I am Stumped
You didn't specify in your post what the contents of the file looks like literally; is it a file that contains a single word:300BlkPlinker wrote:How do I read that file so I can stick it into a variable?
Code: Select all
True
Code: Select all
True
False
True
...
Code: Select all
file_name = "/tmp/pingresults"
with open(file_name, 'r', encoding='utf-8') as infile:
output = infile.read()
indigo.variable.updateValue(12345678, output) # Save the value as text to your variable
result = True if output == "True" else False # Output is a string, so if you want the boolean value True/False, you need to convert it.
Code: Select all
file_name = "/tmp/pingresults"
with open(file_name, 'r', encoding='utf-8') as infile:
output = infile.read()
return True if output == "True" else False # if you don't return anything, the result is presumed to be False.
Code: Select all
# Do this:
indigo.server.log("My text.")
# Not this:
print("My text.")
I came here to drink milk and kick ass....and I've just finished my milk.
[My Plugins] - [My Forums]
[My Plugins] - [My Forums]
-
- Posts: 26
- Joined: Mon Jan 20, 2014 11:58 am
Re: Not New but I am Stumped
Really appreciate the coaching DaveL17. I am retiring at EOY and Python scripting knowledge is on my To-Do list. I will check out the YoutTube channel you mentioned.
Re: Not New but I am Stumped
Congratulations on the retirement.
Come on in--the water's fine.
Come on in--the water's fine.
I came here to drink milk and kick ass....and I've just finished my milk.
[My Plugins] - [My Forums]
[My Plugins] - [My Forums]
Re: Not New but I am Stumped
There are fingscan and unifiap plugins
They both do “present” and away
But no wifi solutions is a 100 % as the phone go to sleep
The only 100% solution I am using is pibeacon. I have not found a false negative / positive in 8 years. Only when the plugin has a hickup
.that requires rpi -at least 2- and beacons.
Karl
Sent from my iPhone using Tapatalk
They both do “present” and away
But no wifi solutions is a 100 % as the phone go to sleep
The only 100% solution I am using is pibeacon. I have not found a false negative / positive in 8 years. Only when the plugin has a hickup
.that requires rpi -at least 2- and beacons.
Karl
Sent from my iPhone using Tapatalk
-
- Posts: 1107
- Joined: Sat Oct 08, 2011 12:33 pm
- Location: Northern Virginia
- Contact:
Re: Not New but I am Stumped
I wrote the Life360 plugin to solve this problem while we wait for Indigo Touch to support location communication. Unfortunately the Life360 API is unsupported so it's currently not working. I hope to have a new version sometimes this week.
-
- Posts: 1107
- Joined: Sat Oct 08, 2011 12:33 pm
- Location: Northern Virginia
- Contact:
Re: Not New but I am Stumped
I have fixed the plugin. Try it here: https://forums.indigodomo.com/viewtopic.php?f=363&t=27682
Re: Not New but I am Stumped
Here's a copy of a post I made in the Life360 thread-- I tried to find a different way to geofence when Life360 service chose to be difficult. I'm currently running both the new and improved Life360 plugin and this method. Each method changes the same variable, so whichever gets there first accomplishes the trigger.
I've moved to the new-ish Geofence plugin and run an app on my phone called Locative. Instead of polling a service like the Life360 plugin does, the Locative app automatically sends a message through the Indigo Reflector to the Indigo app on your computer. Locative sends a message when you enter or leave a geofenced area. The message changes a device state and I set triggers using that information.
Plugin Store Link: https://www.indigodomo.com/pluginstore/121/
Forum Post: viewtopic.php?f=216&t=26416
Locative in Apple's App Store: https://apps.apple.com/us/app/locative- ... d725198453
The setup was reasonable, but it took a while. Since I've never seen either of these apps/plugins before, there is a learning curve.
I've moved to the new-ish Geofence plugin and run an app on my phone called Locative. Instead of polling a service like the Life360 plugin does, the Locative app automatically sends a message through the Indigo Reflector to the Indigo app on your computer. Locative sends a message when you enter or leave a geofenced area. The message changes a device state and I set triggers using that information.
Plugin Store Link: https://www.indigodomo.com/pluginstore/121/
Forum Post: viewtopic.php?f=216&t=26416
Locative in Apple's App Store: https://apps.apple.com/us/app/locative- ... d725198453
The setup was reasonable, but it took a while. Since I've never seen either of these apps/plugins before, there is a learning curve.