Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy Keys to iOS device #2

Open
reesion opened this issue Jun 2, 2023 · 4 comments
Open

Copy Keys to iOS device #2

reesion opened this issue Jun 2, 2023 · 4 comments

Comments

@reesion
Copy link

reesion commented Jun 2, 2023

Hi,

I am stuck with the step of copying the keys to the iOS device.

My question is how Do i copy those keys to the iOS device? I am using Windows.

Also, in the configuration.yaml, what is '[email protected] should match your SSH login' ? Is this the details for the iOS device or the Home Assistant?

Thank you

@crispy78
Copy link
Owner

crispy78 commented Jun 2, 2023

I've changed the instructions a bit: I had written some comments in between < and > and that was not shown on Github. I also listed the items that needed attention in configuration.yaml.

shell_command is a HomeAssistant thing as is configuration.yaml.

Other than enabling passwordless SSH login there is nothing to upload or configure on your iOS device.
With passwordless SSH login HA is able to download Items.data, when the file is downloaded the script will extract data from that file and send a MQTT-message containing the data (all done on your HA-machine).

Hope this will help. Otherwise take a look at https://gist.github.com/DomiR/8870918, there are some pointers in the topic itself and the comments.

@reesion
Copy link
Author

reesion commented Jun 4, 2023

Hi,

Thanks for the response. I have managed to perform all the steps. However, there is no new device showing up under MQTT for me. I suspect the ssh_command is not working.

It is showing error in the logs

Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:117
Integration: Shell Command (documentation, issues)
First occurred: 18:23:16 (1 occurrences)
Last logged: 18:23:16

Error running command: ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] '/config/shell_command/find_my/findmy.sh', return code: 127
NoneType: None

Also, I tried to run the SSH command in the HA SSH/Terminal Addon and it gives error as well

image

The file is definitely there in /config/shell_command/find_my/findmy.sh

Any idea?

@reesion
Copy link
Author

reesion commented Jun 4, 2023

Hi again,

I figured out that I have entered the wrong IP. I have used the IP address of my iOS device instead of my HA. Thus, it is reporting no such file or directory.

I have figured out that i need to include sudo as well as i am running HassOS

➜ ~ ssh -i /config/ssh/id_rsa -o 'StrictHostKeyChecking=no' [email protected] sudo /config/shell_command/find_my/findmy.sh
Sun Jun 4 09:01:53 UTC 2023 - Delete Items.data
Sun Jun 4 09:01:53 UTC 2023 - Download Items.data from iOS device (192.168.1.179)
cat: can't open '/config/shell_command/find_my/Items.data': No such file or directory
Sun Jun 4 09:01:54 UTC 2023 - Number of Apple Find My objects to process: 0

/config/shell_command/find_my/findmy.sh: line 80: unexpected EOF while looking for matching `''
➜ ~

It looks like it found the Items.data file from my iOS device but not downloading it?

@reesion
Copy link
Author

reesion commented Jun 5, 2023

Hi again,

I have managed to get it working after modifying your codes.

I have used the below codes to get it working. The path you have in your codes does not exist for me, not sure why.

scp [email protected]:/private/var/mobile/Library/Caches/com.apple.findmy.fmipcore/Items.data $scriptlocation/Items.data

Also, i your codes throws an error if the device name had a " ' " in it.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants