Skip to content

Commit

Permalink
iCloud3 v2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gcobb321 committed Apr 20, 2021
1 parent 2b7ec83 commit 719a2cf
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Welcome to iCloud3 v2.4!

[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.0-blue.svg)](https://github.com/gcobb321/icloud3)
[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.1-blue.svg)](https://github.com/gcobb321/icloud3)
[![Released](https://img.shields.io/badge/Released-April,_2021-blue.svg)](https://github.com/gcobb321/icloud3)
[![ProjectStage](https://img.shields.io/badge/Project_Stage-General_Availability-red.svg)](https://github.com/gcobb321/icloud3)
[![Type](https://img.shields.io/badge/Type-Custom_Component-orange.svg)](https://github.com/gcobb321/icloud3)
Expand Down
39 changes: 26 additions & 13 deletions custom_components/icloud3/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
#pylint: disable=unused-argument, unused-variable
#pylint: disable=too-many-instance-attributes, too-many-lines

VERSION = '2.4'
VERSION = '2.4.1'

'''
v2.4.1 (4/19/2021)
1. Fixed a bug where the create_sensor was not creating any sensors and the exclude_sensor was not excluding the specified sensors.
2. Fixed coding spelling error bugs related to iCloud 2fa reauthorization requests and determining if a beta version of the the Event Log needed updated when iCloud3 was starting.
'''

#Symbols = •▶¦▶ ●►◄ ▬ ▲▼◀▶ oPhone=►▶►

Expand Down Expand Up @@ -7510,14 +7516,14 @@ def _setup_sensors_custom_list(self, initial_load_flag):

if self.sensor_ids != []:
self.sensors_custom_list = []
for sensor_id in self.sensor_ids:
for sensor_id in self.sensor_ids[0].split(','):
id = sensor_id.lower().strip()
if id in SENSOR_ID_NAME_LIST:
self.sensors_custom_list.append(SENSOR_ID_NAME_LIST.get(id))

elif self.exclude_sensor_ids != []:
self.sensors_custom_list.extend(SENSOR_DEVICE_ATTRS)
for sensor_id in self.exclude_sensor_ids:
for sensor_id in self.exclude_sensor_ids[0].split(','):
id = sensor_id.lower().strip()
if id in SENSOR_ID_NAME_LIST:
if SENSOR_ID_NAME_LIST.get(id) in self.sensors_custom_list:
Expand Down Expand Up @@ -8632,12 +8638,15 @@ def _get_devices_list_from_config_devices_parm(self, conf_devices_parameter, sou

#You can track from multiple zones, cycle through zones and check each one
elif pname == CONF_TRACK_FROM_ZONE:
zones = pvalue.split(',')
zones = pvalue.replace('zone.', '')
zones = zones.split(',')
db=f"8648 {self.zones=} {self.zone_fname=} {pvalue=} {zones=}"
self._save_sysevent(db)
pvalue = ''
for zone in zones:
zone = zone.rstrip().lstrip()
zone = zone.strip()
if zone == HOME: continue
zfname = zone.replace(' ', '_')

if zone in self.zones:
pvalue += (f"{zone},")
elif zfname in self.zones:
Expand Down Expand Up @@ -8898,7 +8907,7 @@ def _check_ic3_event_log_file_version(self):
www_version, www_beta_version, www_version_text = self._read_event_log_card_js_file(www_evlog_filename)
else:
www_version = 0
www.beta_version = 0
www_beta_version = 0
www_version_text = UNKNOWN
try:
os.mkdir(www_directory)
Expand Down Expand Up @@ -9541,6 +9550,7 @@ def _devicename_famshr(self, devicename):
#
#########################################################
def _icloud_2fa1_show_verification_code_entry_form(self, invalid_code_msg=""):

"""Return the verification code."""

self._icloud3_update_service_handler(self.group, arg_command='pause')
Expand Down Expand Up @@ -9577,25 +9587,28 @@ def _icloud_2fa2_handle_verification_code_entry(self, callback_data):
valid_code = self.api.validate_2fa_code(self.verification_code)
if valid_code is False:
invalid_code_text = (f"The code {self.verification_code} in incorrect.\n\n")
self._icloud_2fa1_show_verification_code_entry_form(invalid_code_msg=invalid_code_text)
self._icloud_2fa1_show_verification_code_entry_form(
invalid_code_msg=invalid_code_text)
return

event_msg = "Apple/iCloud Account Verification Successful"
self._save_event("*", event_msg)

except PyiCloudException as error:
# Reset to the initial 2FA state to allow the user to retry
event_msg = (f"Failed to verify account > Error-{error}")
self._save_event_halog_error("*", event_msg)
invalid_code_msg = (f"Failed to verify account > Error-{error}")
self._save_event_halog_error("*", invalid_code_msg)

# Trigger the code rentry step immediately
self._icloud_2fa1_show_trusted_device_request_form()
self._icloud_2fa1_show_verification_code_entry_form(
invalid_code_msg=invalid_code_text)
return

if valid_code is False:
invalid_code_text = (f"The Verification Code {self.verification_code} in incorrect.\n\n")

self._icloud_2fa1_show_verification_code_entry_form(invalid_code_msg=invalid_code_text)
self._icloud_2fa1_show_verification_code_entry_form(
invalid_code_msg=invalid_code_text)
return

if self.username in self.hass_configurator_request_id:
Expand Down Expand Up @@ -9739,7 +9752,7 @@ def _icloud3_update_service_handler(self, group, arg_devicename=None,
return

elif arg_command_cmd == 'trusted_device':
self._icloud_2fa1_show_trusted_device_request_form()
self._icloud_2fa1_show_verification_code_entry_form()
return

elif arg_command_cmd == 'reset_session':
Expand Down
13 changes: 9 additions & 4 deletions docs/CHANGELOG-v2.4.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# iCloud3 Version 2.4 Change Log
# iCloud3 Version 2.4.1 Change Log

The following enhancements and changes have been made iCloud3:

Expand All @@ -7,7 +7,12 @@ The following enhancements and changes have been made iCloud3:

------

## Bug Fix Updates
### Bug Fix Updates (v2.4.1)

- Fixed a bug where the create_sensor was not creating any sensors and the exclude_sensor was not excluding the specified sensors.
- Fixed coding spelling error bugs related to (1) iCloud 2fa reauthorization requests after a failure and (2) determining if a beta version of the the Event Log was installed and needed to be updated when iCloud3 was starting.

### Bug Fix Updates (v2.4.0)

- Fixed a problem where excessive old location errors would continue to add entries to the Event Log. Tracking is now paused if there are more than 400 discarded location requests in one day or the phone has not been successfully located in over 26-hours. This may be caused by the phone being offline, is no longer associated with the iCloud account, is turned off, etc. Tracking can be restarted using the Event Log > Actions > Resume Polling option.
- Corrected an invalid variable name (EVA_NOTICE --> EVLOG_NOTICE). This error was displayed when sending a notification to a device was not successful.
Expand All @@ -16,7 +21,7 @@ The following enhancements and changes have been made iCloud3:

------

## Parameter Changes
### Parameter Changes (v2.4.0)

- *inzone_intervals* parameter - The interval between location updates when the device is in a zone can be specified for specific device types (iPhone, iPad, Watch, etc.), for devices that are not using the iOS App (iosapp_installed: False, noiosapp: True) and for the default *inzone_interval* for devices that are not specified. For example, can have a 2-hour interval for iPhones and a 15-minute interval for watches and devices that are not using the iOS App.
- *inzone_interval* parameter for a specific *device_name* - You can now specify the inzone_interval for each device on the devices/device_name parameter.
Expand All @@ -25,7 +30,7 @@ The following enhancements and changes have been made iCloud3:
- *noiosapp* parameter - Depreciated and replaced with the *iosapp_installed* parameter.
- *track_devices* parameter - Depreciated and will be removed on the next release of iCloud3

## Other Changes
### Other Changes (v2.4.0)

- The *device_tracker last_located, last_update and next_update time* attributes now display the timestamp (2021-03-11 14:23:30) instead of only the time (2:23:30 or 14:23:30). The sensors created by iCloud3 for these items still show only the time. This is helpful when the times of these items are for the previous or the next day. Sensors for these timestamps are not created by iCloud3. To create them, create a template sensor and extract the device_tracker's attribute value.
- Event Log Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# iCloud3 Device Tracker Custom Component

[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.0-blue.svg)](https://github.com/gcobb321/icloud3)
[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.1-blue.svg)](https://github.com/gcobb321/icloud3)
[![Released](https://img.shields.io/badge/Released-April,_2021-blue.svg)](https://github.com/gcobb321/icloud3)
[![ProjectStage](https://img.shields.io/badge/Project_Stage-General_Availability-red.svg)](https://github.com/gcobb321/icloud3)
[![Type](https://img.shields.io/badge/Type-Custom_Component-orange.svg)](https://github.com/gcobb321/icloud3)
Expand Down
2 changes: 1 addition & 1 deletion docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<table style="padding: 0 10px 0 40px;">
<tr>
<td>
<a class="sidebar-version-date">Version: 2.4.0, April, 2021</a>
<a class="sidebar-version-date">Version: 2.4.1, April, 2021</a>
</td>
</tr>
</table>
Expand Down
Binary file modified icloud3.zip
Binary file not shown.

0 comments on commit 719a2cf

Please sign in to comment.