Skip to content

Commit

Permalink
v2.4.6 Update - cellphone icon, lovelace sensor alignment, waze retry…
Browse files Browse the repository at this point in the history
… cnt
  • Loading branch information
gcobb321 committed Oct 15, 2021
1 parent 12d4240 commit b620186
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 19 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.5-blue.svg)](https://github.com/gcobb321/icloud3)
[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.6-blue.svg)](https://github.com/gcobb321/icloud3)
[![Released](https://img.shields.io/badge/Released-October,_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
19 changes: 16 additions & 3 deletions custom_components/icloud3/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@
CONF_DISPLAY_ZONE_FORMAT: ['zone', 'name', 'fname', 'title'],
CONF_DISTANCE_METHOD: ['waze', 'calc'],
CONF_WAZE_REGION: ['US', 'NA', 'EU', 'IS', 'AU', 'us', 'na', 'eu', 'is', 'au'],
CONF_DISPLAY_ZONE_FORMAT: ['zone', 'name', 'fname', 'title'],
}
VALIDATE_PARAMETER_TRUE_FALSE = [
CONF_CENTER_IN_ZONE,
Expand Down Expand Up @@ -1292,6 +1293,9 @@ def _start_icloud3(self):
f"{self._format_list(self.notify_iosapp_entity.get(devicename))}")
self._save_event_halog_info("*", event_msg)

db=(f"1290 {devicename} {self.notify_iosapp_entity=}")
self._save_event_halog_info("*", db)

#Send a message to all devices during startup
if self.broadcast_msg != '':
self._send_message_to_device(devicename, self.broadcast_msg)
Expand Down Expand Up @@ -5509,7 +5513,7 @@ def _update_device_sensors(self, arg_devicename, attrs:dict):
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = ''
elif format_type == '%':
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = '%'
elif format_type == 'min':
elif format_type == 'min' and instr(state_value, 'min') is False and instr(state_value, 'hr') is False:
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = 'min'
elif format_type == 'title':
state_value = state_value.title().replace('_', ' ')
Expand Down Expand Up @@ -7387,9 +7391,13 @@ def _setup_monitored_iosapp_entities(self, devicename, iosapp_entities, notify_d
if dev_trk_entity_id:
#Extract all notify entitity id's with this devicename in them from hass notify services notify list
notify_devicename_list = []
db=(f"7379 {notify_devicenames=}")
self._save_event_halog_info("*", db)
for notify_devicename in notify_devicenames:
if instr(notify_devicename, devicename):
notify_devicename_list.append(notify_devicename.replace("mobile_app_", ""))
db=(f"7382 {notify_devicename=} {notify_devicename_list=}")
self._save_event_halog_info("*", db)

self.notify_iosapp_entity[devicename] = notify_devicename_list
self.device_tracker_entity_iosapp[devicename] = (f"device_tracker.{dev_trk_entity_id}")
Expand All @@ -7398,6 +7406,10 @@ def _setup_monitored_iosapp_entities(self, devicename, iosapp_entities, notify_d
self.device_tracker_entity_iosapp[devicename] = ''
self.iosapp_monitor_dev_trk_flag[devicename] is False

db=(f"7390 {self.device_tracker_entity_iosapp=}")
self._save_event_halog_info("*", db)
db=(f"7390 {self.notify_iosapp_entity=}")
self._save_event_halog_info("*", db)
return

#--------------------------------------------------------------------
Expand Down Expand Up @@ -8338,7 +8350,7 @@ def _get_waze_distance(self, devicename, from_lat, from_long, to_lat,

try:
retry_cnt = 0
while retry_cnt < 6:
while retry_cnt < 3:
try:
self.count_waze_locates[devicename] += 1
waze_call_start_time = time.time()
Expand Down Expand Up @@ -8686,7 +8698,8 @@ def _get_devices_list_from_config_devices_parm(self, conf_devices_parameter, sou
elif pname == CONF_TRACK_FROM_ZONE:
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.strip()
Expand Down
18 changes: 15 additions & 3 deletions development-v2.4.6/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,9 @@ def _start_icloud3(self):
f"{self._format_list(self.notify_iosapp_entity.get(devicename))}")
self._save_event_halog_info("*", event_msg)

db=(f"1290 {devicename} {self.notify_iosapp_entity=}")
self._save_event_halog_info("*", db)

#Send a message to all devices during startup
if self.broadcast_msg != '':
self._send_message_to_device(devicename, self.broadcast_msg)
Expand Down Expand Up @@ -5510,7 +5513,7 @@ def _update_device_sensors(self, arg_devicename, attrs:dict):
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = ''
elif format_type == '%':
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = '%'
elif format_type == 'min':
elif format_type == 'min' and instr(state_value, 'min') is False and instr(state_value, 'hr') is False:
sensor_attrs[CONF_UNIT_OF_MEASUREMENT] = 'min'
elif format_type == 'title':
state_value = state_value.title().replace('_', ' ')
Expand Down Expand Up @@ -7388,9 +7391,13 @@ def _setup_monitored_iosapp_entities(self, devicename, iosapp_entities, notify_d
if dev_trk_entity_id:
#Extract all notify entitity id's with this devicename in them from hass notify services notify list
notify_devicename_list = []
db=(f"7379 {notify_devicenames=}")
self._save_event_halog_info("*", db)
for notify_devicename in notify_devicenames:
if instr(notify_devicename, devicename):
notify_devicename_list.append(notify_devicename.replace("mobile_app_", ""))
db=(f"7382 {notify_devicename=} {notify_devicename_list=}")
self._save_event_halog_info("*", db)

self.notify_iosapp_entity[devicename] = notify_devicename_list
self.device_tracker_entity_iosapp[devicename] = (f"device_tracker.{dev_trk_entity_id}")
Expand All @@ -7399,6 +7406,10 @@ def _setup_monitored_iosapp_entities(self, devicename, iosapp_entities, notify_d
self.device_tracker_entity_iosapp[devicename] = ''
self.iosapp_monitor_dev_trk_flag[devicename] is False

db=(f"7390 {self.device_tracker_entity_iosapp=}")
self._save_event_halog_info("*", db)
db=(f"7390 {self.notify_iosapp_entity=}")
self._save_event_halog_info("*", db)
return

#--------------------------------------------------------------------
Expand Down Expand Up @@ -8339,7 +8350,7 @@ def _get_waze_distance(self, devicename, from_lat, from_long, to_lat,

try:
retry_cnt = 0
while retry_cnt < 6:
while retry_cnt < 3:
try:
self.count_waze_locates[devicename] += 1
waze_call_start_time = time.time()
Expand Down Expand Up @@ -8687,7 +8698,8 @@ def _get_devices_list_from_config_devices_parm(self, conf_devices_parameter, sou
elif pname == CONF_TRACK_FROM_ZONE:
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.strip()
Expand Down
1 change: 1 addition & 0 deletions development-v2.4.6/iCloud3 v2.4.6 Change Log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
v2.4.6 (10/11/2021)
1. Changed the icon for zones from mdi:cellphone-iphone to mdi:cellphone because of Home Assistant mdi update.
2. Changed the sensor state values for Travel Time, Distance, Next Update Time, etc. from an empty field to a value to address a Lovelace display change. The fields that were empty were not alligned with the field next to them. Travel Time will now display 0 min when in a zone. Other fields will display '___' when empty.
3. Increased the Waze Route Server retry requests from 3 times to 6 times to try to resolve 'No response from Waze Server, Calc will be used instead' message.

v2.4.5 (10/5/2021)
1. Fixed a problem where the Waze Route Calculator was being disabled and the distance method-calc was being used. I think the problem started when the WazeRouteCalculator module in the Home Assistant standard Python library was updated.
Expand Down
Binary file removed development-v2.4.6/icloud3 v2.4.6.zip
Binary file not shown.
Binary file added development-v2.4.6/icloud3-v2.4.6.zip
Binary file not shown.
26 changes: 17 additions & 9 deletions docs/CHANGELOG-v2.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,42 @@ The following enhancements and changes have been made iCloud3:

------

### Fix to restore the WazeRouteCalculator function (v2.4.5, 10/6/2021)
### v2.4.6 (10/11/2021) - HA cellphone icon update, Lovelace Sensor Alignment, Increase Waze retry count

1. Changed the icon for zones from mdi:cellphone-iphone to mdi:cellphone because of Home Assistant mdi update.
2. Changed the sensor state values for Travel Time, Distance, Next Update Time, etc. from an empty field to a value to address a Lovelace display change. The fields that were empty were not aligned with the field next to them. Travel Time will now display 0 min when in a zone. Other fields will display '___' when empty.
3. Increased the Waze Route Server retry requests from 3 times to 6 times to try to resolve 'No response from Waze Server, Calc will be used instead' message.



### v2.4.5 (10/6/2021) - Fix to restore the WazeRouteCalculator function

1. Fixed a problem where the Waze Route Calculator was being disabled and the distance method-calc was being used. The problem started when the WazeRouteCalculator module in the Home Assistant standard Python library was changed. This update uses a modified version of the WazeRouteCalculator that is part of the Python Standard library that was developed by Kovács Bálint, Budapest, Hungary. It has been customized to better support iCloud3.

### Update to support iCloud+ change that broke Find-my-Friends tracking method (v2.4.4, 9/25/2021)
### v2.4.4 (9/25/2021) - Update to support iCloud+ change that broke Find-my-Friends tracking method

1. Coordinated update with pyicloud_ic3.py to support Apple iCloud url changes to access iCloud+ for location & device info for Find-my-Friends tracking method.

### Sensor Update (v2.4.3c)
### v2.4.3c - Sensor Update

1. Added sensor '[devicename]_travel_time_min' -- This is the unformatted waze travel time in minutes. It can be included or excluded using the 'mtim' code.

### Bug Fix Update (v2.4.3a, v2.4.3b,
### v2.4.3a, v2.4.3b - Bug Fix Update

1. An undefined variable 'invalid_code_text' was displayed after entering an invalid iCloud account verification code or taking to long to enter it. This has been corrected.

1. 2dded Event Log items for each step of the iCloud Verification code notice, entry and authentication

### Bug Fix Updates (v2.4.2)
### v2.4.2 - Bug Fix Updates

- Added 'AU' to the list of valid Waze Regions.

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

- 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)
### v2.4.0 - Bug Fix Updates

- 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 @@ -43,7 +51,7 @@ The following enhancements and changes have been made iCloud3:

------

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

- *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 @@ -52,7 +60,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 (v2.4.0)
### v2.4.0 - Other Changes

- 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.5-blue.svg)](https://github.com/gcobb321/icloud3)
[![CurrentVersion](https://img.shields.io/badge/Current_Version-v2.4.6-blue.svg)](https://github.com/gcobb321/icloud3)
[![Released](https://img.shields.io/badge/Released-October,_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
4 changes: 2 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
<table style="padding: 0 10px 0 40px;">
<tr>
<td>
<a class="sidebar-version-date">Version: 2.4.5, October, 2021</a>
<a class="sidebar-version-date">Version: 2.4.6, October, 2021</a>
</td>
</tr>
</table>
</nav>

- What's New and What Changed
- [Changes and new Features - v2.4.5](CHANGELOG-v2.4.md)
- [Changes and new Features - v2.4.6](CHANGELOG-v2.4.md)
- Welcome to iCloud3
- [1.0 Introduction](README.md)
- [1.1 Quick Start Guide](chapters/1.1-quick-start-guide.md)
Expand Down
Binary file modified icloud3.zip
Binary file not shown.

0 comments on commit b620186

Please sign in to comment.