Skip to content

Commit

Permalink
iCloud3 v3.0.0 Beta 4
Browse files Browse the repository at this point in the history
  • Loading branch information
gcobb321 committed Dec 27, 2022
1 parent 6e51f3b commit 9aa4249
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 259 deletions.
Binary file modified beta_archive/icloud3-beta-3.zip
Binary file not shown.
80 changes: 56 additions & 24 deletions custom_components/icloud3/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
Beta 2 - 12/17/2022
Beta 4 - 12/17/2022
-------------------
1. Do not display an error messgage when trying to get the model of a device if t is
not in the HA device registry. (entity_io:137)
2. Fix a problem checking if info for all of configured devices that had been set
up had been returned from iCloud account during startup. If not, the FmF devices
were being refreshed when it should be refreshing the FamShr devices. (start_ic3:1315)
3. Fixed an error copying the Event Log image sample files to the custom cards directory.
It was copyingthe files from 'event_log' instead of 'event_log_card'. (start_ic3:722)
4. Added 'Erase All Devices' to the Configuration > Action menu that will reinitialize the
iCloud3 Devices List.
5. The Time Format (12/24-hour) was converted incorrectly. It was creating '12/24-hour-hour'
This has been fixed and the invalid parameter in the configuration file was corrrected.
6. Fixed a problem where a check was being made to see if 2fa authentication was needed when
the connection to the iCloud Location Services had not been completed, causing a problem
with the parameter migration (icloud_main:732).
7. Reformatted the items written to the icloud3_migration.log file for clarity.
8. Fixed a problem shrinking the Event Log (event_log:538 recursion error).
9. Fixed a problem when Family Sharing info from iCloud Location Services had not completely
loaded during initialization and was generating an error during the retry operation (start_ic3:1113).
10. Fixed a problem, hopefully, that was generating the HA Blocking error when starting up the iCloud
Location Services interface. This was also occurring (sometimes) when logging into a new the iCloud
account from the Configurator.
1. Inactive/Untracked devices are listed at the end of the Startup Event Log messages.
2. Fixed some problems displaying the EVent Log when there were no devices to track.
3. Fixed problem dealing with Gb.ic3_debug_log_write_secs variable not found.
4. Fixed problem where the Event Log records were not displayed in a timely manner when starting.
5. The tracking results written to the Log file now include the zone, distance and time values.
6. Reworked the icloud3-debug.log file:
- A new file is created when:
- HA/iCloud3 starts and the Log Level is debug or rawdata or
- Starting Debug Logging from Event Log > Actions or
- At midnight when debug logging is on and the file is more thn 20-hours old.
- Otherwise debug records are added to the existing Debug Log file.
- If the Log Level is debug or rawdata in the Configurator > Event Log parameters and
Stop Debug Logging was selected on Event Log > Actions, the configuration will be changed
to 'info' (no debug logging).
- If the configuration is set to 'info' (no debug logging) and it is started on Event Log > Actions,
the configuration is not updated and the debug logging will remain on until midnight, the next
iCloud3 restart or when it is turned off.


QUESTION: Currently the Exported Event Log file contains the date/time indicating when it was created.
This creates a new file for every export.
Example: 'icloud3-event-log_2022-12-26 18:00:00.log'
Another option is to not have the date/time in the file name so a new Export overrites the last one.
Example: 'icloud3-event-log.log'

Does anyone have an opinion on this.

Beta 3 - 12/21/2022

------------------------------------------------------------------------------------------------
Beta 3 - 12/24/2022
-------------------
1. Fixed a problem where the Configurator > Sensors would generate an 'Unknown Error Ocurred'
error message. This was caused by an invalid sensor field name ('tracking_from_zones')
Expand All @@ -44,11 +51,36 @@ Beta 3 - 12/21/2022
will reduce the steps needed to change the Log Level parameter when debug/rawdata logging
is desired. ---> YOU MAY NEED TO REFRESH YOUR BROWSER WITH THE CONFIGURATOR OPEN <---
8. Fixed problem changing the devices Friendly Name that would generate an error message deleting
tracking_from_zone sensors when they had not been created.
tracking_from_zone sensors when they had not been created.
9. The device_tracker state value is now lower-case.
10. Log level debug and rawdata records are now written to the '/config/icloud3_debug.log' file
instead of the HA log file. A new file is created every time HA starts.
11. The file extension for the Event Log file was changed from '.txt' to '.log'. The file name is now
'icloud3-event-log_[time].log'.
12. Fixed problem displaying the Event Log when no devices had been configured.


------------------------------------------------------------------------------------------------
Beta 2 - 12/17/2022
-------------------
1. Do not display an error messgage when trying to get the model of a device if t is
not in the HA device registry. (entity_io:137)
2. Fix a problem checking if info for all of configured devices that had been set
up had been returned from iCloud account during startup. If not, the FmF devices
were being refreshed when it should be refreshing the FamShr devices. (start_ic3:1315)
3. Fixed an error copying the Event Log image sample files to the custom cards directory.
It was copyingthe files from 'event_log' instead of 'event_log_card'. (start_ic3:722)
4. Added 'Erase All Devices' to the Configuration > Action menu that will reinitialize the
iCloud3 Devices List.
5. The Time Format (12/24-hour) was converted incorrectly. It was creating '12/24-hour-hour'
This has been fixed and the invalid parameter in the configuration file was corrrected.
6. Fixed a problem where a check was being made to see if 2fa authentication was needed when
the connection to the iCloud Location Services had not been completed, causing a problem
with the parameter migration (icloud_main:732).
7. Reformatted the items written to the icloud3_migration.log file for clarity.
8. Fixed a problem shrinking the Event Log (event_log:538 recursion error).
9. Fixed a problem when Family Sharing info from iCloud Location Services had not completely
loaded during initialization and was generating an error during the retry operation (start_ic3:1113).
10. Fixed a problem, hopefully, that was generating the HA Blocking error when starting up the iCloud
Location Services interface. This was also occurring (sometimes) when logging into a new the iCloud
account from the Configurator.
7 changes: 6 additions & 1 deletion custom_components/icloud3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

from .global_variables import GlobalVariables as Gb
from .helpers.common import (instr, )
from .helpers.messaging import (_traceha, log_info_msg, log_debug_msg, log_warning_msg, log_error_msg, log_exception)
from .helpers.messaging import (_traceha, open_ic3_debug_log_file,
log_info_msg, log_debug_msg, log_error_msg, log_exception)
from .support.v2v3_config_migration import iCloud3_v2v3ConfigMigration
from .support import start_ic3
from .support import config_file
Expand Down Expand Up @@ -116,7 +117,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
start_ic3.initialize_directory_filenames()
config_file.load_storage_icloud3_configuration_file()
start_ic3.set_icloud_username_password()

start_ic3.set_log_level(Gb.log_level)
if Gb.log_debug_flag:
open_ic3_debug_log_file(new_debug_log=True)

restore_state.load_storage_icloud3_restore_state_file()
hass.config_entries.async_setup_platforms(entry, PLATFORMS)

Expand Down
6 changes: 3 additions & 3 deletions custom_components/icloud3/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@
DOT2 = '•'
HDOT = '◦ '
HDOT2 = '◦'
CRLF_DOT = f'{CRLF}{NBSP2}{NBSP2}'
CRLF_CHK = f'{CRLF}{NBSP2}{NBSP}'
CRLF_X = f'{CRLF}{NBSP}{NBSP}'
CRLF_DOT = f'{CRLF}{NBSP3}{NBSP2}'
CRLF_CHK = f'{CRLF}{NBSP3}{NBSP}'
CRLF_X = f'{CRLF}{NBSP2}{NBSP}'
CRLF_NBSP6_DOT = f'{CRLF}{NBSP3}{NBSP}'
CRLF_NBSP6_X = f'{CRLF}{NBSP3}{NBSP}'

Expand Down
10 changes: 3 additions & 7 deletions custom_components/icloud3/global_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,8 @@ class GlobalVariables(object):
Sensor_EventLog = None # Event Log sensor object
ha_device_id_by_devicename = {} # HA device_registry device_id

# PyiCloud_FamilySharing = None # PyiCloud_ic3 object for FamilySharig used to refresh the device's location
# PyiCloud_FindMyFriends = None # PyiCloud_ic3 object for FindMyFriends used to refresh the device's location
# PyiCloud_RawData_by_device_id = {} # Device data for tracked devices, updated in Pyicloud famshr.refresh_client
# PyiCloud_RawData_by_device_id_famshr = {}
# PyiCloud_RawData_by_device_id_fmf = {}

# System Wide variables control iCloud3 start/restart procedures
# entity_created_device_tracker = False
# entity_created_sensor = False
polling_5_sec_loop_running = False # Indicates the 5-sec polling loop is set up
start_icloud3_inprocess_flag = False
start_icloud3_request_flag = False
Expand All @@ -184,6 +177,9 @@ class GlobalVariables(object):
log_debug_flag_restart = None
log_rawdata_flag_restart = None
evlog_trk_monitors_flag = False
ic3_debug_log_file_last_write_secs = 0
ic3_debug_log_update_flag = False
ic3_debug_log_new_file_secs = 0
info_notification = ''
ha_notification = {}
trace_prefix = ''
Expand Down
18 changes: 17 additions & 1 deletion custom_components/icloud3/helpers/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


from ..global_variables import GlobalVariables as Gb
from ..const import (NOT_HOME, STATIONARY, CIRCLE_LETTERS_DARK, UNKNOWN, CRLF_DOT, )
from ..const import (NOT_HOME, STATIONARY, CIRCLE_LETTERS_DARK, UNKNOWN, CRLF_DOT, CRLF, )
from collections import OrderedDict

#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Expand All @@ -22,6 +22,22 @@ def combine_lists(parm_lists):

return new_list

#--------------------------------------------------------------------
def list_to_str(list_value, separator=None):
'''
Convert list values into a string
list_valt - list to be converted
separator - Strig valut that separates each item (default = ', ')
'''
separator_str = separator if separator else ', '
list_str = separator_str.join(list_value)

if separator.startswith(CRLF):
return f"{separator_str}{list_str}"
else:
return list_str

#--------------------------------------------------------------------
def instr(string, substring):
'''
Expand Down
Loading

0 comments on commit 9aa4249

Please sign in to comment.