toddaustin07 / phonepresence

Experimental programs to track mobile phone presence on home LAN
Apache License 2.0
5 stars 0 forks source link

No such file or directory: 'ip' #1

Open bsf29 opened 1 year ago

bsf29 commented 1 year ago

macOS Monterey python v3.9.4. Receiving FileNotFoundError: [Errno 2] No such file or directory: 'ip'

Sorry, I'm a beginner with Python so I may have overlooked something I needed to install or configure. I did define 2 phones in the .cfg file.

toddaustin07 commented 1 year ago

Can you please share your config file?

bsf29 commented 1 year ago

I'm not getting an error on my Pi where I intend to run this. It only fails on my MacBook (both phonepresense.py and phonepresence_st.py). Different errors on each py so I'm thinking something is messed up on my MacBook.

[config] phone_ips = 192.168.2.30, 192.168.2.29 phone_names = Bry, Pam ping_interval = 20 offline_retries = 10

Sat Feb 4 09:32:31 2023 Using 'ARP' to find tracked devices Sat Feb 4 09:32:31 2023 Pinging Traceback (most recent call last): File "/Users/bryan/CloudStation/MyStuff/phonepresence-main/./phonetrack.py", line 270, in iplist = scanner.scan() File "/Users/bryan/CloudStation/MyStuff/phonepresence-main/./phonetrack.py", line 156, in scan return self.find_with_ip() File "/Users/bryan/CloudStation/MyStuff/phonepresence-main/./phonetrack.py", line 145, in find_with_ip neighbors = subprocess.run(cmd, shell=False, capture_output=True, text=True) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ip'

toddaustin07 commented 1 year ago

I assume you are setting this up for SmartThings? If so, it looks like you used the wrong config file template. You need to make sure you downloaded the one from the SmartThingsIntegration folder here.

Your config file should look like this:

[config]
phone_ips = 192.168.2.30, 192.168.2.29
phone_names = Bry, Pam
phone_offline_retries = 10, 10
#
ping_interval = 20
#
port = 50001
bridge_address = 192.168.n.nnn:8088
console_output = yes
logfile_output = yes
logfile = phonetrack.log

Note that the phone_offline_retries config line must contain a value for each phone IP configured. This allows you to have a unique retry count for each phone.

Also make sure that you are using the phonetrack_st.py file from that folder.

bsf29 commented 1 year ago

Yep, I have it working with SmartThings on my Pi. Nice bridge and it just fixed one of my issues since SmartThings broke IFTTT.
No idea what my Mac doesn't like, but I was just testing on it since it is easier to build stuff.

toddaustin07 commented 1 year ago

OK, sorry for the false lead! I'm not sure what the Mac issue could be unless it's some problem with one of the libraries. This uses configparser and requests, so make sure that you have them installed via pip. If you doing some non-SmartThings testing on your Mac then just make sure you are using the phonetrack.py and phonetrack.cfg from the repository root directory. I don't have a Mac myself, so can't reproduce the error here.