fjxmlzn / findmyhistory Goto Github PK
View Code? Open in Web Editor NEWTrack your Apple devices and look up their past location, battery levels, and more
License: MIT License
Track your Apple devices and look up their past location, battery levels, and more
License: MIT License
Sorry for the amateur question. I am a beginner in apple world and also terminal and macbook. I understand that the terminal is similar to commander in windows, but I don't understand the connections exactly yet. Like github, it is unknown to me.
I downloaded the zip file, allowed terminal access to the folders and ran the code using the code. The script obviously logs all my devices, shows how many updates there have been and the update time. So everything works. But I have a few basic questions and would like an amateur and simple explanation.
I really apologize for the amateurism.
Hello, Im really sorry if my question bother, I never coded before.
I’m using this code because I put an Airtag on my bike and it was stolen but I don’t precisely know when. It works perfectly for me, but I would like to know if it’s possible to find the logs of before you create the code on your Mac, and find at least the day when my bike changed country (it was at least a month ago). If yes, Is it possible to explain it to me ?
Thank you for your time ! (and sorry if my english is poor)
@fjxmlzn I don't understand the location|timeStamp.
It says 1690396140000
in the CSV log.
Anything wrong here?
Time format in Terminal looks just fine.
Originally posted by @OlDirty89 in #4 (comment)
I think this would provide an easy visual interface for people to follow the AirTags.
This is the Nextcloud App
https://apps.nextcloud.com/apps/phonetrack
This is the Page for Clients to send updates to the APP.
https://gitlab.com/eneiluj/phonetrack-oc/-/wikis/userdoc#logging-methods
It has a built in Post/Get option for adding History Points I am sure there are other options.
"HTTP request
You can build your own logging system and make GET or POST HTTP requests to PhoneTrack.
Here is an example of logging URL with POST:
https://your.server.org/NC_PATH_IF_NECESSARY/index.php/apps/phonetrack/logPost/TOKEN/DEVNAME
and with GET:
https://your.server.org/NC_PATH_IF_NECESSARY/index.php/apps/phonetrack/logGet/TOKEN/DEVNAME
The POST or GET parameters are:
lat (decimal latitude)
lon (decimal longitude)
alt (altitude in meters)
timestamp (epoch timestamp in seconds)
acc (accuracy in meters)
bat (battery level in percent)
sat (number of satellites)
useragent (device user agent)
speed (speed in meter per second)
bearing (bearing in decimal degrees)
"
Great Work on the Apple side..
In the log files, there's a field location|horizontalAccuracy
which one might infer the meaning of, but doesn't have units, doesn't seem to be a percentage, so I'm wondering if anyone has any insight into how to interpret it?
I've seen values between 15 and 410 in some recent data logs, but mostly it hovers around 50-ish.
We're trying to locate a lost AirTag in a complex postal sorting machine, and any clues to get us a more accurate fix would be very helpful!
I follow the steps sign-in on Mac (https://support.apple.com/en-us/HT204053). And connect my ipad with Mac by USB. Also allow full disk access from your instruction.
However, I can find the cache file in /Library/Caches/com.apple.findmy.fmipcore/Items.data
Need your help.
I'm using this handy guide to have main.py run as a service. I want main.py to run when the Mac is booted. One quick thing to note, to make this work I had to go into the Security and Privacy settings on Mac and give Python full disk access.
When I try to run main.py as a service, I get this error:
Traceback (most recent call last):
File "/Users/boda/Documents/FindMyHistory/main.py", line 125, in <module>
curses.wrapper(partial(main, args=args))
File "/usr/local/Cellar/[email protected]/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/curses/__init__.py", line 73, in wrapper
stdscr = initscr()
^^^^^^^^^
File "/usr/local/Cellar/[email protected]/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/curses/__init__.py", line 29, in initscr
setupterm(term=_os.environ.get("TERM", "unknown"),
_curses.error: setupterm: could not find terminal
When I run main.py directly from the terminal I don't get this error. I can't figure out what's going on. When I run echo $TERM
I get xterm-256color
.
I think this might be an issue with the curses package, but I'm not familiar with how it works. Is it possible to modify the last line of main.py curses.wrapper(partial(main, args=args))
so that it doesn't fail if it can't output the result to a terminal?
I've granted it access in the Security settings and I've tried to add 'sudo' in the commandline but I cant get it to work.
sudo git clone https://github.com/fjxmlzn/FindMyHistory.git cd FindMyHistory pip3 install -r requirements.txt python3 main.py Password: fatal: destination path 'FindMyHistory' already exists and is not an empty directory. Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: tabulate[widechars] in /Users/yasingunaydin/Library/Python/3.9/lib/python/site-packages (from -r requirements.txt (line 1)) (0.9.0) Requirement already satisfied: wcwidth in /Users/yasingunaydin/Library/Python/3.9/lib/python/site-packages (from tabulate[widechars]->-r requirements.txt (line 1)) (0.2.13) WARNING: You are using pip version 21.2.4; however, version 24.0 is available. You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command. Traceback (most recent call last): File "/Users/yasingunaydin/FindMyHistory/main.py", line 125, in <module> curses.wrapper(partial(main, args=args)) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) File "/Users/yasingunaydin/FindMyHistory/main.py", line 91, in main log_manager.refresh_log() File "/Users/yasingunaydin/FindMyHistory/lib/log_manager.py", line 83, in refresh_log items_dict = self._get_items_dict() File "/Users/yasingunaydin/FindMyHistory/lib/log_manager.py", line 60, in _get_items_dict raise RuntimeError(f'No devices found. Please check if Full Disk ' RuntimeError: No devices found. Please check if Full Disk Access has been granted to Terminal. yasingunaydin@Air-van-Yasin FindMyHistory %
Is this script also working with MacOS Catalina 10.15.5?
MQTT support would be great.
Then you can send the location updates to a mqtt server
I have a mac that was unning Ventura. FindMy shows my AirTags in in "Items" but there is no ~/Library/Caches/com.apple.findmy.fmipcore/ directory.
I upgraded to Sonoma and there is still no ~/Library/Caches/com.apple.findmy.fmipcore/ directory
Anyone have any ideas for me ?
My device name was:
MyName's iPhone iOS 7.1.1 (06/24/14)
This caused an issue in generating file paths with special characters and spaces in the filename.
File "/Users/tylerhall/Downloads/AIRTAGS/FindMyHistory-main/lib/log_manager.py", line 74, in _save_log
with open(path, 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: "log/2023-08-23/MyName's iPhone iOS 7.1.1 (06/24/14)__NULL.csv"
Here is my proposed fix in log_manager.py's _save_log
function.
Here's the modified log_manager.py file that includes the _sanitize_filename function to handle filenames with spaces and special characters:
` def sanitize_filename(self, name):
# Replace spaces and special characters with underscores
return name.replace(' ', '').replace('/', '').replace('\', '')
def _save_log(self, name, data):
log_folder = self._log_folder
if not self._no_date_folder:
log_folder = os.path.join(
log_folder, datetime.now().strftime(self._date_format))
if not os.path.exists(log_folder):
os.makedirs(log_folder)
sanitized_name = self._sanitize_filename(name)
path = os.path.join(log_folder, sanitized_name + '.csv')
if not os.path.exists(path):
with open(path, 'w') as f:
writer = csv.writer(f)
writer.writerow(self._keys)
with open(path, 'a') as f:
writer = csv.writer(f)
writer.writerow([data[k] for k in self._keys])
`
You can add the _sanitize_filename
function to your existing LogManager class to handle filename sanitization. The function replaces spaces, slashes, and backslashes in the name with underscores to create a valid filename.
This modification should help you avoid issues with special characters and spaces in the filenames when creating the CSV files. Just ensure that this updated log_manager.py
file is used in conjunction with the rest of your code.
would it be possible to run this on an ipad?
Using the -h or --help option produces no output, displays "keyboard interrupt".
MacOS Ventura 13.0.1, 2020 iMac 27"
Possibly could be related to my use of Karabiner-Elements? (Keyboard remapper)
https://karabiner-elements.pqrs.org/
I was able to successfully use the --no_date_folder option.
Wanted to look at the exact usage of file naming option. No biggie, will look at source code...
Hello,
I was able to set up your script on my MacBook like a charm. I guess I will be also able to read the csv from homeassistant if I put the csv to some shared folder. However, that's not exactly the way how we should set up our smart home.
Do you plan to rewrite it as an integration for HACS?
I would be really great! Especially if something is to be residently listening, we should use server-like set up. What do you think?
Hi does this support AirTags tracking of history?
Could a optional feature be included to add Friends into the location history?
It appears you can run python on an iPad with the right app. Has an iPad been tested? I’m considering buying an iPad so I can try this on it. But I figured I’d ask first. For that matter could it work on an iPhone?
Hi fjxmlzn & folks,
I am impressed with your script! I installed it on a MAC VM on a Unraid server & it works great. In fact, I had a break-in the other day and was able to track down the stolen goods using the airtags!
But now I was looking for a solution to save the history. Your script is great for this.
The question now is, how to visualize the data best (live). In the case of a theft, it is of course a bit more complicated to make maps of all days, etc.. manually.
Grandios would be a map where you can select the times to display the positions. I have done this with Mapbox, Atlist Maps and Google My Maps. However, not yet with a live ingest. Now I thought about synchronizing the CSV data with a Google Spreadsheet and then loading it into a map. This works. But it is very uncomfortable.
Do you have an idea for an approach how to visualize the data best? If possible even "live"? So that the data is automatically synchronized. I would have thought about writing the CSV data into a MySQL database or converting it into json etc... To synchronize with a server. However, I have not quite found which MAP could be suitable for this.
I would be very grateful for any approach or idea. If I find a way in the meantime I would of course post it here.
Best
Julian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.