All Projects → mueslo → openwrt_hass_devicetracker

mueslo / openwrt_hass_devicetracker

Licence: GPL-3.0 license
Simple OpenWRT package which forwards device connection changes to a HomeAssistant instance

Programming Languages

shell
77523 projects
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to openwrt hass devicetracker

openwrt
OpenWRT device tracker for Home Assistant that actually works
Stars: ✭ 59 (-35.87%)
Mutual labels:  presence-detection
BitSrunLoginGo
深澜校园网登录程序 Go 语言版,适用于路由器、windows、linux 等。提供对 OpenWrt、Docker、Go Module 的支持
Stars: ✭ 112 (+21.74%)
Mutual labels:  openwrt-package
NueXini Packages
Packages for OpenWrt【每日更新luci-app OpenWrt Packages】
Stars: ✭ 269 (+192.39%)
Mutual labels:  openwrt-package
Openwrt
Lienol's Modified OpenWrt source
Stars: ✭ 2,153 (+2240.22%)
Mutual labels:  openwrt-package
Smartdns
A local DNS server to obtain the fastest website IP for the best Internet experience, 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验。
Stars: ✭ 4,333 (+4609.78%)
Mutual labels:  openwrt-package
Lede
Lean's OpenWrt source
Stars: ✭ 19,062 (+20619.57%)
Mutual labels:  openwrt-package
simetbox-openwrt-base
Sistema base para instalação do SIMETBox
Stars: ✭ 22 (-76.09%)
Mutual labels:  openwrt-package
OpenWrt-Buildbot
Customized Pure OpenWrt & Self-Build OpenWrt Packages Project.
Stars: ✭ 305 (+231.52%)
Mutual labels:  openwrt-package
luci-app-dnscrypt-proxy2
LuCI support for dnscrypt-proxy version2 https://github.com/DNSCrypt/dnscrypt-proxy
Stars: ✭ 25 (-72.83%)
Mutual labels:  openwrt-package
simetbox-openwrt-feed
SIMETBox package feed for OpenWRT (comece aqui/start here!)
Stars: ✭ 72 (-21.74%)
Mutual labels:  openwrt-package
helloworld
SSR 科学上网软件
Stars: ✭ 65 (-29.35%)
Mutual labels:  openwrt-package
aliyundrive-webdav
阿里云盘 WebDAV 服务
Stars: ✭ 5,371 (+5738.04%)
Mutual labels:  openwrt-package
simetbox-openwrt-config
Biblioteca para leitura da configuração do SIMETBox
Stars: ✭ 16 (-82.61%)
Mutual labels:  openwrt-package

openwrt_hass_devicetracker

Package for a completely event-driven device/user presence tracker for Home Assistant on an OpenWRT/LEDE access point.

Description

Listens on hostapd wifi association events and then initiates appropriate service calls to the configured Home Assistant instance. On AP-STA-CONNECTED or AP-STA-POLL-OK the device is marked as seen with a timeout set by the timeout_conn config option. If an AP-STA-DISCONNECTED event is received, it is marked as seen with a timeout of timeout_disc.

Since restarting your access points removes any scripts connected via hostapd_cli -a, this package includes a daemon which monitors ubus for added APs so restarting/reconfiguring your radios doesn't kill the service.

Building

A docker image is provided for convenience of generating an OpenWRT package without having to set up the build environment. Simply run docker-compose run pkgbuild. If successful, the created package will be located in build/bin/packages/<ARCH>/packages/. If your UID is not 1000, you may need to chmod 777 build/bin.

Installation

Simply opkg install hass-tracker once it is added to the OpenWRT repositories. Until then, download a package from releases and opkg install <downloaded_file>.

Configuration

Once the package is installed, you can modify /etc/config/hass-tracker to your liking and start/enable the service via service hass-tracker start and service hass-tracker enable. If you would like to use HTTPS, simply start your host string with the https:// protocol specifier.

Authentication is done via a long-lived access token that can be generated from the web UI. This token needs to be set in the configuration file in the field token.

Note on missed events

If Home Assistant or the OpenWRT access point is restarted frequently or unreliable in other ways, you should reduce the very long default timeout for connected devices, since a disconnect event may be missed. However, since association events for connected devices can happen as infrequently as every 2-4 hours, you might want to then add a cronjob which synchronizes the state to Home Assistant at least twice as often as your timeout for connected devices timeout_conn. A good value for this might be a timeout of 1 hour and a sync every 30 minutes. The cronjob should look like:

#!/bin/sh

source /lib/functions.sh
config_load hass-tracker

source /usr/lib/hass-tracker/functions.sh
sync_state

This ensures that missed disconnect events do not spuriously keep the device present for more than an hour. This will be implemented by default in a future version or via an OpenWRT DeviceScanner in Home Assistant.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].