Jump to content

iOS / ISY Proximity Script


Steven M Castano

Recommended Posts

This morning, just after midnight, the script again thought that I had briefly transitioned to Away based on a 0.9mile distance from a Cell location. I was pretty sure that I had told it to ignore those, but it looks like I said 'true' in the config file rather than 'True'. While I'll admit that that was my fault, it would be more user friendly if you ignored case for boolean values from the config file.

Link to comment

This morning, just after midnight, the script again thought that I had briefly transitioned to Away based on a 0.9mile distance from a Cell location. I was pretty sure that I had told it to ignore those, but it looks like I said 'true' in the config file rather than 'True'. While I'll admit that that was my fault, it would be more user friendly if you ignored case for boolean values from the config file.

You're totally write. Yes, right now "True" is different than "true", I just tested and verified it myself.

 

I will fix the config parser in the morning so boolean values are not case sensitive. You're right, that would be much better.

 

 

 

Sent from my iPhone using Tapatalk

Link to comment

This morning, just after midnight, the script again thought that I had briefly transitioned to Away based on a 0.9mile distance from a Cell location. I was pretty sure that I had told it to ignore those, but it looks like I said 'true' in the config file rather than 'True'. While I'll admit that that was my fault, it would be more user friendly if you ignored case for boolean values from the config file.

 

Sorry for the delay on this one, I was a little busy with work and some home projects over the last few days. Minor revision v0.16.1 has been pushed to the public repo and along with a logging fix on battery level checking, I updated the config file parsing code to read actual boolean values instead of strings. So now all of the following, "true, false, yes, no, on, off, 1, 0" are all acceptable values and are case insensitive. So place there is an option config item to turn something on or off, like wifi and bluetooth checking, battery level checking, etc... any one of those values can be used and the rest of the code has been adjusted to use proper boolean variables instead of string compares.

 

Rob, thanks again for pointing that out! It's all set now.

Link to comment

Just a few more additions coming soon. I'm testing them right now.

 

1) I added the ability to retry reading from the API if at first a valid battery reading isn't returned along with the variables to set the max number of retries and the time to sleep between them

2) I added the ability, for those of you who use wifi and bluetooth checking to force a GPS check every however many number of seconds as a backup. Just in case your wifi or bluetooth checking system has crashed and left you marked as home, you can now have the script check GPS, by default once every hour, just to make sure you're REALLY there.

 

If there's anything else people are looking for, let me know now and I can test a few new features before the next release.

Link to comment

As promised, version 0.17.0 was just released, as you can see from the changelog and release notes, I added the forced GPS rechecks for people that are using the wifi and bluetooth checking, I find that one very useful myself.

 

The big ones for everyone else are

1) The battery retries, the script can now make a few attempts and reading your battery level from the API before moving on.... and as always you can configure all of it.

2) Rejection of cell phone based locations. I know a few of you have had problems where when a location is report using the cell method, with the much lower accuracy, you were bouncing in and out of your home range. There was a little error in the script logic there where it would let a few of those cell locations be used even if the max retries had not been hit. That's resolved now and no matter what, the script will not move on and accept cell data for a location unless you've either not configured it to ignore cell locations, or it's run through is maximum number of retries.

 

About the only thing I think I have left before bumping this up to Version 1.0 is to write in the option to have the script send popup notifications to your phone if your battery has run too low, or I guess I could even have options for it to send messages when you enter and leave your home location as well, maybe even let you know there's been a version update.

 

Or... anything else you guys can think of while I've got some free time. Suggest away!

Link to comment

Very minor 0.17.1 released which fixes a display formatting problem with the on-screen table. It didn't have enough room in the distance from home column to accommodate the full precision of the new calculations. It's can now properly display up to 9999 miles with full double precision after the decimal point.

Link to comment

Hi Steve,

 

Just rebuilt my instance of OpenHab on a new Raspberry Pi 3, so I wanted to see if I can get this started, I have to say that I only skimmed part of this thread and did have a few questions.  Can this allow to follow more than one device?  Can it track my phone and my wife's phone as well?   

 

Also I did see your pre-requisites, but does this need an Apache server as well?  I may be the one that would need a "for dummies" step by step install instructions unless I can refer to standard install of these dependencies on RPi.  I did look at the config file and saw that there is only 1 port to setup.  My ISY does not run on the standard port 80 and even my https port is not standard as well, can your script accommodate non-standard ports for both http and https?  On my OpenHab, these are not standard either, it runs on port 8080 for http.

 

Also curious about your script that runs on your router.  I have an Asus as well and wouldn't have an issue installing a new firmware if I can get some benefits from that as well.  One of the things that I am looking for is a way to see if some devices are connected to the router (via MAC address i assume)  One of my goals is to be able to let my ISY (Openhab) know if I am working from home.  Detecting the MAC address of my work laptop and updating a variable would work fine.  Any ideas if this could be accomplished with such a script?

 

Thanks

Bernie

 

I haven't forgotten about this at all... I don't use OpenHAB myself, but I just built a quick little OpenHAB 2 virtual server so I have something to test against and got it linked to my ISY as well as just grabbing some weather data, etc... I'm a little swamped, as I tend to be on Mondays, but over the next few days I'm going to try to API access you linked too above and see if I can quickly write in the OpenHAB support. I'll then push to the public repo on an OpenHAB branch for you to test with.

 

Have you been able to get the original script up and running?? If you or anyone else needs a hand, if I'm at my desk... which is a LOT... I'm on IRC on FreeNode in #stevenmcastano and I'd be happy to talk you through anything you might need.

Link to comment

Hi Steve,

 

I haven't forgot about this one either, I have been a little bit busy these past few weekends helping a family member in need, so not a whole lot of time playing with toys.

I will however do my best to try and implement the ISY side this coming weekend.  I'll surely keep you posted.

Also interested in knowing how you passed information from the ISY to Openhab.  One thing missing in Openhab is the "Light" value from the Weather module.  All of the free services does not offer this information.  I would love to pass this info from the ISY to a variable in Openhab somehow.

Link to comment

Hi Steve,

 

I haven't forgot about this one either, I have been a little bit busy these past few weekends helping a family member in need, so not a whole lot of time playing with toys.

I will however do my best to try and implement the ISY side this coming weekend.  I'll surely keep you posted.

Also interested in knowing how you passed information from the ISY to Openhab.  One thing missing in Openhab is the "Light" value from the Weather module.  All of the free services does not offer this information.  I would love to pass this info from the ISY to a variable in Openhab somehow.

 

Ok, so I figured out how to pass info into items in OpenHAB via the REST API... so I'll be testing out some code shortly to see if I can get it all working well together. My tests worked great though, I was able to pass the distance in to a Number variable, add that variable to a sitemap and have it show up without a problem.

 

I haven't really done much with getting info from the ISY to OpenHAB, it's more just been to create some switches in OpenHAB to turn on and off scenes in the ISY which I linked with the older legacy 1.7 version of the binding. It leaves a lot to be desired, but for now... I guess it's better than nothing. I haven't spent much time working on it, I just really wanted to build it to test this all out for you guys.

 

As long as it all works, I can probably rename the project to just iOS Proximity something and put the options in the conf file to configure the ISY and/or OpenHAB.

Link to comment

Hi Steve,

 

Started last night installing you proximity script.  I'm about half way.  most work correctly but did have a bump or two.

First I got an error message trying to run pip install -r requrements.txt  I've notice the misspelling, but different variations did not work, (also used sudo) no luck.  I was, however able to install Click.   Then copied my iphonelocation.ini and when I opened it, it was blank, so was the source file iphonelocation.ini.sample.  I found it strange as your file on github has all the info in it.

 

But the bigger issue I see, and that's for me to sort out, but in the .ini file, I see that we need to supply our credentials to iCloud (username, password).  This is in plain text and having access to iCloud gives access to my Apple account, credit card number etc.  If I recall, you had stated in a previous post that your script "called home" for some reason, maybe just to see the different location of users of this script.  But I have to say that I have some security concerns.  Please don't take this personally, but also being a newbie with a Raspberry PI, I may very well not have all the security in place.  someone gets in my network and now have my Apple account information.  Can you share your thought on this please?

 

Thanks

Link to comment

Hi Steve,

 

Started last night installing you proximity script.  I'm about half way.  most work correctly but did have a bump or two.

First I got an error message trying to run pip install -r requrements.txt  I've notice the misspelling, but different variations did not work, (also used sudo) no luck.  I was, however able to install Click.   Then copied my iphonelocation.ini and when I opened it, it was blank, so was the source file iphonelocation.ini.sample.  I found it strange as your file on github has all the info in it.

 

But the bigger issue I see, and that's for me to sort out, but in the .ini file, I see that we need to supply our credentials to iCloud (username, password).  This is in plain text and having access to iCloud gives access to my Apple account, credit card number etc.  If I recall, you had stated in a previous post that your script "called home" for some reason, maybe just to see the different location of users of this script.  But I have to say that I have some security concerns.  Please don't take this personally, but also being a newbie with a Raspberry PI, I may very well not have all the security in place.  someone gets in my network and now have my Apple account information.  Can you share your thought on this please?

 

Thanks

 

I can surely take a look at the spelling correction... I'm not sure if it's the file I spelled wrong, or just the instructions, but I'll look at it ASAP.

 

As for the files being empty, yes thats something you need to look at, as for sure, on the repo they are not empty.

 

Regarding the username and password, if you look in the code they are not sent anywhere but to Apple to the iCloud API which obviously has those credentials already and while they are stored in clear text in the configuration file, they are only transmitted to Apple via SSL.

 

As for the "call home" part you're talking about... I'm not exactly sure. Basically all the processing and such happens on your machine in the script, the only 2 outbound calls the script makes are:

 

1) To the iCloud API which sends your username and password over SSL to get your device location data and your device status data.

2) The script makes a single call to "updates.casta.no" which is my software versioning website, it sends no username or password, doesn't even send any location data, it just reached out to the website over SSL, sends NO data at all, but reads a text file with the latest version number of the script in it, so in the this case "latest.txt" at the time of this writing has just "0.17.1" in it and if you're on an older version it reads another text file from the same location called "urldata.txt" which is just the URL to GitHub where you can go to download the newest version and displays it on the screen for you.

 

So, regarding your iCloud credentials, nobody get's sent those but Apple, nobody get's your location info but the script, and obviously since it's reading it from Apple, they have it already anyway and, through the API you're not able to make purchases, read credit card info or anything else like that either, it's just not something they allow over their public API.

 

As for the credentials being in clear text, no ports are open to your Raspberry Pi, it's not allowing any connections in, so there really is nothing exposing your RasPi to the internet that would make it hackable. However, yes... if someone is on your home network and starts hacking your Raspberry Pi, knows your login and password to the Raspberry Pi, etc... they could in fact read your iCloud username and password, HOWEVER.... if there's some dude you don't know sitting on your couch with a laptop trying to hack a Raspberry Pi on your local network.... you probably have bigger problems then someone buying a few 99 cent apps before you change the password after the police leave. :-P

 

That's one of the nice things about open source though... the issues you raise are all out there for everyone to see. You can see all the code, see how everything works and are fully aware of everything the script can and does do at all times. If I was harvesting iCloud credentials or collecting users location info myself, people would be all over it and would have posted in here already that I a big scammer and to stay away from this script!

 

So, not like "my word" really counts for anything, since you don't know me at all... but if you want to have someone else big into the code with more experiance, you'll see, the only data that gets "sent" from your script out to anyone are the things I mentioned above, your iCloud credentials have to go to Apple, who has them already, and the scripts reads a text file from my versioning website to see if it's running the latest version of itself.

 

And even that last part doesn't really SEND me any info, it just reads the URL... mostly for use in future versions, which will be coming out in the next few days, that give you the option to "auto-upgrade" whenever you'd like by running something like "python iphonelocation.py --upgrade" which would download the latest version of the script, transfer your settings over to a new .ini file when features are added, show you a quick explanation on the screen of what those new feature are, then let you just go back to running things as usual.

 

Right now upgrades are a little bit harder since you've got to manually move everything from one .ini file over to the new one when new features are added, the next version of the software to come out "v0.18.0" looks to avoid that, and in future versions, roadmaped for version "v0.19.0" or possible "v1.0" you'll have the option to turn on literal "auto-updates" where the script will just download new copies of the code on it's own, move your settings over to a new config file, always backing up the old one and totally restart itself so you'll always been on the newest version all the time.

 

Bottom line here... there's noting to worry about. None of your data get's sent anywhere and the script doesn't expose the Raspberry Pi to the internet so it's not even acessible to anyone for them to attempt to hack it.

Link to comment

Thanks for the explanation Steven,

 

I wasn't really pointing a finger and I hope that you didn't take it personally.  You are right, I don't know you, but I am usually the guy that think that everyone are "nice guys" and most just plainly want to help out.  Take it from someone that's really not a coder and have no clue of what any of this does.  After I posted, I thought that it would have been best for me if I would have read up a little bit on iCloud API.  Haven't had the chance, but I may.  In any case, I don't think now, after your explanation, that this will stop me from installing your script.

 

I also have to be honest with you that I also don't know  if my raspberry pi can be accessed from the web.  On this "pi" I have an install of OpenHab and although i can only access it internally at this time, i plan to subscribe to my.openhab in order to get access from remote location with my mobile app.  I think that I prefer using this method than punching a hole in my firewall.  I also have installed a version of "nginx" as a light weight web server.  I was trying to play around with a python script that would allow remote start of my car, but I haven't been successful at all with it.  Too bad as I had all sorts of ideas on how to trigger remote start of my car for the upcoming winter months.   Anyway, I may have created some sort of access from the web ... not sure.

 

I am a bit puzzled of my my configuration file was empty ... now I know that I could copy the content from yours in mine and I should be all set, but this puts doubt in my mind that I may have done something weird and other files may be empty as well.

 

In any case, I plan to continue working on this this evening ... I'll keep you posted.

I honestly appreciate all your work and talent on this nice utility.  Hope you forgive me from being a little paranoid, and my apologies if I offended you.

Link to comment

well, I was able to make my way through the install ... I think.

I am seeing results on the pi with a distance of 0.108813 ....

But my ISY still shows "0" for my distance ... this may be normal, not exactly sure if it should show the decimals or not.

 

Also, how would you recommend to start this script automatically at startup?   Thanks

Link to comment

well, I was able to make my way through the install ... I think.

I am seeing results on the pi with a distance of 0.108813 ....

But my ISY still shows "0" for my distance ... this may be normal, not exactly sure if it should show the decimals or not.

 

Also, how would you recommend to start this script automatically at startup? Thanks

You're doing pretty good so far!!

 

What firmware are you running? The v4.xx series or v5.0.x???

 

As for running the script automatically, I'm a big fan of running either the program "supervisor" or "monit" to auto start scripts like this and make them keep running.

 

As for the "0" being sent to the ISY, the because by default the script only uses distances to the nearest mile. So with a distance of .108 and change in the script that's going to report the distance as a 0. Once you get farther away, over .5 miles it will round up to show "1" as the distance.

 

Once I know what firmware version you're on I can show you how to make that more precise.

 

 

Sent from my iPhone using Tapatalk

Link to comment

Thanks Steven,

 

Happy to see that I am well on my way, this will be great.

Currently I am running version 4.5.0 on the ISY, not planning to move to 5.0 until it's pretty stable.

 

Can you dumb it down a bit for the programs that assist with autostart?  Remember ... newbie here  :)

 

Also currently I am using the geofence in Mobilinc to trigger events.  I really like that it has a 300 ft radius to the house.  It's never failed for me to trigger precisely at the same place every time.  Didn't work so well for my wife, that's why I am looking at a different solution.  And this could satisfy both my ISY and OpenHAB.   Is there a way to be able to accomplish the same thing with your script?   Right now, if I am in the geofence, I have a variable that changes to "1", if I leave, it goes to "0" and I can build my logic around that.  Can you give me examples on how you are triggering events on change?

Link to comment

Happy to see that I am well on my way, this will be great.

Currently I am running version 4.5.0 on the ISY, not planning to move to 5.0 until it's pretty stable.

 

Ok, so first is getting the distance control you want. Since you're on the v4.x.x series firmware, your variables can't do decimal places, they're whole integers only. So if you look in the iphonelocation.ini file you'll a setting names "isy_distance_multiplier", in the latest version availible to the public *v0.17.1", it's like 88 of the .ini file. The section reads as follows:

# This multiplies the distance reported to the ISY by the value below. This is done for ISY
# units running firmware earlier than v5.0.x so they can have more precise distance actions.
# For example, if the setting below is set to 100, a distance of 23.12345678 miles, with the
# above precision setting left set at 0, will report it's distance to the ISY as 2312. This
# basically means your distance is 2312 100ths of a mile.
isy_distance_multiplier = 0

So basically, for you to continue to use your "300 foot" distance, you need to increase that number. Since our ISY can only hold integers with no decimal place, this setting with basically just multiply whatever distance you are from home, by this number. According to my math, with a mile being 5280 feet, and you wanting things to happen at 300 feet, thats a distance of 0.05681818181 miles. So to get that level of precision, I would say you should change that value for isy_distance_multiplier to 1000. This is going to report your distances in 1000ths of a mile. So when you're 1 mile away, your ISY is going to see a value of 1000. In order to set things to happen at 300 feet, you'd want them to happen when your variable is at about "56". That would be "56 1000ths of a mile" or roughly 295 feet.

 

Also currently I am using the geofence in Mobilinc to trigger events.  I really like that it has a 300 ft radius to the house.  It's never failed for me to trigger precisely at the same place every time.  Didn't work so well for my wife, that's why I am looking at a different solution.  And this could satisfy both my ISY and OpenHAB.   Is there a way to be able to accomplish the same thing with your script?   Right now, if I am in the geofence, I have a variable that changes to "1", if I leave, it goes to "0" and I can build my logic around that.  Can you give me examples on how you are triggering events on change?

 

So yes, this can be done the same way... and that's basically exactly how I do it. You would create a program that basically says "if my distance is greater than 56, set my geofence variable to 1", the build another program that says "if my distance is less than or equal to 56, set my geofence variable to 0" Then all the same functionality will work that you had programmed before. If everything is already triggers from that variable anyway, they'll keep working, you're just changing that variable from a different source.

 

Does that make sense?

 

Can you dumb it down a bit for the programs that assist with autostart?  Remember ... newbie here   :)

I think the best thing for me to do here is show you what I'm running. Basically, you'll need to install supervisor to begin with with the command "apt-get install supervisor"

 

Then you'll need to built a configuration for the script to run. This is nothing more than creating a text file with the info supervisor needs to run your program. You'd make it with the command "vi /etc/supervisor/conf.d/iphonelocation-steve.conf", and here is the content of my configuration file:

[program:iphonelocation-steve]
command=/usr/bin/python iphonelocation.py
directory=/opt/apps/iphonelocation-steve/
priority=100
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/iphonelocation-steve.err.log
stdout_logfile=/var/log/iphonelocation-steve.out.log
user=root

Basically this configuration file tells the supervisor services to change to the /opt/apps/iphonelocation-steve directory where I have the script installed (I have the "-steve" on there because I fun a few copies to monitor multiple devices), and then it tells supervisor to basically run the same "python iphonelocation.py" command you run to start the script, but it does this all in the background when the supervisor program starts. The priority isn't really important for you, it's used when you have multiple programs starting to control what order they start in, "autostart" obviously tells supervisor to start this program everytime supervisor itself starts "autorestart" tells it to try to restart the program if it crashes for some reason and the "startretries" tells supervisor to try 3 times before giving up.

 

The log files capture the program output while it's running the background, and the user section tells the program to run as user "root".

 

That pretty much does it, the only other thing I do is in the /etc/supervisor/supervisord.conf file I add a section to the bottom of the file like this:

[inet_http_server]
port = 9001
username = admin
password = password

This allows me to open up a web browser and go to the IP of my raspberry pi on port 9001, so "http://yourip:9001"and log in with that username and password and you get a little graphical interface to see if the program has started, what PID it's running under and it will let you look at the program logs its collected in the files mentioned in the application config.

 

That's pretty much it.

 

Just be aware though, that based on your previous post, it sounds like you might have to expand your 300 foot radius, or maybe adjust your home settings a bit because when you said you were first running the script, you were showing a distance of 0.108813 which would already be outside of your home radius. Also, 300 feet is a VERY close radius to see just based on your device capabilities. Even when I have a pretty solid GPS signal to my iPhone 6s Plus, the GPS accuracy get's show anywhere between 5 and 50 meters and when it's on GPS, the most common accuracy level is 65 meters. That's already 213 feet of your 295 feet... that's playing it pretty close. Unless you find tune your home distance so that you get basically the EXACT GPS coordinates, the script may either never think you're in the home area and/or bounce you in and out of it. I spent a good deal of time making sure I had my EXACT GPS coordinates for my house and even with that, while I've been home for the past few hours, asleep and not even moving, I'm showing distances from home ranging from 0.0109365076994 all the way up to 0.0593268414988 which would be enough that if you have your GPS radius set at 300 feet, your ISY would mark you "not home" with a reading like that.

 

Most of the guys I've talked to including myself really run the script with the shortest distance for action being about 1/4 of a mile or .25 as opposed to where you're aiming for .05-ish.... it might be worth it to run the script for a bit, fine tune your GPS location for home, see how consistently low you can keep the distance readings, then use that to try to judge what the smallest radius you can run is. That's really a limitation of the phone and your GPS signal, not the script.

 

While you're working on all of that, I'm working on getting v0.18.0 ready, which includes the ability to auto update and recreate your .ini file for you so you don't have to move setting over and it also introduces the ability to send the distance data to openHAB 2 which I've been running for about a week now without any problems. 

Link to comment

Thanks to your helpful posts and patience, seems like I have your script working perfectly and starts automatically with supervisor.

I've also tweaked my GPS location and changed the multiplier to 1000.   I also think that I will try tripling my geofence radius to 900 ft.  Your comments made a lot of sense and I should just give it a shot to see if I like it.

 

What I haven'd done so far:

- Create a geofence variable (for testing) in the the ISY and test the home away.  I can later move it to the one that I am currently using.

- I also need to read through this thread to get the entire concept so that I can use this at it's fullest.  Such as WiFi etc.

 

Questions for you:

- Are you planning that at some point and time you will add the functionality of multiple devices that can be tracked?

- Also I am assuming that the database my start getting to be pretty sizable after a while.  Will there be an automatic method to purge information from it?

 

Looking forward to the new version and testing with OpenHAB as well.  For now I am still using OpenHAB 1 (ver. 1.8.3)  I am hoping that your method will work as well in version 1 as it does in ver. 2

 

Also wanted to point out the misspelling in step 4 of your Github readme file ... it shows:  pip install -r requrements.txt

As you can see requirements needs to be corrected so that other copy/paste wizards like me don't get stumped.

 

Awesome work Steven .... Thanks

Link to comment

Thanks to your helpful posts and patience, seems like I have your script working perfectly and starts automatically with supervisor.

I've also tweaked my GPS location and changed the multiplier to 1000.   I also think that I will try tripling my geofence radius to 900 ft.  Your comments made a lot of sense and I should just give it a shot to see if I like it.

 

Yes,  you might find that a slightly larger distance than the 300 feet will work with much more reliability. Mine is set to 1/4 mile (.25) and it works 100% of the time.

Questions for you:

- Are you planning that at some point and time you will add the functionality of multiple devices that can be tracked?

 

 

Yes, a multi-device version with multiple threads and a web interface will be availible eventually... right now I just wanted to get the framework and actual device/mathematical functionality done first before I work on making it pretty. Until the multi-device version comes out, you can do the same thing I've done to track multiple devices which is simply to just run multiple copies of the same script. I have mine tracking 6 devices right now, I just run everything 6 times!

 

- Also I am assuming that the database my start getting to be pretty sizable after a while.  Will there be an automatic method to purge information from it?

 

 

The data that's stored in the database is actually very small. I currently have just over 5000 records in my database and it's only 9.1M of data on disk. I hadn't thought about writing in a way to purge records, but it could be done. Or maybe just create a small command line utility that could be run every once in a while to keep only the last xxxx number of records or something. It's something to consider, but it's going to take a long time to build up enough data for it to really become a problem for you... probably years.

 

Looking forward to the new version and testing with OpenHAB as well.  For now I am still using OpenHAB 1 (ver. 1.8.3)  I am hoping that your method will work as well in version 1 as it does in ver. 2

 

From what I can tell, the code appears to be the same for the REST API into openHAB, so it should work on 1.8.3 also. I should have the next release ready in a day or two that will add the openHAB functionality so you'll be able to test it soon.

 

Also wanted to point out the misspelling in step 4 of your Github readme file ... it shows:  pip install -r requrements.txt

As you can see requirements needs to be corrected so that other copy/paste wizards like me don't get stumped.

 

 

I did catch that yeah, thanks for pointing it out. I've corrected it in the development branch of the software so it will get updated fully after the next release, until then I've manually edited the only version and corrected the spelling.

 

Awesome work Steven .... Thanks

 

 

 
And no problem, I'm glad you're finding it useful and that it's working well!!
Link to comment

I haven't read all 4 pages yet, but 3 questions I have:

 

1.)  Will this work with multiple locations such as Home and Work?

2.)  Will this work with multiple iPhones (separate iCloud accounts?)  Husband & wife

3.)  How about multiple devices on the same iCloud account, iPhone & iPad.

 

Thanks for your time on reading this post.

~Aaron

Link to comment

Steven,

 

I have followed your directions to a tee.  However I get this message:

C:\wamp64\www\prox>python ./iphonelocation.py
Startup: PID=8004
Startup: Failed to load logging settings, ABORTING!
Traceback (most recent call last):
  File "./iphonelocation.py", line 52, in <module>
    f_out = open('/tmp/{}.pid'.format(application_logging_name), 'w', 0)
IOError: [Errno 2] No such file or directory: '/tmp/iPhoneLocation.pid'

-WAMP64 on Windows Server 2012 R2

-Added PYTHON27 & PYTHON27/scripts/ path to my environment variables - Installed a windows installer for PYTHON 2.7 since its not included in WAMP

-I ran the PIP command as expected and the listdevices.py as expected

-I created a database inside phpMyAdmin and thats all I have done for MYSQL

-100% sure MYSQL username/pw are correct.  MYSQL Console logins and works with password

-I tried creating a folder called "tmp" inside the PROX folder, no change

-I tried creating a file called iPhoneLocation.pid in C:\WAMP64\www\prox\tmp\

-No log has been created...no log folder from within the PROX folder

-prox\iphonelocation.py is my location to the python file.

 

Any thoughts?

Link to comment

I am also have some trouble getting this going. I got to step 9 in the Read Me:

 

9) Change to the tools directory and run python ./listdevices.py and it will connect to the iCloud API using the credentials from the iphonelocation.ini file and list all the devices associated with your iCloud ID. Make sure the iCloud API settings in the iphonelocation.ini file are set, the listdevices.py script reads your login and password from there.

 

When I run the listdevices.py, I get back

 

"line 20 print 'iphonelocation.ini' exists, continuing.' 

 

SyntaxError: invalid syntax

 

Not sure what I did wrong. I have my iCloud credentials in the .ini file which is in the conf folder. The list devices file is in the tools directory. I'm running using command prompt with admin rights. 

Link to comment

I am also have some trouble getting this going. I got to step 9 in the Read Me:

 

9) Change to the tools directory and run python ./listdevices.py and it will connect to the iCloud API using the credentials from the iphonelocation.ini file and list all the devices associated with your iCloud ID. Make sure the iCloud API settings in the iphonelocation.ini file are set, the listdevices.py script reads your login and password from there.

 

When I run the listdevices.py, I get back

 

"line 20 print 'iphonelocation.ini' exists, continuing.' 

 

SyntaxError: invalid syntax

 

Not sure what I did wrong. I have my iCloud credentials in the .ini file which is in the conf folder. The list devices file is in the tools directory. I'm running using command prompt with admin rights. 

 

Are you running on windows also?

 

As for the SyntaxError, that sounds to me like something in the .ini file might not be right. Can you check the logs directory and see if there's any output into the log?

Link to comment

Steven,

 

I have followed your directions to a tee.  However I get this message:

C:\wamp64\www\prox>python ./iphonelocation.py
Startup: PID=8004
Startup: Failed to load logging settings, ABORTING!
Traceback (most recent call last):
  File "./iphonelocation.py", line 52, in <module>
    f_out = open('/tmp/{}.pid'.format(application_logging_name), 'w', 0)
IOError: [Errno 2] No such file or directory: '/tmp/iPhoneLocation.pid'

-WAMP64 on Windows Server 2012 R2

-Added PYTHON27 & PYTHON27/scripts/ path to my environment variables - Installed a windows installer for PYTHON 2.7 since its not included in WAMP

-I ran the PIP command as expected and the listdevices.py as expected

-I created a database inside phpMyAdmin and thats all I have done for MYSQL

-100% sure MYSQL username/pw are correct.  MYSQL Console logins and works with password

-I tried creating a folder called "tmp" inside the PROX folder, no change

-I tried creating a file called iPhoneLocation.pid in C:\WAMP64\www\prox\tmp\

-No log has been created...no log folder from within the PROX folder

-prox\iphonelocation.py is my location to the python file.

 

Any thoughts?

 

I honestly think the problem you're having here is that I never designed this program to run under windows, so right at the start it's trying to write to a unix style path, that's what the trouble is. Just to get you up and running very quickly before I push out a fix, try this.

 

Put a "#" (pound symbol, or hashtag as the kids are calling it these days... WITHOUT the quotes)... so put a # infront of lines 52 through 55, that will comment out the creation of the .pid file completely while I rewrite that part to detect windows and put it in a better place.

Link to comment

I haven't read all 4 pages yet, but 3 questions I have:

 

1.)  Will this work with multiple locations such as Home and Work?

2.)  Will this work with multiple iPhones (separate iCloud accounts?)  Husband & wife

3.)  How about multiple devices on the same iCloud account, iPhone & iPad.

 

Thanks for your time on reading this post.

~Aaron

Going back a few posts, I missed this one:

 

Right now the script only monitors 1 device on 1 iCloud account with 1 "home" location at a time. However, you could very easily just copy the script or clone the script contents into multiple different directories and run it multiple times with different settings for each script. That's what I do monitor multiple devices right now.

 

Multiple device support is planning for the near future, multiple locations is a little more complex, but I'm sure I can put it in there somehow.

 

*SMC

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...