Skip to content

Commit

Permalink
iCloud3 v3.0.rc10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gcobb321 committed Feb 11, 2024
1 parent 8228228 commit 52c44c3
Show file tree
Hide file tree
Showing 19 changed files with 629 additions and 379 deletions.
12 changes: 11 additions & 1 deletion custom_components/icloud3/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
rc10.3
...............................
1. MobApp Device Verification - Fixed a problem where a device that had an iCloud FamShr setup error would not be tracked at all even though it could still be tracked with the Mobile App.
2. Exit Zone when not in a zone - When this happened, the device would get into a 20-30 secs update loop. This has been fixed to only do this one time.
3. FamShr and Mobile App Devices that are not Tracked - Changed the message in the Event Log to indicate the device is not used by iCloud3.
4. Configure Settigs - Fixed an '\T' error starting with HA 2024.2.
5. Export Event Log, icloud3-0.log - Improved the readability of log file records.


rc10.2
...............................
1. Outside of Zone with no Exit Trigger message - Changed the way the Exit Trigger was being logged so this wouldn't be issued when the trigger was actually issued.
2. Passive Zones and the Mobile App - The Mobile App does not issue an Enter Zone Trigger for passive zones (which is correct), but it will issue an Exit Trigger for them (which it should not do). This was creating problems by issuing an Exit Zone Trigger when leaving the real zone and then issuing another Exit Trigger when leaving a zone it had never entered (Passive or otherwise). This Mobile App error is now identified and changed into a Verify Location trigger.
3. Nearby devices - Nearby device info will not be used if the device being updated is in a non-Stationary zone.
4. Configure Settings - inZone Interval, Fixed Interval, Max Interval, etc. - Changed the minimum value to 5-minutes to prevent conflicts with old location threshold and reusing a location when it should be requested again.
4. Configure Settings - inZone Interval, Fixed Interval, Max Interval, etc. - Changed the minimum value to 5-minutes to prevent conflicts with old location threshold and reusing a location when it should be requested again.
5. Other code cleanup.
6. More iCloud3 Documentation updates.



Expand Down
138 changes: 74 additions & 64 deletions custom_components/icloud3/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,17 @@ def dict_value_to_list(key_value_dict):
'delete_icloud_mobapp_info':'CLEAR FAMSHR/MOBAPP INFO ᐳ Reset the FamShr/Mobile App seletion fields on all devices',
'delete_device_cancel': 'CANCEL ᐳ Return to the Device List screen',

'inactive_to_track': 'TRACK ALL OR SELECTED ᐳ Change the \'Tracking Mode\' of all of the devices (or the selected devices) from \'Inactive\' to \Tracked\'',
'inactive_keep_inactive': 'DO NOT TRACK, KEEP INACTIVE ᐳ None of these devices should be \'Tracked\' and should remain \'Inactive\'',
'inactive_to_track': 'TRACK ALL OR SELECTED ᐳ Change the `Tracking Mode of all of the devices (or the selected devices) from `Inactive to `Tracked',
'inactive_keep_inactive': 'DO NOT TRACK, KEEP INACTIVE ᐳ None of these devices should be `Tracked and should remain `Inactive',

'restart_ha': 'RESTART HOME ASSISTANT ᐳ Restart HA and reload iCloud3',
'restart_ic3_now': 'RESTART NOW ᐳ Restart iCloud3 now to load the updated configuration',
'restart_ic3_later': 'RESTART LATER ᐳ The configuration changes have been saved. Load the updated configuration the next time iCloud3 is started',
'reload_icloud3': 'RELOAD ICLOUD3 ᐳ Reload & Restart iCloud3 (EXPERIMENTAL: THIS MAY NOT WORK)',
'review_inactive_devices': 'REVIEW INACTIVE DEVICES ᐳ Some Devices are `Inactive` and will not be located or tracked',

'select_text_as': 'SELECT ᐳ Update selected \'Display Text As\' field',
'clear_text_as': 'CLEAR ᐳ Remove \'Display Test As\' entry',
'select_text_as': 'SELECT ᐳ Update selected `Display Text As field',
'clear_text_as': 'CLEAR ᐳ Remove `Display Text As entry',

'exclude_sensors': 'EXCLUDE SENSORS ᐳ Select specific Sensors that should not be created',
'filter_sensors': 'FILTER SENSORS ᐳ Select Sensors that should be displayed',
Expand Down Expand Up @@ -2208,8 +2208,13 @@ async def async_step_icloud_account(self, user_input=None, errors=None, called_f

# Action Login or Save will login into the account if the username changed
if (action_item in ['login_icloud_account', 'save']):

await self._log_into_icloud_account(user_input, called_from_step_id='icloud_account')
# if already logged in and no changes, do not login again
if (self.PyiCloud
and self.PyiCloud.username == self.username
and self.PyiCloud.password == self.password):
pass
else:
await self._log_into_icloud_account(user_input, called_from_step_id='icloud_account')

if action_item == 'save' and self.PyiCloud != Gb.PyiCloud:
Gb.PyiCloud = Gb.PyiCloudInit = self.PyiCloud
Expand All @@ -2230,6 +2235,7 @@ async def async_step_icloud_account(self, user_input=None, errors=None, called_f
if (action_item == 'save'
and (self.errors == {} or self.errors.get('base', '') == 'icloud_acct_logged_into')):
user_input[CONF_ICLOUD_SERVER_ENDPOINT_SUFFIX] = self.endpoint_suffix

self._update_configuration_file(user_input)

return self.async_show_form(step_id=self.called_from_step_id_2,
Expand Down Expand Up @@ -2482,16 +2488,16 @@ def _set_action_list_item_username_password(self):
into the Action Item selection list item
'''

if self.username or self.password:
obscure_username = obscure_field(self.username) or 'NoUsername'
obscure_password = obscure_field(self.password) or 'NoPassword'
username_password = f"{obscure_username}/{obscure_password}"
#if self.username or self.password:
obscure_username = obscure_field(self.username) or 'NoUsername'
obscure_password = obscure_field(self.password) or 'NoPassword'
username_password = f"{obscure_username}/{obscure_password}"

if self.PyiCloud or Gb.PyiCloud:
logged_into_msg = f"{username_password}"
if self.PyiCloud or Gb.PyiCloud:
logged_into_msg = f"{username_password}"

else:
logged_into_msg = 'None'
logged_into_msg = f"None ({username_password})"
if 'base' not in self.errors:
self.errors = {'base': 'icloud_acct_not_logged_into'}

Expand Down Expand Up @@ -4798,57 +4804,61 @@ def form_schema(self, step_id, actions_list=None, actions_list_default=None):

#------------------------------------------------------------------------
elif step_id == 'special_zones':
if self.zone_name_key_text == {}:
self._build_zone_list()
stat_zone_used = (Gb.conf_general[CONF_STAT_ZONE_STILL_TIME] > 0)
pass_thru_zone_used = (Gb.conf_general[CONF_PASSTHRU_ZONE_TIME] > 0)
track_from_base_zone_used = Gb.conf_general[CONF_TRACK_FROM_BASE_ZONE_USED]

ptzh_default = [PASSTHRU_ZONE_HEADER] if pass_thru_zone_used else []
szh_default = [STAT_ZONE_HEADER] if stat_zone_used else []
tfzh_default = [TRK_FROM_HOME_ZONE_HEADER] if track_from_base_zone_used else []

return vol.Schema({
vol.Optional('passthru_zone_header',
default=ptzh_default):
cv.multi_select([PASSTHRU_ZONE_HEADER]),
vol.Required(CONF_PASSTHRU_ZONE_TIME,
default=Gb.conf_general[CONF_PASSTHRU_ZONE_TIME]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=0, max=5, step=.5, unit_of_measurement='minutes')),

vol.Required('stat_zone_header',
default=szh_default):
cv.multi_select([STAT_ZONE_HEADER]),
vol.Required(CONF_STAT_ZONE_FNAME,
default=self._parm_or_error_msg(CONF_STAT_ZONE_FNAME)):
selector.TextSelector(),
vol.Required(CONF_STAT_ZONE_STILL_TIME,
default=Gb.conf_general[CONF_STAT_ZONE_STILL_TIME]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=5, max=60, unit_of_measurement='minutes')),
vol.Required(CONF_STAT_ZONE_INZONE_INTERVAL,
default=Gb.conf_general[CONF_STAT_ZONE_INZONE_INTERVAL]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=5, max=60, srep=5, unit_of_measurement='minutes')),

vol.Optional(CONF_TRACK_FROM_BASE_ZONE_USED,
default=tfzh_default):
cv.multi_select([TRK_FROM_HOME_ZONE_HEADER]),
vol.Required(CONF_TRACK_FROM_BASE_ZONE,
default=self._option_parm_to_text(CONF_TRACK_FROM_BASE_ZONE, self.zone_name_key_text)):
selector.SelectSelector(selector.SelectSelectorConfig(
options=dict_value_to_list(self.zone_name_key_text), mode='dropdown')),
vol.Optional(CONF_TRACK_FROM_HOME_ZONE,
default=Gb.conf_general[CONF_TRACK_FROM_HOME_ZONE]):
# cv.boolean,
selector.BooleanSelector(),

vol.Required('action_items',
default=self.action_default_text('save')):
selector.SelectSelector(selector.SelectSelectorConfig(
options=self.actions_list, mode='list')),
})
try:
if self.zone_name_key_text == {}:
self._build_zone_list()

pass_thru_zone_used = (Gb.conf_general[CONF_PASSTHRU_ZONE_TIME] > 0)
stat_zone_used = (Gb.conf_general[CONF_STAT_ZONE_STILL_TIME] > 0)
track_from_base_zone_used = Gb.conf_general[CONF_TRACK_FROM_BASE_ZONE_USED]

ptzh_default = [PASSTHRU_ZONE_HEADER] if pass_thru_zone_used else []
szh_default = [STAT_ZONE_HEADER] if stat_zone_used else []
tfzh_default = [TRK_FROM_HOME_ZONE_HEADER] if track_from_base_zone_used else []

return vol.Schema({
vol.Optional('passthru_zone_header',
default=ptzh_default):
cv.multi_select([PASSTHRU_ZONE_HEADER]),
vol.Required(CONF_PASSTHRU_ZONE_TIME,
default=Gb.conf_general[CONF_PASSTHRU_ZONE_TIME]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=0, max=5, step=.5, unit_of_measurement='minutes')),

vol.Required('stat_zone_header',
default=szh_default):
cv.multi_select([STAT_ZONE_HEADER]),
vol.Required(CONF_STAT_ZONE_FNAME,
default=self._parm_or_error_msg(CONF_STAT_ZONE_FNAME)):
selector.TextSelector(),
vol.Required(CONF_STAT_ZONE_STILL_TIME,
default=Gb.conf_general[CONF_STAT_ZONE_STILL_TIME]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=0, max=60, unit_of_measurement='minutes')),
vol.Required(CONF_STAT_ZONE_INZONE_INTERVAL,
default=Gb.conf_general[CONF_STAT_ZONE_INZONE_INTERVAL]):
selector.NumberSelector(selector.NumberSelectorConfig(
min=5, max=60, step=5, unit_of_measurement='minutes')),

vol.Optional(CONF_TRACK_FROM_BASE_ZONE_USED,
default=tfzh_default):
cv.multi_select([TRK_FROM_HOME_ZONE_HEADER]),
vol.Required(CONF_TRACK_FROM_BASE_ZONE,
default=self._option_parm_to_text(CONF_TRACK_FROM_BASE_ZONE, self.zone_name_key_text)):
selector.SelectSelector(selector.SelectSelectorConfig(
options=dict_value_to_list(self.zone_name_key_text), mode='dropdown')),
vol.Optional(CONF_TRACK_FROM_HOME_ZONE,
default=Gb.conf_general[CONF_TRACK_FROM_HOME_ZONE]):
# cv.boolean,
selector.BooleanSelector(),

vol.Required('action_items',
default=self.action_default_text('save')):
selector.SelectSelector(selector.SelectSelectorConfig(
options=self.actions_list, mode='list')),
})
except Exception as err:
log_exception(err)

#------------------------------------------------------------------------
elif step_id == 'sensors':
Expand Down
Binary file removed custom_components/icloud3/config_flow.zip
Binary file not shown.
8 changes: 6 additions & 2 deletions custom_components/icloud3/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

VERSION = '3.0.rc10.2'
VERSION = '3.0.rc10.3'
#-----------------------------------------
DOMAIN = 'icloud3'
ICLOUD3 = 'iCloud3'
Expand Down Expand Up @@ -303,7 +303,11 @@
LARROW = ' <-- ' #U+27F5 (Long Arrow Left) ⟸ ⟽
LARROW2 = '<--' #U+27F5 (Long Arrow Left) ⟸ ⟽
INFO_SEPARATOR = '/' #'∻'
DASH_20 = '━'*2
DASH_20 = '━'*20
DASH_50 = '━'*50
DASH_DOTTED_50 = '- '*25
TAB_11 = '\t'*11

OPT_NONE = 0

#tracking_method config parameter being used
Expand Down
8 changes: 4 additions & 4 deletions custom_components/icloud3/const_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@
'ZoneDistance',
'distance, km-mi',
'mdi:map-marker-distance',
[FROM_ZONE, ZONE_DISTANCE_M, ZONE_DISTANCE_M_EDGE,
MAX_DISTANCE, CALC_DISTANCE, WAZE_DISTANCE, WAZE_METHOD, NEAR_DEVICE_USED],
[FROM_ZONE, ZONE_DISTANCE_M, ZONE_DISTANCE_M_EDGE, MAX_DISTANCE,
CALC_DISTANCE, WAZE_DISTANCE, WAZE_METHOD,NEAR_DEVICE_USED],
0],
DISTANCE: [
'Distance',
Expand All @@ -255,8 +255,8 @@
'HomeDistance',
'distance, km-mi',
'mdi:map-marker-distance',
[FROM_ZONE, ZONE_DISTANCE_M, ZONE_DISTANCE_M_EDGE,
MAX_DISTANCE, CALC_DISTANCE, WAZE_DISTANCE, WAZE_METHOD, NEAR_DEVICE_USED],
[FROM_ZONE, ZONE_DISTANCE_M, ZONE_DISTANCE_M_EDGE,MAX_DISTANCE, WENT_3KM,
CALC_DISTANCE, WAZE_DISTANCE, WAZE_METHOD, NEAR_DEVICE_USED],
0],
DIR_OF_TRAVEL: [
'Direction',
Expand Down
4 changes: 4 additions & 0 deletions custom_components/icloud3/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def initialize(self):
self.is_data_source_ICLOUD = True
self.is_data_source_FAMSHR_FMF = True
self.is_data_source_MOBAPP = True
self.verified_ICLOUD = False
self.verified_FAMSHR = False
self.verified_FMF = False
self.verified_MOBAPP = False

# Device location & gps fields
self.old_loc_cnt = 0
Expand Down
Binary file not shown.
7 changes: 5 additions & 2 deletions custom_components/icloud3/global_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class GlobalVariables(object):
ActionsOptionsFlow = None
MobileApp_data = {} # mobile_app Integration data dict from hass.data['mobile_app']
MobileApp_devices = {} # mobile_app Integration devices dict from hass.data['mobile_app']['devices]
mobile_app_device_fnames = [] # fname = name_by_user or name in mobile_app device entry


EvLog = None
Expand Down Expand Up @@ -136,7 +135,11 @@ class GlobalVariables(object):
Devices_by_icloud_device_id = {} # Devices by the icloud device_id receive from Apple
Devices_by_ha_device_id = {} # Device by the device_id in the entity/device registry
Devices_by_mobapp_devicename = {} # All verified Devices by the conf_mobapp_devicename
devicenames_x_mobapp_devicename = {} # All devicenames by conf_mobapp_devicename from conf_devices (both ways)
devicenames_x_famshr_devices = {} # All ic3_devicenames by conf_famshr_devices (both ways)
devicenames_x_mobapp_devicenames = {} # All ic3_devicenames by conf_mobapp_devicename (both ways)
mobapp_fnames_x_mobapp_id = {} # All mobapp_fnames by mobapp_deviceid from HA hass.data MobApp entry (both ways)
mobapp_fnames_disabled = []
mobile_app_device_fnames = [] # fname = name_by_user or name in mobile_app device entry
PairedDevices_by_paired_with_id = {} # Paired Devices by the paired_with_id (famshr prsID) id=[Dev1, Dev2]
Zones = [] # Zones object list
Zones_by_zone = {} # Zone object by zone name for HA Zones and iC3 Pseudo Zones
Expand Down
2 changes: 2 additions & 0 deletions custom_components/icloud3/helpers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def list_to_str(list_value, separator=None):

#--------------------------------------------------------------------
def list_add(list_value, add_value):
if add_value is None:
return list_value
if add_value not in list_value:
list_value.append(add_value)
return list_value
Expand Down
Loading

0 comments on commit 52c44c3

Please sign in to comment.