How do you get the location heatmap as shown in your example, my map tab does not do that?
I just want to start by saying how much I appreciate this app and the ability to track my family.
Iām using the FmF method to track them. I started a project over the weekend to track battery levels for some components, with the eventual goal of trying to send alerts when they get low.
I noticed that everyone I track is reporting 0% battery. Did they always do this, if so, why do I have the entities?
Thanks for everyoneās time.
Thanks for the idea @scotty1395, but I donāt have the stationary zone set on the map card.
I have done some further testing to ensure this to be the case:
Creating a new Lovelace map card via the UI with just my device_tracker
`(so please ignore the image in my previous post as colours have changed on this card)
This setup shows most of the device_tracker history as I would expect, but every time I have been stationary for long enough to move in to the stationary zone the path shoots up to (Iām assuming the current location of) the stationary zone in itās default position 1km North of my zone.home
If I add the stationary zone for this tracker to the map card as below:
Then I see an extra path (in green), which does indeed seem to be showing me the movements of the stationary zone.
I am pretty sure it must be something to do with the way that the stationary zone is handled, as adding the zone for the holiday home to the map card shows that the latitude and longitude of the device are being used rather than the zone centre whilst Iām within the zone, as I have various points dotted throughout the zone (which has a 200m radius).
Could it be that the stationary zone is being reset to itās default location upon a zone exit being detected, before the device_tracker is removed from it, and so the device_tracker is temporarily moving with it before updating to the correct GPS location?
@avd706
It is not a location heatmap that is being shown in my first post, to explain the colour differences, it is actually my device_tracker
in blue, and my wifeās device_tracker
in green (but we are away on holiday in Cornwall together) and as we have been very close (sat in the car next to each other) the two lines are overlayed.
I am also not using the map tab for this, there is now a Lovelace map card, which I have added to one of my views. The options for this card allow you to choose which entities you would like to show on the card, and how many hours of history you would like to show (which is the dotted path), it is just all the location history of the device_tracker for the last 48 hours.
Battery is stored here:
msg.data.attributes.battery
@charlyr
The stationary zone is being updated before the phoneās device state and attributes are updated so that could be the case. Iāll look at delaying the stationary zone moving back to the base location until after the device is updated to see what happens.
Thanks for taking a look at this @gcobb321 Iāve been using iCloud3 pretty much since you made your first release, and itās now the only device tracker that I use (obviously coupled to the iOS app)
I realised looking at my post above that when I added the stationary zone to the map card there are actually a lot more transitions of the stationary zone than there are jumps in my device tracker, so it canāt occur every time the stationary zone moves. (Sorry I missed this before)
On another note, I donāt think that I have restarted my HomeAssistant instance that many times in the last 48 hours, but I have recently restarted HomeAssistant after updating some integrations from HACS, after the restart I had a quick look at the recorder database. It seems to me that after the initial start of HomeAssistant, the device tracker rather than being in an unknown state is recorded as being in the stationary zone (below is the first database entry for my device_tracker after HomeAssistant started, with GPS redacted, but the longitude and latitude are of the stationary zone in its default location) I wonder if it is these entries that that are being picked up by the map card and I have restarted more than I remember? I will try to keep a track on all of my restarts, and see if they line up with the sudden jumps in location.
| 11980225 | device_tracker | device_tracker.archimedes | Not Set | {"source_type": "gps", "latitude": REDACTED, "longitude": REDACTED, "gps_accuracy": 0, "name": "Charlie", "zone": "not_set", "last_zone": "not_set", "zone_timestamp": "", "interval": "", "travel_time": "", "zone_distance": 0, "calc_distance": 0, "waze_distance": 0, "last_located": "00:00:00", "last_update": "00:00:00", "next_update": "00:00:00", "poll_count": "0:0:0", "dir_of_travel": "", "travel_distance": 0, "trigger": "iCloud3@00:00:00", "timestamp": "2020-09-22T20:45:04", "authenticated": "", "battery": 0, "battery_status": "", "info": "\u25cf HA is initializing dev_trk attributes \u25cf", "altitude": 0, "vertical_accuracy": 0, "device_status": "", "low_power_mode": "", "group": "group1", "entity_picture": "/local/images/charlie.png", "tracking": " archimedes ( ... _iosapp), cleves_iphone ( ... _iosapp) (FamShr)", "icloud3_version": "2.2.0rc12a", "friendly_name": "Archimedes"} | 12008265 | 2020-09-22 20:45:04 | 2020-09-22 20:45:04 | 2020-09-22 20:46:12 | NULL |
Enjoy your holiday. Iāll test. Thanks.
@charlyr
Try excluding the device_tracker.*_stationary
entity_globs from the history using the recorder exclude configuration yaml parameter to see if the stat zone jumps stop.
Mine is
recorder:
purge_keep_days: 5
exclude:
entity_globs:
- sensor.*ipad*
entities:
- sensor.icloud3_event_log
Hi Gary, I installed iCloud3 v2.2 and really like it, thanks! One small question, I live (like a lot of people) in a city, and most of my āmovementsā are on feet or by bike (and not by car). Is there a way of giving that parameter to Waze travel time?
@gcobb321
Thank you for the advice above, I have excluded the stationary zones from the recorder as you suggested, and that seems to have solved all of my jumps in to the stationary zone.
In doing this I have now realised that whilst the vast majority of the lines were jumps in to the stationary zone, a few were jumps to zone.home
. When restarting HomeAssistant the first location saved to the recorder always seems to be the zone.home
latitude and longitude.
The first record in the database for my device tracker after a restart is:
13024033 | device_tracker | device_tracker.archimedes | Not Set | {"source_type": "gps", "latitude": REDACTED_HOME_LATITUDE, "longitude": REDACTED_HOME_LONGITUDE, "gps_accuracy": 0, "name": "Charlie", "zone": "not_set", "last_zone": "not_set", "zone_timestamp": "", "interval": "", "travel_time": "", "zone_distance": 0, "calc_distance": 0, "waze_distance": 0, "last_located": "00:00:00", "last_update": "00:00:00", "next_update": "00:00:00", "poll_count": "0:0:0", "dir_of_travel": "", "travel_distance": 0, "trigger": "iCloud3@00:00:00", "timestamp": "2020-09-25T15:28:45", "authenticated": "", "battery": 0, "battery_status": "", "info": "\u25cf HA is initializing dev_trk attributes \u25cf", "altitude": 0, "vertical_accuracy": 0, "device_status": "", "low_power_mode": "", "group": "group1", "entity_picture": "/local/images/charlie.png", "tracking": " archimedes ( ... _iosapp), cleves_iphone ( ... _iosapp) (FamShr)", "icloud3_version": "2.2.0rc12a", "friendly_name": "Archimedes"}
I have been looking through the source code for release candidate 12a, and as the attributes in the db entry above has
"info": "\u25cf HA is initializing dev_trk attributes \u25cf"
I wonder if it has anything to do with the method _initialize_device_tracking_fields
where I see the lines 5709 and 5710 are:
self.last_lat[devicename] = self.zone_home_lat
self.last_long[devicename] = self.zone_home_long
Do these get stored to the database before the first actual location update occurs?
@charlyr
During initialization, iCloud3 needs to use default values for all of the attributes it creates and for the ones that already exists to get everything setā¦ To be able to do this, it needs a location and the Home location is used until the actual device location is known. Most of the time, the phone is at Home when HA is restarted so this never creates a problem. If you are away from Home when you restart HA, yes, you will stat a location change on the map.
Edit: 4:50:00 EDT (US)
The mobile_app seems to be taking longer to set up than iCloud3 so right now, on the initial load of HA, the Home location is used. When Restarting iC3 from the Event Log, the iOS App location for the phone will now be read and used to seed the initialization/setup location. To use the iOS App location on an HA initialization, iCloud3 will have to delay itās initialization to give time for the iOS App to be setup and location information passed back to HA. I could probably build a delay into iC3 that would be controlled by an config parameter and will look into it.
I donāt think waze supports travel with non-motor vehicles. Iām probably wrong, or thats just a bad thing.
see here:
@pprazzi
I just looked at the docs & code in the Waze/python interface Iām using and it supports vehicle types ācar, taxi and motorcycleā. So walking is out of the question.
The docs for the WazeRouteCalculator can be found here.
Release Candidate 12b (9/27/2020) is available
iCloud3 Documentation
Iām on the home stretch doing the docs for v2.2.0. Iāve completely reorganized it so more information is available for new users describing what iCloud3 is, how to get ready for it, how to install it and itās support programs and how to get it up and running.
But Iād like your help reviewing the docs and suggesting corrections, edits, rewording to make it simpler and easier to understand. Iāve read it over so many times, I now need new eyes to look at it. If you feel bored with nothing to do while we all sit home during this pandemic, and want to give me a hand, Iād appreciate it.
The docs can be found here.
Iāve opened up an Issue here for any comments, suggestions, corrections, etc.
Next step for me is wrapping it up, getting HACS updated and on to my next project.
Important Links:
- Download the installation zip file here
- Full Change Log is here
- v2.2.0 Documentation is here
- Installation instructions are here
Changes:
- Added error checking to time conversions routines.
- Add the 1/2/3 number to the Zone1/2/3 & LastZone1/2/3 sensor friendly name to identify them in the HA History.
- The phone is moved into the Stationary zone if is less than 4 times the Home zone radius and less than 1/2 of the time left to move it into the zone. The purpose was to reduce the polling when close to Home and moving very little. This was confusing and could lead to errors if the zone information had not been updated in the iOS App. This has been removed.
- The Stationary Zone location is now updated after the device_tracker entity is updated instead of before. This should prevent any location mismatches on the Lovelace map card when the phone exits the stationary zone, the station zone is moved back to itās base location and the phoneās path is being displayed.
- Fixed an error updating the Event Log during iCloud3 initialization if the config/www/custom_cards directory did not exist.
- Fixed some bugs restarting iCloud3 using the Event Log > Action pulldown. The problem occurred when invalid device errors were found while the track_devices configuration was verified, then corrected and then iCloud3 was restarted on the Event Log > Action pulldown. This also required updates to the Event Log.
- When iCloud3 starts, the Home location is used to initialize the deviceās location because the mobile_app integration has not been started. When restarting from the Event Log, the iOS Appās location is now used to initialize the deviceās location.
- Tweaked some colors in the Event Log.
The change from version 2.2.2.08 to 2.2.0.09 of the event log card seems to have modified the width of the card or thereās some invisible formatting hanging over, causing the view not to be shown full screen on iOS. With some screen refreshes it shows full screen but you can scroll right to empty space.
@scotty1395
Very strange since I didnāt go anything intentionally with the screen width statements that I know of. Iām seeing the same thing with v.2.0.09 and will do a code comparison tomorrow. I went back to v2.2.0.08 and it is ok so I broke something somewhere.
Edit: Release Candidate 12c fixes the Event Log formatting problem on the iPhone.
Release Candidate 12c is available
Important Links:
- Download the installation zip file here
- Full Change Log is here
- v2.2.0 Documentation is here
- Installation instructions are here
Changes:
- Fixed an Event Log formatting problem on the iPhone.
- Reformatted some error and alert messages for clarity.
- Fixed a bug selecting a zone within a zone.
@gcobb321 There is a typo on your github page. This was a reason it didnāt work for me in the 1st place!!
device_tracker:
- platform: icloud3
username: [email protected]
password: gary-icloud-password
tracking _method: famshr <----- **tracking_method: (a space too much)**
track_devices:
- gary_iphone > gary.png
- lillian_iphone > lillian.png
Hello!
I started using this implementation few hours ago, and I feel that my HA instance is running slower than before. Iāve checked the logs, and I realize that I have a couple of entries related to iCloud
Logger: custom_components.icloud3.device_tracker
Source: custom_components/icloud3/device_tracker.py:1686
Integration: icloud3 (documentation)
First occurred: 7:37:20 PM (1984 occurrences)
Last logged: 10:24:25 PM
'battery_level'
Traceback (most recent call last):
File "/config/custom_components/icloud3/device_tracker.py", line 1686, in _polling_loop_5_sec_device
ic3dev_battery = iosapp_dev_attrs[ATTR_BATTERY_LEVEL]
KeyError: 'battery_level'
Logger: custom_components.icloud3.device_tracker
Source: custom_components/icloud3/device_tracker.py:8344
Integration: icloud3 (documentation)
First occurred: 7:37:20 PM (1984 occurrences)
Last logged: 10:24:25 PM
Device Update Error, Error-<class 'ValueError'>
Both of them occurred 1948 times in just 3 hours. Iām using the latest RC version.
Any idea?
Thanks!