Home Assistant 之OpenWrt设备追踪,连接路由器显示在家离家状态。
1. SSH登陆OpenWrt执行下面命令安装 luci-mod-rpc。
opkg install luci-mod-rpc
或者 使用网页界面安装 luci-mod-rpc
2. 第二步骤修改 /etc/os-release 文件里的版本号。
root@OpenWrt:~# cat /etc/os-release NAME="OpenWrt" VERSION="19.07-SNAPSHOT" ID="openwrt" ID_LIKE="lede openwrt" PRETTY_NAME="OpenWrt 19.07-SNAPSHOT" VERSION_ID="19.07-snapshot"
#这里换成18.06 HOME_URL="https://openwrt.org/" BUG_URL="https://bugs.openwrt.org/" SUPPORT_URL="https://forum.openwrt.org/" BUILD_ID="r11399-3187c018ac" OPENWRT_BOARD="x86/64" OPENWRT_ARCH="x86_64" OPENWRT_TAINTS="no-all" OPENWRT_DEVICE_MANUFACTURER="OpenWrt" OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/" OPENWRT_DEVICE_PRODUCT="Generic" OPENWRT_DEVICE_REVISION="v0" OPENWRT_RELEASE="OpenWrt 19.07-SNAPSHOT r11399-3187c018ac"
3. Home Assistant增加设备追踪配置,之后重启Home Assistant。
device_tracker:
- platform: luci
host: 192.168.1.1
#ssl: true
#verify_ssl: true
username: root
password: !secret wrtpass
interval_seconds: 5
consider_home: 180
new_device_defaults:
track_new_devices: true
4. 修改known_devices.yaml文件,为每个设备设置,是否需要追踪。