gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
516 stars 52 forks source link

Device moved to (center of) zone when oldlocation happens #258

Open SaturnusDJ opened 1 year ago

SaturnusDJ commented 1 year ago

Situation: A non HA iOS app user is in a zone. At one point the location of the device is old. Then the device is being moved onto the center of the zone. (This is the problem, why does that happen.) Then the connection is back and the device is moved to the actual location (in the zone but closer to the edge). Repeat x30 because poor connection. The result is a very painted map in HA.

Config:

inzone_intervals:
  - inzone_interval: 10 min
  - no_iosapp: 10 min
max_interval: '10 min'
center_in_zone: false
stationary_inzone_interval: '10 min'
stationary_still_time: '10 min'
stationary_zone_offset: '210, -700'
#travel_time_factor: .6
distance_method: calc

#--Accuracy Parameters--------------------------------------------
gps_accuracy_threshold: 200
ignore_gps_accuracy_inzone: false
old_location_threshold: '15 min'

#--Formatting Parameters------------------------------------------
unit_of_measurement: km
time_format: 24
display_zone_format: zone

Having these new automations to force when location is not received:


- alias: Test - iCloud3 interval is 15 min > force resume+locate
  trigger:
  - platform: template
    value_template: "{{ states.sensor.iphone_interval.state == '5 min' }}"
  - platform: template
    value_template: "{{ states.sensor.iphone_interval.state == '30 min' }}"
  - platform: template
    value_template: "{{ states.sensor.iphone_interval.state == '60 min' }}"
  - platform: template
    value_template: "{{ states.sensor.iphone_interval.state == '1 hrs' }}"
  - platform: template
    value_template: "{{ states.sensor.iphone_interval.state == '2 hrs' }}"
  action:
  - service: device_tracker.icloud3_update
    data:
      command: resume
  - service: device_tracker.icloud3_update
    data:
      command: location

- alias: Test - iCloud3 paused > force resume+locate
  trigger:
  - platform: template
    value_template: "{{ states.sensor.iphone_badge.state == 'PAUSED' }}"
  action:
        repeat:
          while:
            - "{{ states.sensor.iphone_badge.state == 'PAUSED' }}"
            - condition: template
              value_template: "{{ repeat.index <= 999 }}"
          sequence:
            - service: device_tracker.icloud3_update
              data:
                command: resume
            - service: device_tracker.icloud3_update
              data:
                command: location
            - delay: 60
SaturnusDJ commented 1 year ago

Kick. Just to be clear: also happens without those automations. It started happening after I made zones this user often is in.