首页 > 其他分享 >homeassistant自动化记录ping在家联动设备

homeassistant自动化记录ping在家联动设备

时间:2022-08-24 16:55:35浏览次数:169  
标签:在家 ping phone tracker 联动 device home homeassistant

进入hass的配置文件,docker版从portainer中查看配置情况

文件名configuration.yaml

下述添加到最后

 

# ping根据ip追踪手机


device_tracker:
- platform: ping
hosts:
phone: 192.168.1.x

#间隔20秒检测一次
interval_seconds: 20

#如果180秒内都能ping同,则显示在家 状态为home
consider_home: 180

 

1. 设置完成后 配置-人员-用户(点进去)-跟踪设备 , 选择实体device_tracker.phone ,

2. 在首页ui中添加该实体以便观察

3. 开发者工具-状态-搜索device_tracker.phone可以获取到当前状态   默认在家为 home    不在家为 not_home

 

再根据

  配置-场景自动化-创建自动化(空白)

  触发条件类型 -  选择 状态

填写 从 not_home 变为  home  (意思是 从离开变为在家)

动作填写设备+状态即可

标签:在家,ping,phone,tracker,联动,device,home,homeassistant
From: https://www.cnblogs.com/rainsc/p/16620678.html

相关文章