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
168 stars 13 forks source link

iCloud3 v3, Beta 18 has been uploaded (6/17/2023) #152

Closed gcobb321 closed 1 year ago

gcobb321 commented 1 year ago

@biggeeus @confusedsecuritydudes @chupacabra71 @chr04213 @criticallimit @daneboom @denac @derekoharrow @diothar @DerDon1302 @Exit2Studios @freshairr @gekberlin @garyak @freekode @FredWst @filikun @hvddrift @hellotomtom @ihf1 @JtwoA @HA_n00b @J-Fartz @joselito1 @japyjaap @kalkocz @kamkilt @kingy444 @lukkigi @marceloaf @MarkGardiner @marting @mobiledude @myMartek @morrisonpeter @Nuuki9 @pauly7300 @poudenes @polskikrol @rdstodda @Snuffy2 @spamsal @Seger85 @scotty1395 @sj3fk3 @stevekuchta @townsmcp @tm24fan8 @t077584 @u20p17 @umrath

And sorry if I missed you,

Update Notes

There are several important items in this release:

  1. If only the iOS App is being used to track devices (iCloud is not being used), a location request is now sent to the iOS App in the same manner as it is to the iCloud Location Service whenever an update is needed. It does not do this if you are using the iCloud Location Service
  2. Various iCloud3 sensors are once again excluded from being added to the HA History database. The HA guys rewrote the recorder component, requiring a rewrite to the hack used to tie into the recorder component. The excluded sensors include icloud3_event_log, icloud3_wazehist_track, [devicename]_info and several others.
  3. The iCloud3 Debug Log (icloud3_debug.log file) now contains all records that were written to the home-assistant.log file. Since it now contains all operational entries in addition to the debug records, it has been renamed to icloud-0.log. Three days of entries are kept in 3-files; '-0.log' is for today, '-1.log' is for yesterday and '-2.log' is 2-days ago.
  4. When iCloud3 starts, the iCloud devices are verified using data from iCloud Location Services. If the service is slow to respond or a device is missing or was not located, it was not verified or tracked and an error message was displayed requesting you to restart iCloud3. Now, multiple types of retries are done to try to verify the devices being tracked. If it still fails, the restart message is still displayed. This occurred mainly with an Apple Watch that was asleep but would occur with other devices as well.

The full list with more details is below.

Important Links

Download and Install - Go to the iCloud3 Releases page here. Scroll down past the notes, then select Assets, then select icloud3-beta-##.zip. Download the zip file and unzip it into the /config/custom_components/icloud3 directory. Then restart HA. Installing using HACS - iCloud3 is not available on HACS unless you have set it up as a custom repository. See here for instructions on how to do that and then install it. If you just go to HACS and do the installation, you will be installing v2.4.7, not v3. Migrating from v2.4._ - See here for instructions on migrating from from an older version. iCloud3 v3 Documentation - It is still in process, does not include the latest updates to iCloud3 and can be found here Change Logs - See the notes below:

Change Log, Beta 18c - 6/17/2023

  1. iOS App Only - Location requests will be sent to the device when the iOS App is the primary data source just like it is to the iCloud Web Service. This only sends a request to the iOS App. If the device is asleep or the iOS App is running in the background or not loaded, it will not respond and send the location. In this case, another location request will be sent when the next update time is reached.
  2. History Recorder - Fixed the problem leading to the '_exclude_e' not being found error while adding iCloud3 HA Recorders sensors to the exclude_entities list. The original problem was caused by the HA guys rewriting the H recorder component and removing the ability to hack into the list of entities that should not be added to the history database. This will exclude the icloud3_event_log, icloud3_wazehist_track, [devicename]_info and several other sensor entities from being added to the history database.
  3. icloud3_debug_log file - Since this file now contains everything that was previously added to the home-assistant.log file, it's name was changed to 'icloud3-0.log' . Three generations of the log file will be kept, indicated by the suffix ('-0'=Today, '-1'=Yesterday, '-2'=Two days ago). The file will be daily renaming will take place at midnight.
  4. Device Verification during startup - When starting up, device data/location information is used to verify the device. If the iCloud Location Service does not respond with location data for one or more devices during startup, the verification process would display error messages and require you to restart iCloud3 to begin tracking the unverified devices. This mainly occurred with the Apple Watch. Now the verification is automatically retried several times. If it still fails for one or more devices after multiple tries, a restart is needed message is displayed to try again later. The verified devices will continue to be tracked.
  5. Configuration Wizard - Change the range of the inzone interval parameter values from 5-240 minutes to 1-300 minutes.
  6. StatZone - The Stationary Zone will not be created when the current location data is old.
  7. Event Log - Fixed a problem where displaying a Nearby Devices message would display the text below the Event Log items window due to a HA Front End change.
kingy444 commented 1 year ago

@gcobb321 the HACS method doesn't seem to be broadcasting updates

With beta 17 I thought maybe I had installed wrong, so I removed everything and started from scratch.

With the release of Beta18 I still haven't received an update is available from HACS. Definitely have the right version installed image

gcobb321 commented 1 year ago

@kingy444 I originally uploaded the release as icloud3_v3-beta-18c.zip. The HACS config file has a reference to icloud3.zip. I have changed the file name. Try again and let me know if that worked.

SimoHDK commented 1 year ago

Hi Gary,

Testing this version and all working well - I have a suggestion for a specific scenario.

We use your tool to track vehicle iPads for a volunter emergency services fleet. This in-turn gives us vehicle tracking (Awesome!). As a result, our iPads are always plugged into charge, as they are used for mapping etc in the vehicle.

What I would love to see is the option to essentially overwrite the polling/update times with the shortest possible (which I think is 15 seconds?) as I need to actively see where the fleet is, and data/battery penalties dont't eixist for this situation.

In v2.4 I hacked my way towards this by altering the core files, but a clean option would be much preferable.

kingy444 commented 1 year ago

@kingy444

I originally uploaded the release as icloud3_v3-beta-18c.zip. The HACS config file has a reference to icloud3.zip. I have changed the file name. Try again and let me know if that worked.

Didn't pick it up after a couple hours, but doing a redownload from the hacs menu let me choose beta18-c

Perhaps that's a local caching of the HACS manifest ? Hopefully works next time 😎

kingy444 commented 1 year ago

What I would love to see is the option to essentially overwrite the polling/update times with the shortest possible (which I think is 15 seconds?) as I need to actively see where the fleet is, and data/battery penalties dont't eixist for this situation.

Obviously Gary has the say here, just my opinion. I personally think that putting that in the UI could result in people complaining their devices are draining. Even with a warning, people don't read.

I would suspect you could possible achieve the same by adding something like the below to your configuration.yaml (not exactly as I don't recall the exact name etc) Note I completely made up the polling interval as I don't know what it's called, but I know you can override internal HA integrations with this customise code format

Again, hoping Gary knows what those equivalent values may be

customize:
  entity_name:
    should_poll: $true
    Polling_interval: 15
gcobb321 commented 1 year ago

@SimoHDK One of the options of the iCloud3 Actions Service Call does exactly what you want. It lets you issue a locate request for all devices or a selected device right now, in 30-secs, 1-min or are any other interval you want. Use it in an HA Automation that fires every minute up and you should be good. I think 15-secs would probably be too short and Apple wouldn’t wouldn’t be able to keep up, leading to a lot of old location retries. But try it abcs see what happens.

See here in the iCloud3 docs for more info and some examples

SimoHDK commented 1 year ago

@SimoHDK One of the options of the iCloud3 Actions Service Call does exactly what you want. It lets you issue a locate request for all devices or a selected device right now, in 30-secs, 1-min or are any other interval you want. Use it in an HA Automation that fires every minute up and you should be good. I think 15-secs would probably be too short and Apple wouldn’t wouldn’t be able to keep up, leading to a lot of old location retries. But try it abcs see what happens.

This works perfectly! I ended up setting up as follows, opting for 20-secs which seems to work just fine.

alias: iCloud 20-Sec description: "" trigger:

zimmra commented 1 year ago

18d seems to have some regressions. Probably not affected if you already went through the config_flow, but for those who haven't and are just trying for the first time it currently does not work.

See 8e62af9159ca953aa7275a658ccf14b008f654d7 for specifics, looks like set_icloud_username_password and some other potentially unintended changes made their way in there

gcobb321 commented 1 year ago

@zimmra What problems are you having? The removal of the FmF data source, if that is what you are referring to, we’re intentional since it has been removed by Apple. I had not done a fresh install after the update and will check it out to make sure.

zimmra commented 1 year ago

@zimmra

What problems are you having? The removal of the FmF data source, if that is what you are referring to, we’re intentional since it has been removed by Apple. I had not done a fresh install after the update and will check it out to make sure.

Take a look in the commit I linked above

It reintroduces start_ic3.set_username_password which no longer exists in start_ic3.py

When trying to add the integration for the first time, it throws the error below (copy/pasted from another issue, hence the older dates, but the error thrown is identical)

2023-06-15 21:33:03.880 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 149, in post
    return await super().post(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 845, in async_init
    flow, result = await task
                   ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 873, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/icloud3/config_flow.py", line 495, in async_step_user
    start_ic3.set_icloud_username_password()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'custom_components.icloud3.support.start_ic3' has no attribute 'set_icloud_username_password'