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
498 stars 52 forks source link

icloud3 integration not working on HA 2024.3.0 #317

Open zuppl opened 3 months ago

zuppl commented 3 months ago

icloud3 integration is not loading any more with 2024.3.0

File "/config/custom_components/icloud3/config_flow.py", line 1789, in async_step_restart_ha_ic3_load_error return await self.async_restart_ha_ic3(user_input, errors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/icloud3/config_flow.py", line 1813, in async_restart_ha_ic3 await Gb.hass.services.async_call("homeassistant", "restart") ^^^^^^^^^^^^^^^^

gcobb321 commented 3 months ago
  1. What version of iCloud3 are you running?
  2. What steps were you doing to cause the error?
  3. Did you refresh your browser screen?
  4. Was everything ok if you restarted iCloud3 from the Event Log > Actions > Restart iCloud3 ?
zuppl commented 3 months ago
  1. v3.0.rc10.4
  2. Restart Home Assistant / Restart from the integration no more working
  3. yes
  4. you can not restart from there - unknown error

Logger: homeassistant.bootstrap Source: /usr/src/homeassistant/homeassistant/bootstrap.py:655 First occurred: 06:53:53 (1 occurrences) Last logged: 06:53:53

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

icloud3 integration says not loaded. Re-configuration ends with "unknown error"

image

zuppl commented 3 months ago

Thats all from the log regarding icloud3:

2024-03-08 06:48:21.581 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration icloud3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-03-08 06:53:53.003 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration icloud3 - received exception 2024-03-08 06:54:02.787 WARNING (MainThread) [homeassistant.components.homekit] Cannot add sensor.icloud3_event_log as this would exceed the 150 device limit. Consider using the filter option 2024-03-08 06:54:02.787 WARNING (MainThread) [homeassistant.components.homekit] Cannot add sensor.icloud3_wazehist_track as this would exceed the 150 device limit. Consider using the filter option File "/config/custom_components/icloud3/config_flow.py", line 1789, in async_step_restart_ha_ic3_load_error File "/config/custom_components/icloud3/config_flow.py", line 1825, in async_restart_ha_ic3 File "/config/custom_components/icloud3/config_flow.py", line 928, in async_step_menu if self.PyiCloud is None and Gb.PyiCloud is not None: AttributeError: 'iCloud3_OptionsFlowHandler' object has no attribute 'PyiCloud' File "/config/custom_components/icloud3/config_flow.py", line 1789, in async_step_restart_ha_ic3_load_error File "/config/custom_components/icloud3/config_flow.py", line 1817, in async_restart_ha_ic3 File "/config/custom_components/icloud3/config_flow.py", line 1789, in async_step_restart_ha_ic3_load_error File "/config/custom_components/icloud3/config_flow.py", line 1817, in async_restart_ha_ic3

######################

This is after complete restart of HA:

2024-03-08 07:02:35.047 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration icloud3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-03-08 07:07:51.875 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration icloud3 - received exception 2024-03-08 07:07:57.152 WARNING (MainThread) [homeassistant.components.homekit] Cannot add sensor.icloud3_event_log as this would exceed the 150 device limit. Consider using the filter option 2024-03-08 07:07:57.152 WARNING (MainThread) [homeassistant.components.homekit] Cannot add sensor.icloud3_wazehist_track as this would exceed the 150 device limit. Consider using the filter option

gcobb321 commented 3 months ago

2024-03-08 07:07:51.875 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration icloud3 - received exception 2024-03-08 07:07:57.152 WARNING (MainThread) [homeassistant.components.homekit] Cannot add sensor.icloud3_event_log as this would exceed the 150 device limit. Consider using the filter option

This error seems to indicate icloud3 is tied to homekit and someone (HA, homekit-?) has a150 limit on the number of sensors. It looks like you have 4 devices with 77 sensor entities in iCloud3. Can you remove iCloud3 from homekit and restart HA.

I might need to look at the icloud3-0.log and home-assistant.log files if that does not work.

zuppl commented 3 months ago

I removed homekit but get the same error.

############################################### Logger: homeassistant.bootstrap Quelle: /usr/src/homeassistant/homeassistant/bootstrap.py:655 Erstmals aufgetreten: 21:31:36 (1 Vorkommnisse) Zuletzt protokolliert: 21:31:36 Error setting up integration icloud3 - received exception asyncio.exceptions.CancelledError ###############################################

The logs don't show anything.

The only line showing up in homeassistan.log is:

2024-03-08 21:31:36.905 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration icloud3 - received exception

(icloud3-0.log)

Timestamp of HA restart was 21:25

gcobb321 commented 3 months ago

Makes no sense. I have newer code (v3.0.1) I'll be releasing on the Development Repository in a few days and will send it to you. Probably tomorrow. Let's install that and see what happens.

gcobb321 commented 3 months ago

Here is v3.0.1.

Unzip it to the icloud3 directory and restart HA. icloud3_v3.0.1.zip

zuppl commented 3 months ago

Thanks for the update. I updated to the new version but it won't start with 2023.3.0. Starts fine with 2024.2.5

#######

Logger: homeassistant.bootstrap
Quelle: /usr/src/homeassistant/homeassistant/bootstrap.py:655
Erstmals aufgetreten: 21:45:01 (1 Vorkommnisse)
Zuletzt protokolliert: 21:45:01

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

########

I don't see any entries in the icloud3-0.log (which is the latest). Only the HA shutdown from the upgrade to 2023.3.0 is logged there (and previous entries before migrating to the new HA version). It seems that icloud3 does not get any startup process and thus no log is written.

I can see 2 entries in home-assistant.log - nothing else is been logged:

  File "/config/custom_components/icloud3/config_flow.py", line 1796, in async_step_restart_ha_ic3_load_error
    return await self.async_restart_ha_ic3(user_input, errors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/icloud3/config_flow.py", line 1824, in async_restart_ha_ic3
    await Gb.hass.services.async_call(

Maybe this helps.

BR, Alex

gcobb321 commented 3 months ago

All the restart HA does is issue a homeassistant.restart service call. When that happens, you need to exit back to a Home Assistant dashboard screen and wait for it to restart. Then do what you want to do. It terminates that configuration instance. If you try to do anything without going back, it will fail. I can restart HA with that command but it is better the restart it using the HA commands on one of the system screens.

zuppl commented 3 months ago

I did the restart from the Settings -> System Screen, but icloud won't start up then. Or did I missundertand you?

image

gcobb321 commented 3 months ago

I was confused about what was causing the error since you were displaying it from the Integrations > Configure Settings screen.

  1. Check the iCloud3 configuration file at config/.storage/icloud3/configuration. One of the checks is for ‘version’ to be at the beginning of the file. Mine is:
{
    "profile": {
        "version": 1,
        "ic3_version": "3.0.1",
        "version_install_date": "Sat, Mar 9, 11:18:38a",
        "config_update_date": "Sat, Mar 9, 11:18:38a",
        "event_log_card_directory": "www/icloud3",
        "event_log_card_program": "icloud3-event-log-card.js",
        "event_log_btnconfig_url": "",
        "event_log_version": "3.0.17",
        "picture_www_dirs": [
            "www/images"
        ]
    },
    "data": {
        "tracking": {
            "username": "xxxxxxxxx@gmail.com",
            "password": "««R2NpdDMyMTc=»»",
            "encode_password": true,
            "icloud_server_endpoint_suffix": "None",
            "setup_icloud_session_early": true,
            "data_source": "famshr,mobapp",

…and continues with devices, general parameters and sensors
  1. Does your file have the ‘version’ statement at the top in it? Does it look the same as mine?
  2. You said you do not have the icloud3-0.log file from after 2024.3.0. Is that correct?
  3. Rename the _configuration_file to something else to save it so iCloud3 will create a new one that is empty on a restart. Then restart HA to see if it creates one.
  4. Did iCloud3 start and does the Event Log show anything? Errors? Is there a log file?
gcobb321 commented 3 months ago

I made another change to v3.0.1.

When you select Enable debug logging on the Devices & Settings > Integrations > iCloud3, all iCloud3 messages will be logged to the iCloud3-0.log AND the home-assistant.log file. Enable debug logging and restart HA to do this.

Then email the icloud3-0.log file if it exists and the home-assistant.log file to geekstergary@gmail.com. You can also zip the files and attached them to this issue. Send me the complete file instead of just posting a small snippet. I want to see what else is going on that might be causing the issue.

I have been running 2024.03.0 since it was released. I'm running on a Raspberry Pi with HA Core & Supervisor v2024.03.0 without any issues.

Unzip to the icloud3 directory, go to Devices & Settings and Enable debug logging for iCloud3 and restart HA. icloud3_v3.0.1b2.zip

zuppl commented 3 months ago

Thank you for your new version. I tried to replace the files in icloud3 directory under custom_integrations - without succes. Then I uninstalled the icloud3 integration, removed the folder from custom_integration and copied your b2-version again to a newly created icloud3 folder and restarted HA. But the integration did not show up at all. Then I re-installed the integration from the integration menu of home assistant and restarted again. Boom - now the integration gets loaded and seem to work under 2023.3.0

The configuration looks like that:

{ "profile": { "version": 1, "ic3_version": "3.0.1b2", "version_install_date": "0000-00-00 00:00:00", "config_update_date": "0000-00-00 00:00:00", "event_log_card_directory": "www/icloud3", "event_log_card_program": "icloud3-event-log-card.js", "event_log_btnconfig_url": "", "event_log_version_running": "", "event_log_version": "3.0.17", "picture_www_dirs": [] },

There is no logging to the icloud3-0.log at all.

image

The homeassistant log shows this:

image

Let me know if you need further information or the logs. Would like to help you in analysing.

Conclusion: it seems that the re-installation helped to fix the issue. Maybe this is only related to my installation.

Thank you very much for your great work on this integration. I really love it and it makes my dashboard to a real highlight!

gcobb321 commented 3 months ago

I made some additional changes after seeing the log file. Some things were missing from the log and there is an error displayed. I'm not sure why you have the pyicloud error but v3.0.1b3 may help. I deleted my configuration file and created a new one and did not get an error. I also fixed the icloud3-0.log not being available, hopefully.

Unzip the v3.0.1b3 into the icloud3 directory and restart HA. If you get this error again and icloud3-0.log file is still not available, Enable debug logging on the Devices & Settings > iCloud3 Integration screen and restart HA. Then send me the home-assistant.log file. It will show more than just the error that occurred.

Gary icloud3_v3.0.1b3.zip

gcobb321 commented 3 months ago

Here is the latest v3.0.1b4

Unzip into the icloud3 directory and restart HA. icloud3_v3.0.1b4.zip

Change Log : v3.0.1 - 3/15/2024

  1. UPDATE SENSOR & DEVICE TRACKER ENTITIES (Improvement) - Changed the method of updating these items at the request of @balloob (Paulus Schousten, HA Founder) to prevent a potential Home Assistant lockup when doing an update.
  2. LOG FILE (Improvement) - Changed the method of updating the iCloud3 log files. Also changed some of the record formatting to improve readability.
  3. WAZE & CALC DISTANCE SENSORS (Fixed) - They were not being created.
  4. UPDATE DEVICES CONFIGURE SCREEN (Fixed) - The Picture parameter was listing every image file in the all of the www/ sub-directories. A filter was added to limit the search to specific directories. The filter is defined on the Tracking and Other Parameters screen. Only the first 25 image files in a directory will be displayed to prevent overloading the HA dropdown list handler.
  5. FIXED INTERVAL (Improvement) - The lowest interval was reduced from 5-minutes to 3-minutes.
  6. DIRECTION OF TRAVEL (Improvement) - Changed the way this is being updated. If the distance from Home is more than 400m/250mi, it will be set to FarAway.
  7. STATIONARY ZONE (Fixed) - The second device to enter an existing Stationary Zone was not saving the Stationary Zone info correctly.