homassistant上配置device_tracker

官方文档:
https://home-assistant.io/components/device_tracker.gpslogger/

一. 更改ha配置
1. configure.yaml
device_tracker:
– platform: gpslogger

zone: !include zone.yaml

2. zone.yaml
– name: MyHome
latitude: xxx.xxx
longitude: xxx.xxx
radius: 250
icon: mdi:home

二. 在手机上安装gpslogger

记录细节->记录到自定义URL,值为以下:
http://[ha_server]/api/gpslogger?api_password=[password]&latitude=%LAT&longitude=%LON&device=%SER&accuracy=%ACC&battery=%BATT&speed=%SPD&direction=%DIR&altitude=%ALT&provider=%PROV&activity=%ACT

修改[ha_server]和[password]为你的值

三. automate.yaml

– alias: hackers365 phone enter office
trigger:
– platform: zone
entity_id: device_tracker.xxx
zone: zone.office
event: enter
condition:
– condition: time
after: ’09:30′
before: ’10:30′
action:
– service: tts.baidu_say
entity_id: media_player.vlc
data:
message: ‘波哥已经到公司了’