Not New but I am Stumped

Are you new to Indigo and/or home automation in general and have questions before you decide to buy? Looking for recommendations on your first purchase? Post those types of questions here. Note - once you've started using Indigo, use the correct forum below to post implementation questions.
300BlkPlinker
Posts: 26
Joined: Mon Jan 20, 2014 11:58 am

Not New but I am Stumped

Post by 300BlkPlinker »

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?
User avatar
DaveL17
Posts: 6831
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Not New but I am Stumped

Post by DaveL17 »

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]
Londonmark
Posts: 510
Joined: Wed Feb 29, 2012 12:57 pm

Re: Not New but I am Stumped

Post by Londonmark »

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.
User avatar
Different Computers
Posts: 2584
Joined: Sat Jan 02, 2016 10:07 am
Location: East Coast
Contact:

Re: Not New but I am Stumped

Post by Different Computers »

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
300BlkPlinker
Posts: 26
Joined: Mon Jan 20, 2014 11:58 am

Re: Not New but I am Stumped

Post by 300BlkPlinker »

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.
User avatar
DaveL17
Posts: 6831
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Not New but I am Stumped

Post by DaveL17 »

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]
300BlkPlinker
Posts: 26
Joined: Mon Jan 20, 2014 11:58 am

Re: Not New but I am Stumped

Post by 300BlkPlinker »

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.
User avatar
DaveL17
Posts: 6831
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Not New but I am Stumped

Post by DaveL17 »

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]
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: Not New but I am Stumped

Post by kw123 »

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
ryanbuckner
Posts: 1086
Joined: Sat Oct 08, 2011 12:33 pm
Location: Northern Virginia
Contact:

Re: Not New but I am Stumped

Post by ryanbuckner »

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.
ryanbuckner
Posts: 1086
Joined: Sat Oct 08, 2011 12:33 pm
Location: Northern Virginia
Contact:

Re: Not New but I am Stumped

Post by ryanbuckner »

I have fixed the plugin. Try it here: https://forums.indigodomo.com/viewtopic.php?f=363&t=27682
cjp767
Posts: 136
Joined: Thu May 02, 2013 4:59 pm
Location: Gig Harbor, WA

Re: Not New but I am Stumped

Post by cjp767 »

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.
Post Reply

Return to “New to Indigo/Home Automation”