Not New but I am Stumped

Posted on
Wed Dec 20, 2023 12:09 am
300BlkPlinker offline
Posts: 26
Joined: Jan 20, 2014

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?

Posted on
Wed Dec 20, 2023 6:01 am
DaveL17 offline
User avatar
Posts: 6728
Joined: Aug 20, 2013
Location: Chicago, IL, USA

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]

Posted on
Wed Dec 20, 2023 3:14 pm
Londonmark offline
Posts: 509
Joined: Feb 29, 2012

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.

Posted on
Wed Dec 20, 2023 7:00 pm
Different Computers offline
User avatar
Posts: 2531
Joined: Jan 02, 2016
Location: East Coast

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.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Wed Dec 20, 2023 10:21 pm
300BlkPlinker offline
Posts: 26
Joined: Jan 20, 2014

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.

Posted on
Thu Dec 21, 2023 8:08 am
DaveL17 offline
User avatar
Posts: 6728
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Not New but I am Stumped

300BlkPlinker wrote:
How do I read that file so I can stick it into a variable?

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:

Code: Select all
True
or is the latest result appended to the end of a list of results:

Code: Select all
True
False
True
...
I'll assume the former.

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.
Scripts inside Conditions are expected to *return* something.

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.
There's very little that's special about running Python scripts in Indigo. One example is that "print" statements don't work in Indigo script fields; you have to use "indigo.server.log()" instead.

Code: Select all
# Do this:
indigo.server.log("My text.")

# Not this:
print("My text.")
I would encourage you to head to YouTube and watch a series of videos by a cat called The Net Ninja -- they will really give you a leg up on basic Python. He is a superb teacher. Then you can apply that knowledge using the Indigo Object Model (IOM).

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Dec 21, 2023 3:03 pm
300BlkPlinker offline
Posts: 26
Joined: Jan 20, 2014

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.

Posted on
Thu Dec 21, 2023 3:59 pm
DaveL17 offline
User avatar
Posts: 6728
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Not New but I am Stumped

Congratulations on the retirement.

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]

Posted on
Fri Dec 22, 2023 6:44 am
kw123 offline
User avatar
Posts: 8330
Joined: May 12, 2013
Location: Dallas, TX

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

Posted on
Mon Dec 25, 2023 4:25 pm
ryanbuckner offline
Posts: 1062
Joined: Oct 08, 2011
Location: Northern Virginia

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.

Posted on
Tue Dec 26, 2023 12:26 pm
ryanbuckner offline
Posts: 1062
Joined: Oct 08, 2011
Location: Northern Virginia

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

Posted on
Thu Dec 28, 2023 2:58 pm
cjp767 offline
Posts: 136
Joined: May 02, 2013
Location: Gig Harbor, WA

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest