Skip to content

Commit

Permalink
iCloud3 v3.0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gcobb321 committed May 25, 2024
1 parent 86c9764 commit e558f97
Show file tree
Hide file tree
Showing 18 changed files with 1,437 additions and 606 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

------

[![CurrentVersion](https://img.shields.io/badge/Current_Version-v3.0.4-blue.svg)](https://github.com/gcobb321/icloud3_v3) [![Type](https://img.shields.io/badge/Type-Custom_Component-orange.svg)](https://github.com/gcobb321/icloud3_v3) [![HACS](https://img.shields.io/badge/HACS-Standard_Repository-orange.svg)](https://github.com/gcobb321/icloud3_v3)
[![CurrentVersion](https://img.shields.io/badge/Current_Version-v3.0.5-blue.svg)](https://github.com/gcobb321/icloud3) [![Type](https://img.shields.io/badge/Type-Custom_Component-orange.svg)](https://github.com/gcobb321/icloud3) [![HACS](https://img.shields.io/badge/HACS-Standard_Repository-orange.svg)](https://github.com/gcobb321/icloud3)

[![ProjectStage](https://img.shields.io/badge/Project_Stage-General_Availability-forestgreen.svg)](https://github/gcobb321/icloud3_v3) [![Released](https://img.shields.io/badge/Released-May,_2024-forestgreen.svg)](https://github.com/gcobb321/icloud3_v3)
[![ProjectStage](https://img.shields.io/badge/Project_Stage-General_Availability-forestgreen.svg)](https://github/gcobb321/icloud3) [![Released](https://img.shields.io/badge/Released-May,_2024-forestgreen.svg)](https://github.com/gcobb321/icloud3)



Expand Down
20 changes: 17 additions & 3 deletions custom_components/icloud3/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
### Important Links:
- iCloud3 Documentation is [here](https://gcobb321.github.io/icloud3_v3_docs/#/chapters/0.1-introduction)
- The *Installing iCloud3* chapter describes migrating from iCloud3 v2 and installing iCloud3 for the first time
**Migrating from v2.4.7_** - See [here](https://gcobb321.github.io/icloud3_v3_docs/#/chapters/3.1-migrating-v2-to-v3) for instructions on migrating from from an older version.
**Installing for the first time_** - See [here](https://gcobb321.github.io/icloud3_v3_docs/#/chapters/3.2-installing-and-configuring) for instructions on installing as a New Installation
**iCloud3 v3 Documentation** - iCloud3 User Guide can be found [here](https://gcobb321.github.io/icloud3_v3_docs/#/)


3.0.5.1
.......................
### Change Log - v3.0.5.1 (5/25/2024)
1. MOBILE APP (Fix) - Fixed a problem where the device's Mobile App data source would be disabled (reset to NotUsed) if the HA Mobile App Integration was set up after the Mobile App's initial locate had been completed.
2. TRANSLATION FILE (new) - Added Chinese (Simplified) translation (@MagicStarTrace)

### Change Log - v3.0.5 (5/18/2024)
1. HACS UPUDATE ALERT (New) - The HACS Integration information will be check on a regular basis to see if a newer version of iCloud3 is available.
2. ICLOUD ACCOUNT AUTHENTICATION/FAMSHR DEVICES LIST (Fixed) - During startup ("Stage 4), the iCloud Account access is set up and the devices in the Family Sharing List is read. If a problem occurred, iCloud3 would retry this 10-times to see if the error was corrected. However, the FamShr data was not being reread and the old data was being used. The FamShr data is now reread correctly when trying to recover from this error.
3. UPDATE DEVICES SCREEN (Fixed) - When upgrading a device (iPhone, iPad, Watch) and both the old and new devices are still in the Family Sharing List, the new device was being set back to the old device the next time iCloud3 was started.
4. LOCKED ICLOUD ACCOUNT (New) - An error message is displayed in the HA logs and on the Event Log if the iCloud account is locked.
5. EVENT LOG (Fix) - An 'Unbound event_recd' error would display when the length of the the event text > 2000 characters (@ehendrix23).


v3.0.4
.......................
### Change Log - v3.0.4 (not released)
### Change Log - v3.0.4 (5/11/2024)
1. ADD DEVICE (Fixed) - An 'Out of Range' error message was encountered adding the first device.
2. DIRECTION OF TRAVEL (Improvement) - Tweaked the AwayFrom direction override when approaching Home after the previous directions were Towards.
3. Event Type DEPRECIATED EOORO MESSAGE (Fixed) - This was a warning about the removal of the EventType from HA next year. It has been removed.
Expand Down
10 changes: 5 additions & 5 deletions custom_components/icloud3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .const import (DOMAIN, PLATFORMS, ICLOUD3, MODE_PLATFORM, MODE_INTEGRATION, CONF_VERSION,
CONF_SETUP_ICLOUD_SESSION_EARLY, CONF_EVLOG_BTNCONFIG_URL,
SENSOR_EVENT_LOG_NAME, SENSOR_WAZEHIST_TRACK_NAME,
EVLOG_IC3_STARTING, VERSION, )
EVLOG_IC3_STARTING, VERSION, VERSION_BETA,)

CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)

Expand Down Expand Up @@ -75,7 +75,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
config_file.load_storage_icloud3_configuration_file()

if Gb.conf_profile[CONF_VERSION] == 1:
Gb.HALogger.warning(f"Starting iCloud3 v{VERSION} > "
Gb.HALogger.warning(f"Starting iCloud3 v{VERSION}{VERSION_BETA} > "
"Detected a `platform: icloud3` statement in the "
"configuration.yaml file. This is depreciated and "
"should be removed.")
Expand All @@ -102,7 +102,7 @@ async def start_icloud3(event=None):
log_msg =(f"iCloud3 v{Gb.version} Started")
log_info_msg(log_msg)
Gb.HALogger.info(f"Gb.HALogger-Setting up iCloud3 v{Gb.version}")
# Gb.HALogger.info(f"# Gb.HALogger-Setting up iCloud3 v{Gb.version}")

else:
log_msg =(f"iCloud3 v{Gb.version} - Failed to Start")
log_error_msg(log_msg)
Expand Down Expand Up @@ -151,8 +151,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await Gb.hass.async_add_executor_job(
open_ic3log_file_init)

Gb.HALogger.info(f"Setting up iCloud3 v{Gb.version}")
log_info_msg(f"Setting up iCloud3 v{VERSION}")
Gb.HALogger.info(f"Setting up iCloud3 v{Gb.version}{VERSION_BETA}")
log_info_msg(f"Setting up iCloud3 v{VERSION}{VERSION_BETA}")

if Gb.restart_ha_flag:
log_error_msg("iCloud3 > Waiting for HA restart to remove legacy \
Expand Down
96 changes: 48 additions & 48 deletions custom_components/icloud3/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def ensure_six_item_dict(dict_item):
'None': 'None - The Mobile App is not installed on this device',
}
LOG_ZONES_KEY_TEXT = {
'.fmf': f"{'-'*10} File Name Formats {'-'*10}",
# '.fmf': f"{'-'*10} File Name Formats {'-'*10}",
'name-zone': ' → [year]-[zone].csv',
'name-device': ' → [year]-[device].csv',
'name-device-zone': ' → [year]-[device]-[zone].csv',
Expand Down Expand Up @@ -955,6 +955,9 @@ async def async_step_menu(self, user_input=None, errors=None):
self.PyiCloud = Gb.PyiCloud
Gb.PyiCloudConfigFlow = self.PyiCloud

if self.PyiCloud is None and self.username:
self.header_msg = 'icloud_acct_not_logged_into'

self.step_id = f"menu_{self.menu_page_no}"
self.called_from_step_id_1 = self.called_from_step_id_2 =''
self.errors = {}
Expand Down Expand Up @@ -2272,8 +2275,6 @@ async def async_step_icloud_account(self, user_input=None, errors=None, called_f
self.actions_list_default = 'login_icloud_account'
self.errors[CONF_USERNAME] = 'icloud_acct_username_password_error'



elif action_item == 'logout_icloud_account':
user_input = self._initialize_pyicloud_username_password(user_input)

Expand Down Expand Up @@ -2505,7 +2506,7 @@ async def _log_into_icloud_account(self, user_input, called_from_step_id=None, r
self.username,
self.password,
self.endpoint_suffix,
'config_flow',
'config',
verify_password,
request_verification_code)

Expand Down Expand Up @@ -2949,7 +2950,6 @@ async def async_step_update_device(self, user_input=None, errors=None):
f"{self.conf_device_selected[CONF_FNAME]}/"
f"{DEVICE_TYPE_FNAME[self.conf_device_selected[CONF_DEVICE_TYPE]]}")
post_event(event_msg)

Gb.conf_devices[self.conf_device_selected_idx] = self.conf_device_selected

config_file.write_storage_icloud3_configuration_file()
Expand Down Expand Up @@ -3099,21 +3099,19 @@ def _validate_update_device(self, user_input):
and self.devicename_by_famshr_fmf[user_input[CONF_FAMSHR_DEVICENAME]] not in ui_old_devicename):
self.errors[CONF_FAMSHR_DEVICENAME] = 'already_assigned'

if (user_input[CONF_FMF_EMAIL] in self.devicename_by_famshr_fmf
and self.devicename_by_famshr_fmf[user_input[CONF_FMF_EMAIL]] not in ui_old_devicename):
self.errors[CONF_FMF_EMAIL] = 'already_assigned'
# if (user_input[CONF_FMF_EMAIL] in self.devicename_by_famshr_fmf
# and self.devicename_by_famshr_fmf[user_input[CONF_FMF_EMAIL]] not in ui_old_devicename):
# self.errors[CONF_FMF_EMAIL] = 'already_assigned'

if self.PyiCloud:
_FamShr = self.PyiCloud.FamilySharing
conf_famshr_fname = user_input[CONF_FAMSHR_DEVICENAME]
if conf_famshr_fname in _FamShr.device_model_info_by_fname:
raw_model, model, model_display_name = _FamShr.device_model_info_by_fname[conf_famshr_fname]
if (user_input.get(CONF_RAW_MODEL) != raw_model
or user_input[CONF_MODEL] != model
or user_input[CONF_MODEL_DISPLAY_NAME] != model_display_name):
user_input[CONF_RAW_MODEL] = raw_model
user_input[CONF_MODEL] = model
user_input[CONF_MODEL_DISPLAY_NAME] = model_display_name
device_id = self.PyiCloud.device_id_by_famshr_fname.get(conf_famshr_fname, '')
raw_model, model, model_display_name = self.PyiCloud.device_model_info_by_fname.get(conf_famshr_fname, ['', '', ''])
user_input[CONF_FAMSHR_DEVICE_ID] = device_id
user_input[CONF_RAW_MODEL] = raw_model
user_input[CONF_MODEL] = model
user_input[CONF_MODEL_DISPLAY_NAME] = model_display_name

# Build 'log_zones' list
if ('none' in user_input[CONF_LOG_ZONES]
Expand Down Expand Up @@ -3251,7 +3249,7 @@ async def _build_update_device_selection_lists(self):
self._build_zone_list()

await self._build_famshr_devices_list()
self._build_fmf_devices_list()
# self._build_fmf_devices_list()
self._build_devicename_by_famshr_fmf()

#----------------------------------------------------------------------
Expand All @@ -3278,7 +3276,7 @@ async def _build_famshr_devices_list(self):
if _FamShr := self.PyiCloud.FamilySharing:
self._check_finish_v2v3conversion_for_famshr_fname()

sorted_famshr_info_by_famshr_fname = sort_dict_by_values(_FamShr.device_info_by_famshr_fname)
sorted_famshr_info_by_famshr_fname = sort_dict_by_values(self.PyiCloud.device_info_by_famshr_fname)
self.famshr_list_text_by_fname_base.update(sorted_famshr_info_by_famshr_fname)
self.famshr_list_text_by_fname = self.famshr_list_text_by_fname_base.copy()

Expand All @@ -3304,7 +3302,7 @@ def _check_finish_v2v3conversion_for_famshr_fname(self):

# Build a dictionary of the FamShr fnames to compare to the ic3_devicename {gary_iphone: Gary-iPhone}
famshr_fname_by_ic3_devicename = {slugify(fname).strip(): fname
for fname in _FamShr.device_model_info_by_fname.keys()}
for fname in self.PyiCloud.device_model_info_by_fname.keys()}

# Cycle thru conf_devices and see if there are any ic3_devicename = famshr_fname entries.
# If so, they were just converted and the real famshr_devicename needs to be reset to the actual
Expand All @@ -3322,12 +3320,13 @@ def _check_finish_v2v3conversion_for_famshr_fname(self):
conf_device[CONF_FAMSHR_DEVICENAME] = famshr_fname

raw_model, model, model_display_name = \
_FamShr.device_model_info_by_fname[famshr_fname]
self.PyiCloud.device_model_info_by_fname[famshr_fname]
device_id = Gb.device_id_by_famshr_fname[famshr_fname]

conf_device[CONF_FAMSHR_DEVICE_ID] = device_id
conf_device[CONF_MODEL] = model
conf_device[CONF_MODEL_DISPLAY_NAME] = model_display_name
conf_device[CONF_RAW_MODEL] = raw_model
conf_device[CONF_FAMSHR_DEVICE_ID] = _FamShr.device_id_by_famshr_fname[famshr_fname]
update_conf_file_flag = True

if update_conf_file_flag:
Expand Down Expand Up @@ -3371,27 +3370,27 @@ def _build_devicename_by_famshr_fmf(self, current_devicename=None):
self.famshr_list_text_by_fname = self.famshr_list_text_by_fname_base.copy()
for famshr_devicename, famshr_text in self.famshr_list_text_by_fname_base.items():
devicename_msg = ''
devicename_msg_prefix = ''
devicename_msg_alert = ''
try:
if current_devicename != self.devicename_by_famshr_fmf[famshr_devicename]:
devicename_msg_prefix = f"{YELLOW_ALERT} "
devicename_msg_alert = f"{YELLOW_ALERT} "
devicename_msg = ( f"{RARROW}ASSIGNED TO-"
f"{self.devicename_by_famshr_fmf[famshr_devicename]}")
except:
pass
self.famshr_list_text_by_fname[famshr_devicename] = \
f"{devicename_msg_prefix}{famshr_text}{devicename_msg}"

self.fmf_list_text_by_email = self.fmf_list_text_by_email_base.copy()
for fmf_email, fmf_text in self.fmf_list_text_by_email_base.items():
devicename_msg = ''
try:
if current_devicename != self.devicename_by_famshr_fmf[fmf_email]:
devicename_msg = ( f"{RARROW}ASSIGNED TO-"
f"{self.devicename_by_famshr_fmf[fmf_email]}")
except:
pass
self.fmf_list_text_by_email[fmf_email] = f"{fmf_text}{devicename_msg}"
f"{devicename_msg_alert}{famshr_text}{devicename_msg}"

# self.fmf_list_text_by_email = self.fmf_list_text_by_email_base.copy()
# for fmf_email, fmf_text in self.fmf_list_text_by_email_base.items():
# devicename_msg = ''
# try:
# if current_devicename != self.devicename_by_famshr_fmf[fmf_email]:
# devicename_msg = ( f"{RARROW}ASSIGNED TO-"
# f"{self.devicename_by_famshr_fmf[fmf_email]}")
# except:
# pass
# self.fmf_list_text_by_email[fmf_email] = f"{fmf_text}{devicename_msg}"

#----------------------------------------------------------------------
def _build_mobapp_entity_list(self):
Expand Down Expand Up @@ -3490,8 +3489,8 @@ def _format_device_list_item(self, conf_device_data):
if conf_device_data[CONF_FAMSHR_DEVICENAME] != 'None':
device_info += f", FamShr-({conf_device_data[CONF_FAMSHR_DEVICENAME]})"

if conf_device_data[CONF_FMF_EMAIL] != 'None':
device_info += f", FmF-({conf_device_data[CONF_FMF_EMAIL]})"
# if conf_device_data[CONF_FMF_EMAIL] != 'None':
# device_info += f", FmF-({conf_device_data[CONF_FMF_EMAIL]})"

if conf_device_data[CONF_MOBILE_APP_DEVICE] != 'None':
device_info += f", MobApp-({conf_device_data[CONF_MOBILE_APP_DEVICE]})"
Expand Down Expand Up @@ -4531,19 +4530,20 @@ def form_schema(self, step_id, actions_list=None, actions_list_default=None):
self.errors['base'] = 'icloud_acct_not_available'

# If conf_fmf_email is not in available fmf emails list, add it
fmf_email = self.conf_device_selected[CONF_FMF_EMAIL]
fmf_list_text_by_email = self.fmf_list_text_by_email.copy()
if fmf_email not in self.fmf_list_text_by_email:
error_key = f"{error_key}_fmf"
self.errors[CONF_FMF_EMAIL] = 'unknown_fmf'
fmf_list_text_by_email[fmf_email] = f"{fmf_email}{UNKNOWN_DEVICE_TEXT}"
# fmf_email = self.conf_device_selected[CONF_FMF_EMAIL]
# fmf_list_text_by_email = self.fmf_list_text_by_email.copy()
# if fmf_email not in self.fmf_list_text_by_email:
# error_key = f"{error_key}_fmf"
# self.errors[CONF_FMF_EMAIL] = 'unknown_fmf'
# fmf_list_text_by_email[fmf_email] = f"{fmf_email}{UNKNOWN_DEVICE_TEXT}"

if self.PyiCloud:
try:
if self.PyiCloud.FindMyFriends.is_service_not_available:
fmf_list_text_by_email[fmf_email] = f"{fmf_email}{DATA_ENTRY_ALERT}{SERVICE_NOT_AVAILABLE}"
except:
fmf_list_text_by_email[fmf_email] = f"{fmf_email}{DATA_ENTRY_ALERT}{SERVICE_NOT_STARTED_YET}"
pass
# try:
# if self.PyiCloud.FindMyFriends.is_service_not_available:
# fmf_list_text_by_email[fmf_email] = f"{fmf_email}{DATA_ENTRY_ALERT}{SERVICE_NOT_AVAILABLE}"
# except:
# fmf_list_text_by_email[fmf_email] = f"{fmf_email}{DATA_ENTRY_ALERT}{SERVICE_NOT_STARTED_YET}"
elif 'base' not in self.errors:
self.errors['base'] = 'icloud_acct_not_available'

Expand Down
11 changes: 9 additions & 2 deletions custom_components/icloud3/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
# Define the iCloud3 General Constants
#
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#
# Translations:
# en - @gcobb321 (Gary Cobb, iCloud3 author)
# zh-Hans - @MagicStarTrace (Magic)
#
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

VERSION = '3.0.4'
VERSION = '3.0.5.1'
VERSION_BETA = ''
#-----------------------------------------
DOMAIN = 'icloud3'
ICLOUD3 = 'iCloud3'
Expand Down Expand Up @@ -251,7 +258,7 @@
lite_circled_letters = "Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ"
dark_circled_letters = "🅐 🅑 🅒 🅓 🅔 🅕 🅖 🅗 🅘 🅙 🅚 🅛 🅜 🅝 🅞 🅟 🅠 🅡 🅢 🅣 🅤 🅥 🅦 🅧 🅨 🅩 ✪"
Symbols = ±▪•●▬⮾ ⊗ ⊘✓×ø¦ ▶◀ ►◄▲▼ ∙▪ »« oPhone=►▶→⟾➤➟➜➔➤🡆🡪🡺⟹🡆➔ᐅ◈🝱☒☢⛒⊘Ɵ⊗ⓧⓍ⛒🜔
Important = ❗❌⚠️❓🛑⛔⚡⭐⭕ⓘ• ⍰ ‶″“”‘’‶″ 🕓
Important =✔️❗❌✨➰⚠️❓🛑⛔⚡⭐⭕ⓘ• ⍰ ‶″“”‘’‶″ 🕓
— –ᗒ ⁃ » ━▶ ━➤🡺 —> > > ❯↦ … ⋮ 🡪ᗕ ᗒ ᐳ ─🡢 ──ᗒ 🡢 ─ᐅ ↣ ➙ →《》◆◈◉●
▐‖ ▹▻▷◁◅◃‖╠ᐅ🡆▶▐🡆▐▶‖➤▐➤➜➔❰❰❱❱ ⠤ ²
⣇⠈⠉⠋⠛⠟⠿⡿⣿ https://www.fileformat.info/info/unicode/block/braille_patterns/utf8test.htm
Expand Down
Loading

0 comments on commit e558f97

Please sign in to comment.