gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
546 stars 54 forks source link

iCloud verifies, lists devices, but then says "disabled until Verification can be completed" and defaults to iOS tracking, 501 Error in HA Log #268

Open alexmerm opened 1 year ago

alexmerm commented 1 year ago

Version : 2.4.7 iPhone being tracked is owned by my iCloud Account. Essentially as described in title: Logs show: Stage 1 : normal Stage 2a : Lists iPhone with checkmark next to it. Stage 2b : says "iCloud Account Authenticated (# 1), lists all of my devices + people in my FamShr, with the checkmark next to the tracked iphone, then "iCloud Alert > FmF or FamShr Tracking Method is disabled until Verification has been completed. iOS App Trackimg Method wil be used."

The rest proceeds as normal for iOS tracking afaik. The 501 Error in the Logs is:

(Status Code 501)

Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 6779, in _setup_tracked_devices_for_fmf
    self._log_rawdata("iCloud FmF Raw Data - (api_friends.data)", api_friends.data)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 1079, in data
    self.refresh_client()
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 1006, in refresh_client
    req = self.session.post(self._friend_endpoint, data=mock_payload, params=params)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 179, in request
    self._raise_error(response.status_code, response.reason)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 239, in _raise_error
    raise api_error
custom_components.icloud3.pyicloud_ic3.PyiCloudAPIResponseException:  (Status Code 501)

Thanks in advance and looking forward to upgrading to v3! :)

MrAlucardDante commented 1 year ago

Same here, but HA doesn't report it unless you go in the logs. Looks like it started with HA 2023.6

gcobb321 commented 1 year ago

It’s not HA but Apple. They removed FmF location data from being retrieved using a web service call. Remove the email address from the iCloud3 configuration for all of your devices.

MrAlucardDante commented 1 year ago

I don't have any email set up in my config_ic3.yaml config file though

gcobb321 commented 1 year ago

The configuration.yaml + config_ic3.yaml is the configuration so remove the email from that one.

matspi commented 1 year ago

Same for me. For the devices only device_name is set.

In Stage 2b at step Family Sharing List devices that can be tracked all devices are found and marked with a check-mark. After that the message

iCloud Alert > FmF or FamShr Tracking Method is disabled until Verification has been completed. iOS App Trackimg Method wil be used.

is displayed and no tracking happens.


The only way I could get it to work again, is to remove the call to self._setup_tracked_devices_for_fmf() in this line

MrAlucardDante commented 1 year ago

The configuration.yaml + config_ic3.yaml is the configuration so remove the email from that one.

This doesn't make any sense. The only email I have is the username in the device_tracker part of the configuration.yml, which is obviously required if you want to connect to apple API.

Here is my config :

configuration.yaml

device_tracker:
  - platform: icloud3
    username: !secret icloud_mail
    password: !secret icloud_password
    config_ic3_file_name: ./config_ic3.yaml
    event_log_card_directory: 'www/community'

config_ic3.yaml

devices:
  - device_name: me_iphone
    name: Me
    iosapp_suffix: _app
    picture: me.jpg
inzone_interval: '1 min'
display_zone_format: fname
unit_of_measurement: km
display_text_as:
  - me@gmail.com > me@mail
distance_method: calc
gcobb321 commented 1 year ago

The above note about remove the call to _setup_tracked_devices_for_fmf() on line 1214 is correct.

Change it to #_setup_tracked_devices_for_fmf()

iCloud3 v3 is in the late beta stage that solves this issue and adds a lot of new features. It is a full Integration with all configuration done using configuration screens. Go here for more info and installation instructions. It’s still in beta because I’m adding a few tweaks and the docs are not complete.

keithajmani commented 1 year ago

Just a note that you need to restart HA after making the edits to the file; using the "Restart iCloud3" option from the HA dashboard won't work. Confirming this also worked for me -- thank you!

pitoucoca commented 1 year ago

Version : 2.4.7 iPhone being tracked is owned by my iCloud Account. Essentially as described in title: Logs show: Stage 1 : normal Stage 2a : Lists iPhone with checkmark next to it. Stage 2b : says "iCloud Account Authenticated (# 1), lists all of my devices + people in my FamShr, with the checkmark next to the tracked iphone, then "iCloud Alert > FmF or FamShr Tracking Method is disabled until Verification has been completed. iOS App Trackimg Method wil be used."

The rest proceeds as normal for iOS tracking afaik. The 501 Error in the Logs is:

(Status Code 501)

Traceback (most recent call last):
  File "/config/custom_components/icloud3/device_tracker.py", line 6779, in _setup_tracked_devices_for_fmf
    self._log_rawdata("iCloud FmF Raw Data - (api_friends.data)", api_friends.data)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 1079, in data
    self.refresh_client()
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 1006, in refresh_client
    req = self.session.post(self._friend_endpoint, data=mock_payload, params=params)
  File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 179, in request
    self._raise_error(response.status_code, response.reason)
  File "/config/custom_components/icloud3/pyicloud_ic3.py", line 239, in _raise_error
    raise api_error
custom_components.icloud3.pyicloud_ic3.PyiCloudAPIResponseException:  (Status Code 501)

Thanks in advance and looking forward to upgrading to v3! :)

gcobb321 commented 1 year ago

See the Issue Pinned to the top. Go here. Scroll to the bottom and look for the How to Solve this Problem item.

MrAlucardDante commented 1 year ago

Are you planning to merge v3 into this repo so it’s available as an update in HACS ? Or do we have to switch to the new repo ?

gcobb321 commented 1 year ago

I'm releasing beta 19.2 today which should become rc1 next week in the icl;oud3_v3 repository. I hope to merge it as a Prerelease with the base icloud3 repository within 2 weeks.

Underlyingglitch commented 1 year ago

@gcobb321 Does the iCloud3 V3 support tracking friends? I can see my own devices and my family devices, but not my friend. The configuration wizard does show this field:

Screenshot 2023-08-09 at 22 42 04

Is this completely removed by Apple, or is there some way to track a friend's device? After all they already gave consent to be tracked with the Find My app

gcobb321 commented 1 year ago

Apple took away the web service that provided the friends locations last May. As far as I know, no one has found a workaround or another Apple access point that provides the information. Now that iC3 is done and about ready for a general pre-release, I'll have some time to research this. But I don't have any hope I'll find a solution.

Underlyingglitch commented 1 year ago

Apple took away the web service that provided the friends locations last May. As far as I know, no one has found a workaround or another Apple access point that provides the information. Now that iC3 is done and about ready for a general pre-release, I'll have some time to research this. But I don't have any hope I'll find a solution.

Thanks for the quick reply. If you need any help, I'm available. I have time and programming experience, but no experience with the Apple web services, so it would be nice if you could point me in the general direction

gcobb321 commented 1 year ago

I was going to start with google and apple developer docs. Would appreciate the help

gcobb321 commented 1 year ago

@MrAlucardDante I will be merging v3 into the HACS repo for v2, first as a prerelease, then as a full release. I just saw your question