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

rc7.1 KeyError on HA Boot #219

Closed Snuffy2 closed 9 months ago

Snuffy2 commented 1 year ago

I'll report back if it is affecting icloud3 updating/locations.

2023-10-18 20:45:01.944 ERROR (SyncWorker_8) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'not_home'
JtwoA commented 1 year ago

Seeing the same. Doesn't appear to be preventing location reporting at the moment.

Snuffy2 commented 1 year ago

It is preventing an ic3 tracker from updating when leaving a zone. My wife just went to run an errand and it remained at Home until she got to her destination which is also a HA Zone.

2023-10-18 21:31:50.422 ERROR (SyncWorker_34) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'town_library'
2023-10-18 21:33:12.915 ERROR (SyncWorker_13) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'not_home'
2023-10-18 21:36:50.653 ERROR (SyncWorker_16) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'not_home'

icloud3-0.log

gcobb321 commented 1 year ago

You are runningv3.0.rc7, not v3.0.rc7.1.

The first line of the log file at 7:40 (and again at 8:43) when iCloud3 started is: Setting up iCloud3 v3.0.rc7 - Using Integration method.

The version running also shows in the Event Log, in the device_tracker.[devicename] attributes. I just checked the _icloud3main.py on the _v3 repo and the ‘releases’ zip file and it looks ok.

woopstar commented 1 year ago

I also see the above error on rc7.1:

2023-10-19 12:06:30.582 ERROR (SyncWorker_24) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'home'
2023-10-19 12:08:50.644 ERROR (SyncWorker_38) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'home'
2023-10-19 12:14:50.570 ERROR (SyncWorker_32) [icloud3] Traceback (most recent call last):
  File "/config/custom_components/icloud3/icloud3_main.py", line 986, in _determine_interval_and_next_update
    self._update_current_zone(Device)
  File "/config/custom_components/icloud3/icloud3_main.py", line 1098, in _update_current_zone
    del zones_cnt_by_zone[zone_selected]
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'not_home'

And to confirm the version:

image
gcobb321 commented 1 year ago

@woopstar The version in the above image belongs to HACS, not iCloud3. HACS keeps it in it's own database to identify new releases. The version from the HACS database is displayed, not the iCloud3 version running. The only way to really know is to view the version number in iCloud3 itself.

I have added an item in the iCloud3 FAQ regarding this here. It has screenshots of where the version number is.

You are running code from rc7 that was removed in rc7.1.

JtwoA commented 1 year ago

I am seeing similarly [image.png]

gcobb321 commented 1 year ago

@JtwoA I just posted a note about that and explained that you can NOT depend on that HACS version to know what version of iCloud3 you are actually running. You have to look at iCloud3. See the link in that note to see the places the version number is displayed.

If you are getting that error message, you are running rc7, not rc7.1.

woopstar commented 1 year ago

@gcobb321 You are absolutely right. I am on rc7 and not 7.1 Redownload from HACS continues to grab 7.0

Is there something wrong with the github release?

woopstar commented 1 year ago
image

Looks like it points to the wrong commit:

image

This is why people keep getting the wrong version downloaded.

woopstar commented 1 year ago

7937788 is rc7 7e8b2a4 is rc7.1

The v3.0.rc7.1 points to 7937788

gcobb321 commented 1 year ago

I’ll dig into that when I get home. Makes no sense to me.

gcobb321 commented 1 year ago

I have just created a new release (v3.0.rc71.1) that has a different commit number than the original v3.0.rc7. I looked at the older releases and the same problem occurred where the v3.0.rc6 release had the same commit number as v3.0.pr1.5.

I did not change the version number within iCloud3. It is still v3.0 rc7.1.

Thanks for identifying the root cause. I will check that going forward.

woopstar commented 1 year ago

I can confirm the release now points to the right git commit :) Good work and sorry for the comment spam lately ;)

gcobb321 commented 1 year ago

Not a problem. I need to get an understanding of what caused GitHub to point to the older one. Fortunately this occurred before and those 2 releases are still there. I don’t have any real experience dealing with Git and just slog along.

Any ideas @Snuffy2?

Snuffy2 commented 1 year ago

I have never seen that before. Very weird. Is there anything in your deployment workflow/scripts that could be doing something weird when creating a release?

gcobb321 commented 1 year ago

I have HACS Actions (which always passes), hassfest (which always fails on dependencies) and pages_build for the docs. The hassfest fails with an error DEPENDENCIES] Using component mobile_app but it's not in 'dependencies' or 'after_dependencies.

iCloud3 isn’t dependent on the mobile app and putting it after the app has caused problems. I also do not have the device tracker component in ’ after dependencies’ . It was there for a while but there were some issues where the device tracker component was not loading which caused iCloud3 to not load. That happened to a user and removing device tracker from manifest.json solved that problem.

I’m thinking about removing hassfest from the workflow. I added it to try to be HA compliant. It was not used on v2 and, being a custom component, might be getting in the way.

gcobb321 commented 1 year ago

@broyken HACS probably hasn't picked up rc7.1.1 (which is really rc7.1). Mine is now pointing to rc7.1.1.

I assume you went to HACS > Integrations > Search for iCloud3 v3> Got the Development Version > Update Info. You can always go to the Release here, download icloud3.zipo and unzip it into the config/icloud3 directory instead of waiting for HACS

broyuken commented 1 year ago

Couple more refreshes and it got the new version

gcobb321 commented 11 months ago

Here is the latest version of rc9 before I release it next week for you to try.

The final changes won't affect you but I wanted to make sure I didn't break anything. One critical change is to the method of determining the time an iOS App trigger takes place and how time zones are handled. Check the Event Log to see if a Trigger or zone change time does not seem to match the event time.

Unzip rc9 and restart as always.

icloud3_v3-rc9.zip

gcobb321 commented 9 months ago

Closing this issue with the release of v3.0