Skip to content

Commit

Permalink
iCloud3 v3.0.0 Beta 5
Browse files Browse the repository at this point in the history
  • Loading branch information
gcobb321 committed Dec 28, 2022
1 parent 47afdf5 commit 6654c80
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 124 deletions.
File renamed without changes.
52 changes: 33 additions & 19 deletions custom_components/icloud3/ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
Beta 4 - 12/17/2022
-------------------
Beta 5 - 12/28/2022
~~~~~~~~~~~~~~~~~~~~
1. Fixed a 'log_info_msg' not defined error message in the routine that identifies the notify
service used for a device. This is just an informative message indicating HA has not set it
up yet.
2. Periodically, the events currently displayed for a device is reduced from all events to less
than a screen. This number was increased from 1/2-screen to about 2-screens.
3. When the displayed events for a device were reduced (#2 above), the screen was never refreshed
so you would always see the old events and had to do a refresh to see the latest events. Now,
the device's events are automatically refreshed when they are updated.
4. Updated the Event Log Lovelace card to v3.0.1. This fixes a problem when the date/time should not
be displayed if there was an alert message was displayed.


Beta 4 - 12/27/2022
~~~~~~~~~~~~~~~~~~~~
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.
Expand All @@ -14,23 +28,23 @@ Beta 4 - 12/17/2022
- 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.
- 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.
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/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')
in the configuration file.
Expand All @@ -43,8 +57,8 @@ Beta 3 - 12/24/2022
5. Added 'Reinitialize All Devices' to the Configurator > iCloud3 Devices screen. With it,
you can remove all devices from iCloud3 or reset the selections for the iCloud FamShr & FmF
and the iOS App parameters to `None`. This will clear any errors due to device migration errors.
6. Setting up the log_level (info, debug, rawdata) a lot earlier. It is now setup when HA loads iCloud3
instead of later. Debug and RawData information should now be written to the HA Log file
6. Setting up the log_level (info, debug, rawdata) a lot earlier. It is now setup when HA loads
iCloud3 instead of later. Debug and RawData information should now be written to the HA Log file
(home-assistant.log) when the iCloud Account connection is first established.
7. Moved `Event Log Configuration` option to Menu Page 1 and moved `Display Text As` option to Menu
Page 2. Also added the `Log Level` parameter to the Event Log Configuration screen. This
Expand All @@ -55,14 +69,14 @@ Beta 3 - 12/24/2022
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'.
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
Expand All @@ -80,7 +94,7 @@ Beta 2 - 12/17/2022
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.
loaded during initialization and was generating an error during the retry operation.
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 ccount from the Configurator.
5 changes: 3 additions & 2 deletions custom_components/icloud3/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,8 @@ def _validate_update_device(self, user_input):

conf_famshr_device_fname = user_input[CONF_FAMSHR_DEVICENAME] #.split(" >")[0].strip()
if conf_famshr_device_fname != 'None':
raw_model, model, model_display_name = self.device_model_info_by_fname[conf_famshr_device_fname].split(';')
# raw_model, model, model_display_name = self.device_model_info_by_fname[conf_famshr_device_fname].split(';')
raw_model, model, model_display_name = self.device_model_info_by_fname[conf_famshr_device_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):
Expand Down Expand Up @@ -2030,7 +2031,7 @@ def _update_changed_sensor_entities(self):
Sensor.update_entity_attribute(new_fname=self.conf_device_selected[CONF_FNAME])
except:
pass

# v3.0.0-beta3-Added check to see if device has tfz sensors
try:
for sensor, Sensor in Gb.Sensors_by_devicename_from_zone[devicename].items():
Expand Down
14 changes: 6 additions & 8 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.0b4'
VERSION = '3.0.0b5'
DOMAIN = 'icloud3'
ICLOUD3 = 'iCloud3'
MODE_PLATFORM = -1
Expand Down Expand Up @@ -48,8 +48,6 @@
UNKNOWN = 'Unknown'
STATIONARY = 'stationary'
STATIONARY_FNAME = 'Stationary'
# NEAR_ZONE = 'near_zone'
# NEAR_ZONE_FNAME = 'Near Zone'
AWAY_FROM = 'AwayFrom'
AWAY = 'Away'
TOWARDS = 'Towards'
Expand Down Expand Up @@ -137,11 +135,11 @@
STAT_ZONE_MOVE_DEVICE_INTO = 100
STAT_ZONE_MOVE_TO_BASE = 1

EVLOG_TABLE_MAX_CNT_BASE = 1000 #Used to calculate the max recds to store
EVLOG_TABLE_MAX_CNT_ZONE = 750 #Used to calculate the max recds to store
EVENT_LOG_CLEAR_SECS = 900 #Clear event log data interval
EVENT_LOG_CLEAR_CNT = 15 #Number of recds to display when clearing event log
ICLOUD3_ERROR_MSG = "ICLOUD3 ERROR-SEE EVENT LOG"
EVLOG_TABLE_MAX_CNT_BASE = 1000 # Used to calculate the max recds to store
EVLOG_TABLE_MAX_CNT_ZONE = 750 # Used to calculate the max recds to store
EVENT_LOG_CLEAR_SECS = 900 # Clear event log data interval
EVENT_LOG_CLEAR_CNT = 30 # Number of recds to display when clearing event log
ICLOUD3_ERROR_MSG = "ICLOUD3 ERROR-SEE EVENT LOG"

#Devicename config parameter file extraction
DI_DEVICENAME = 0
Expand Down
7 changes: 4 additions & 3 deletions custom_components/icloud3/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def initialize(self):
self.tracking_method = None
self.tracking_status = TRACKING_NORMAL
self.tracking_mode = TRACK_DEVICE #normal, monitor, inactive
self.update_timer = 0
self.last_data_update_secs = 0
self.last_evlog_msg_secs = 0
self.dist_from_zone_km_small_move_total = 0
self.device_tracker_entity_ic3 = (f"{DEVICE_TRACKER}.{self.devicename}")
self.zone_change_datetime = DATETIME_ZERO
Expand Down Expand Up @@ -1343,7 +1344,7 @@ def update_dev_loc_data_from_raw_data_IOSAPP(self, RawData=None):
or self.iosapp_data_secs == 0):
return

self.update_timer = time_now_secs()
self.last_data_update_secs = time_now_secs()

self.dev_data_source = IOSAPP_FNAME
self.dev_data_fname = self.fname
Expand Down Expand Up @@ -1386,7 +1387,7 @@ def update_dev_loc_data_from_raw_data_FAMSHR_FMF(self, RawData, requesting_devic
or (RawData.location_secs <= self.loc_data_secs and self.loc_data_secs > 0)):
return

self.update_timer = time_now_secs()
self.last_data_update_secs = time_now_secs()

location = RawData.device_data[LOCATION]
location_secs = RawData.location_secs
Expand Down
63 changes: 33 additions & 30 deletions custom_components/icloud3/event_log_card/icloud3-event-log-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class iCloud3EventLogCard extends HTMLElement {
}
//---------------------------------------------------------------------------
setConfig(config) {
const version = "3.0.0"
const version = "3.0.1"
const cardTitle = "iCloud3 Event Log v3"

const root = this.shadowRoot
Expand Down Expand Up @@ -505,7 +505,7 @@ class iCloud3EventLogCard extends HTMLElement {
/*border: 1px solid dodgerblue;*/
}
#statusName {
/*width: 50%;*/
width: 55%;
color: firebrick;
float: left;
font-size: 14px;
Expand Down Expand Up @@ -1357,7 +1357,7 @@ class iCloud3EventLogCard extends HTMLElement {
classSpecialTextColor = ' specColor6'
} else if (initializationRecdFound == false) {
classErrorMsg = ' errorMsg'
alertErrorMsg = ".Alert at " + tTime + " ... (Refresh to Clear Alert Notification)"
alertErrorMsg = ".Alert at " + tTime + " ... (Refresh to Clear Alerts Messages)"
} else {
classSpecialTextColor = ' specColor6'
}
Expand All @@ -1382,27 +1382,27 @@ class iCloud3EventLogCard extends HTMLElement {
}

//Change CRLF in the text string to HTML >b> for a new line
while (tText.indexOf("CRLF•") >= 0) {
tText = tText.replace("CRLF•", "<br>&nbsp;&nbsp;•&nbsp;&nbsp;")
}
while (tText.indexOf("DOT") >= 0) {
tText = tText.replace("DOT", "•&nbsp;&nbsp;")
}
while (tText.indexOf("CRLF✓") >= 0) {
tText = tText.replace("CRLF✓", "<br>&nbsp;✓&nbsp;")
}
while (tText.indexOf("CRLF") >= 0) {
tText = tText.replace("CRLF", "<br>")
}
while (tText.indexOf("NBSP2") >= 0) {
tText = tText.replace("NBSP2", "&nbsp;&nbsp;")
}
while (tText.indexOf("NBSP4") >= 0) {
tText = tText.replace("NBSP4", "&nbsp;&nbsp;&nbsp;&nbsp;")
}
while (tText.indexOf("NBSP6") >= 0) {
tText = tText.replace("NBSP6", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
}
// while (tText.indexOf("CRLF•") >= 0) {
// tText = tText.replace("CRLF•", "<br>&nbsp;&nbsp;•&nbsp;&nbsp;")
// }
// while (tText.indexOf("DOT") >= 0) {
// tText = tText.replace("DOT", "•&nbsp;&nbsp;")
// }
// while (tText.indexOf("CRLF✓") >= 0) {
// tText = tText.replace("CRLF✓", "<br>&nbsp;✓&nbsp;")
// }
// while (tText.indexOf("CRLF") >= 0) {
// tText = tText.replace("CRLF", "<br>")
// }
// while (tText.indexOf("NBSP2") >= 0) {
// tText = tText.replace("NBSP2", "&nbsp;&nbsp;")
// }
// while (tText.indexOf("NBSP4") >= 0) {
// tText = tText.replace("NBSP4", "&nbsp;&nbsp;&nbsp;&nbsp;")
// }
// while (tText.indexOf("NBSP6") >= 0) {
// tText = tText.replace("NBSP6", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
// }

//If displaying a table, the State & Interval can contain column titles
var classTable = ''
Expand Down Expand Up @@ -1516,6 +1516,7 @@ class iCloud3EventLogCard extends HTMLElement {
const optHalog = root.getElementById("optHalog")
const optRawdata = root.getElementById("optRawdata")
const optStartuplog = root.getElementById("optStartuplog")
const statusName = root.getElementById("statusName")

if (logLevelDebug.indexOf("evlog") >= 0) {
optEvlog.text = "Hide Tracking Monitors"
Expand All @@ -1535,7 +1536,9 @@ class iCloud3EventLogCard extends HTMLElement {
optRawdata.text = "Start Rawdata Logging"
}

if (alertErrorMsg != "") {
if (statusName.classList.contains('errorAlertMsg')) {
'pass'
} else if (alertErrorMsg != "") {
this._displayDevicenameMsgL(alertErrorMsg)
alertErrorMsg = ''
} else {
Expand Down Expand Up @@ -1932,16 +1935,16 @@ class iCloud3EventLogCard extends HTMLElement {
if (this._isUserMessageDisplayed()) {
msg = 'Click the message or click Refresh to redisplay the device names'
this._classListRemove('statusName', 'errorAlertMsg')
statusName.style.setProperty('width', '98%')
statusName.style.setProperty('width', '100%')
statusName.style.setProperty('color', 'green')
statusTime.innerText = ''
} else if (msg.startsWith(".Alert")) {
this._classListAdd('statusName', 'errorAlertMsg')
statusName.style.setProperty('width', '98%')
statusName.style.setProperty('width', '100%')
statusName.style.setProperty('color', 'white')
statusTime.innerText = ''
} else {
statusName.style.setProperty('width', '40%')
statusName.style.setProperty('width', '55%')
statusName.style.setProperty('color', 'firebrick')
this._displayTimeMsgR('')
}
Expand Down Expand Up @@ -1973,7 +1976,7 @@ class iCloud3EventLogCard extends HTMLElement {
msg = updateTime
} else {
this._classListRemove('statusName', 'errorAlertMsg')
statusName.style.setProperty('width', '40%')
statusName.style.setProperty('width', '55%')
statusName.style.setProperty('color', 'firebrick')
}
if (msg == "") {
Expand All @@ -1989,7 +1992,7 @@ class iCloud3EventLogCard extends HTMLElement {
const infoText = root.getElementById("infoText")
const aboutVersion = root.getElementById("aboutVersion")

if (msg == 'xxVersion') {
if (msg == 'Version') {
msg = 'EvLog v' + aboutVersion.innerText
this._classListAdd('infoText', 'lightgray')
this._classListRemove('infoText', 'primarycolor')
Expand Down
1 change: 1 addition & 0 deletions custom_components/icloud3/global_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class GlobalVariables(object):
update_in_process = False
evlog_action_request = ''


# Debug and trace flags
log_debug_flag = False
log_rawdata_flag = False
Expand Down
Loading

0 comments on commit 6654c80

Please sign in to comment.