I am using Google Maps Location Sharing and fritz (router) as device tracker.
Now I have one issue. Sometimes Google Maps cant update the location and will keep the old location.
So if maps thinks I am away (stuck somewhere on a road as last location) it will try updating my known device “phone” to away. Now if I am at home fritz knows that and will update “phone” to home. Now around every minute maps will change home to away for a few seconds which triggers my automation do turn off all devices and thats not how it should work. Any ideas?
Configuration.yaml:
- platform: fritz
host: 192.168.178.1
password: !secret fritzbox
interval_seconds: 8
consider_home: 30
new_device_defaults:
track_new_devices: False
- platform: google_maps
username: !secret gmaps_mail
password: !secret google
max_gps_accuracy: 1000
new_device_defaults:
track_new_devices: False
Automation.yaml:
- alias: 'Turn off everything if nobody is at home'
hide_entity: true
initial_state: off
trigger:
- platform: state
entity_id:
- device_tracker.google_maps_phone
from: 'home'
to: 'not_home'
- platform: state
entity_id:
- device_tracker.google_maps_girlfriend
from: 'home'
to: 'not_home'
condition:
condition: and
conditions:
- condition: template
value_template: "{{ states.device_tracker.google_maps_phone.state != 'home' }}"
- condition: template
value_template: "{{ states.device_tracker.google_maps_girlfriend.state != 'home' }}"
action:
- service: light.turn_off
- service: switch.turn_off
data:
entity_id: switch.fernseher
- service: switch.turn_off
data:
entity_id: switch.sonoff_10446e326
- service: switch.turn_off
data:
entity_id: switch.sonoff_10044bc6c
- service: climate.set_away_mode
data:
entity_id: climate.wohnzimmer1
away_mode: 'on'
- service: climate.set_away_mode
data:
entity_id: climate.wohnzimmer2
away_mode: 'on'
- service: media_player.turn_off
data:
entity_id: media_player.wohnzimmer_mini
- service: media_player.turn_off
data:
entity_id: media_player.schlafzimmer_mini
Known_devices.yaml:
google_maps_phone:
hide_if_away: false
icon:
mac: AB:12:34:56:78:91
name: Phone
picture: photo.jpg
track: true
google_maps_girlfriend:
hide_if_away: false
icon:
mac: AB:12:34:56:78:90
name: Girlfriend
picture: photo.jpg
track: true