gcobb321 / icloud3_v3

iCloud3 v3, Development Version - This Repo/Version is used for development and testing of new and updated features. It is not the official release of iCloud3 v3, .
MIT License
169 stars 13 forks source link

iCloud3 v3, Release Candidate 2 - fails to load, bootstrap.py:531 #178

Closed d-d closed 1 year ago

d-d commented 1 year ago

Upgraded to iCloud3 v3, Release Candidate 2 It fails to load

Logger: homeassistant.bootstrap
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:531
First occurred: 10:52:18 (1 occurrences)
Last logged: 10:52:18

Error setting up integration icloud3 - received exception
asyncio.exceptions.CancelledError

Home Assistant 2023.8.1 Supervisor 2023.08.1 Operating System 10.4 Frontend 20230802.0 - latest

gcobb321 commented 1 year ago

Are you using the iOS app and the mobile_app integration? If not, edit the icloud3/manifest.json file. Remove _mobileapp from the after_dependicies line. Save and restart HA.

Right now, that line looks like this. "after_dependencies": ["recorder", "ios", "mobile_app", "device_tracker", "sensor"],

I’m running the same side version of HA.

d-d commented 1 year ago

Yes, I am using the iOS app and the mobile_app integration.

I changed the line to "after_dependencies": ["recorder", "ios", "device_tracker", "sensor"], and restarted HA

Still fails to start with error

2023-08-10 17:14:56.987 ERROR (MainThread) [homeassistant.setup] Setup of device_tracker is taking longer than 300 seconds. Startup will proceed without waiting any longer
2023-08-10 17:14:57.033 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration icloud3 - received exception
asyncio.exceptions.CancelledError

Maybe this is obvious to you, but if I go into the Integrations menu and choose to Configure, I get an error too:

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

I will try to disable some of the other integrations and see if I can resolve it this way. The setup worked fine before upgrading to the RC2.

gcobb321 commented 1 year ago

I’d like to see your home_assistant.log and the icloud3_0.log files. Can’t you email them to geekstergary@gmail.com.

Try reinstalling iCloud3 again. Either from HACS or unzipping the icloud3 zip file and restarting HA.

d-d commented 1 year ago

Removing the dependency for "device_tracker" seems to have done the trick. By removing it from RC2 starts again and is working as before. The icloud3/manifest.json now looks as: "after_dependencies": ["recorder", "ios", "sensor"], and now RC2 is starting up.

I will email you the logs.

gcobb321 commented 1 year ago

Did you mean removing "mobile_app"? or "device_tracker"?

I added "mobile_app" because HA runs the code through some type of verifier when creating a release. It kept coming up with "mobile_app" needed to be added as a dependency (which it is not) or an after_dependency (which is not needed by mee).

thanks for the logs. That may tell something.

d-d commented 1 year ago

I had to remove both mobile_app and device_tracker The working line is when both are gone,
"after_dependencies": ["recorder", "ios", "sensor"], When I add device_tracker OR mobile_app OR both back, i get the error that Setup of device_tracker takes longer than 300 seconds and that icloud3 has received an exception.

I hope you can figure out something from the logs. My config might just need cleaning up, it is getting old now with lots of upgrades over the years. At the same time, this will be the case for many others too, so I suppose it is good to gracefull handle such problems.

gcobb321 commented 1 year ago

And I'm running with both of them in the list. There must be some conflict somewhere and I hope the logs will help figure it out.

Do you have a known_devices.yaml file? I'm reworking the code to remove any iCloud3 devices from it to preserve anything else that is in it. I think it's just a text file but I'm getting an HA error and want to verify the format.

d-d commented 1 year ago

I do have a known_devices.yaml file The format is basic

joes_ipad:
  hide_if_away: true
  icon:
  mac: BT_8C:FA:FF:31:1E:2A
  name: Joe's iPad
  picture:
  track: true

Each such device entry seems to be separated by one or more empty lines.

ABredhauer commented 1 year ago

I'm also seeing the same error. Happy to provide logs or other files if you need another set

Home Assistant 2023.7.3 Supervisor 2023.08.1 Operating System 10.4 Frontend 20230705.1 - latest

FrancoLoco commented 1 year ago

Also have problems with this version I'm reverting to the previous one

gcobb321 commented 1 year ago

@d-d I finally had a chance to review your log files and found this:

  1. There was an error setting up the Samsung TV. This was followed by the following 5-secs later:
    2023-08-10 17:14:56.987 ERROR (MainThread) [homeassistant.setup] Setup of device_tracker is taking 
    longer than 300 seconds. Startup will proceed without waiting any longer
    2023-08-10 17:14:57.033 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration
    icloud3 - received exception asyncio.exceptions.CancelledError

    iCloud3 had an 'device_tracker' _afterdependency in the manifest.json file which tells HA that iCloud3 has to be set up after the device_tracker. When the device_tracker failed, HA aborted iCloud3. I have removed those dependencies from the manifest.json.

That HA failure to load iCloud3 caused another error later on when you opened the Devices & Services > iCloud3 Configure Settings since the configuration file had not been opened and loaded.

  1. You are getting a message indicating there is still a platform: icloud3 in your configuration.yaml file. It is being ignored but you can remove it and config_ic3.yaml if you are using it.

  2. There was a network/internet error and iCloud3 could not get location data from your iCloud account. That dumped error messages to the log file, along with a 'communication/network response error'. I have changed to error reporting so the internal error messages are not displayed. Only the 'friendly' error message will be displayed in the logs and the Event Log.

The real problem was #1 when HA failed to start the device_tracker and iCloud3. The manifest.json file is changed ot what it was in rc3

gcobb321 commented 1 year ago

@d-d @ABredhauer @FrancoLoco

Here is a prelease of iCloud3 v3 rc3 with the fixes to your issues noted above.

icloud3_v3-rc3.zip

Download the zip file and unzip it into the iCloud3 directory. Let me know if you see anything else and I'll address it before the release. Thanks for testing it on your system.

Change Log:

  1. Reverted the 'manifest.json' file to prevent iCloud3 from hanging on an HA startup if there is a problem starting some of the HA components.
  2. Added a 'Restart HA, Reload iCloud3' to the Configure Settings > Actions list. You can now restart HA or reload only the iCloud3 component if the is a problem.
  3. Fixed some v2 to v3 configuration migration issues.
ABredhauer commented 1 year ago

@gcobb321 sorry for the delay, I've only just been able to install the prerelease version. So far I can confirm it starts up fine with no errors but will let you know if anything else pops up

d-d commented 1 year ago

@gcobb321 I can also confirm the prerelease starts up without issues on my system and tracking is working. I will let you know if there are issues later.

gcobb321 commented 1 year ago

I just posted an updated rc3. Find it on issue 177 here. Scroll to the bottom.