在Homeassisant中同时通过蓝牙和WIFI判断人员是否在家
硬件
AInice 双存在传感器
路由器
添加插件
Xiaomi Gateway 3.
设置蓝牙在线状态
Ping (ICMP)
设置需要ping的设备IP 详细教程参考:https://blog.impressionyang.top/archives/HAOS-use-phone-to-detect-people-at-home
添加配置
在sensors.yaml文件中添加代码
- platform: template
sensors:
baba_online_status:
friendly_name: "爸爸在家或者离家状态"
value_template: >
{% if is_state('device_tracker.192_168_31_140', 'home') or is_state('binary_sensor.649e317d006f_bluetooth_online_1', 'on') %}
爸爸在家
{% else %}
爸爸离家
{% endif %}
重启ha,在开发者工具中查看实体状态 baba_online_statu
主页调用
- type: image
info: '************************ 人员在家信息 ************************'
entity: sensor.baba_online_status
state_image:
爸爸在家: /local/pc_ui2/爸爸在线.png
爸爸离家: /local/pc_ui2/爸爸离线.png
style:
background-color: rgba(255, 255, 255, 0.0)
height: 60px
left: 1450px
top: 950px
width: 60px
- type: state-label
entity: sensor.baba_online_status
style:
height: 60px
left: 1450px
top: 1010px
font-size: 14px
color: white
text-align: center