Skip to content

feat: Implement whitelist #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ttimasdf
Copy link

There's the case that my home Wi-Fi contains many devices of different purposes, e.g. guest phone, TV stream box, IoT sensors and such. Those Wi-Fi clients shouldn't be reported as a device tracker, because we don't care about their connection status. So a whitelist function is implemented.

There's the case that my home Wi-Fi contains many devices of different purposes, e.g. guest phone, TV stream box, IoT sensors and such. Those Wi-Fi clients shouldn't be reported as a device tracker, because we don't care about their connection status. So a whitelist function is implemented.
@lesandie
Copy link

lesandie commented Jan 31, 2020

In the whitelist, It would be better to specify the MAC Address instead of the hostname. If you have multiple AP running OpenWrt plus 802.11r fast roaming, the hostname is irrelevant for the AP, only the MAC is used:

Fri Jan 31 11:37:09 2020 daemon.notice hostapd: wlan1: AP-STA-DISCONNECTED fc:18:3c:xx:xx:xx
Fri Jan 31 11:37:09 2020 daemon.info hostapd: wlan1: STA fc:18:3c:xx:xx:xx IEEE 802.11: authenticated
Fri Jan 31 11:37:09 2020 daemon.info hostapd: wlan1: STA fc:18:3c:xx:xx:xx IEEE 802.11: associated (aid 4)

Copy link

@lesandie lesandie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i said, i would substitute hostname for mac, to build the payload and only send the whitelisted devices. I've forked your repo @ttimasdf and made the modifications. It works nicely with 2 APs. Thanks to you and mueslo for the code :-D

@mueslo
Copy link
Owner

mueslo commented Jun 3, 2020

As i said, i would substitute hostname for mac, to build the payload and only send the whitelisted devices. I've forked your repo @ttimasdf and made the modifications. It works nicely with 2 APs. Thanks to you and mueslo for the code :-D

@lesandie

Is this still a relevant feature with newer versions of HomeAssistant? (I no longer see device_tracker devices in the UI) If so, feel free to submit a pull request based on MAC addresses 👍

@meskal
Copy link

meskal commented Oct 7, 2021

Actually this is still an issue (at least for me). I did not check my known_devices.yml for some time and now it contains more than 12000 lines. (Probably due to 5 android devices that use random MACs each time they connect)

Since I did not find a way to not track devices by default for solutions that directly use device_tracker.see service calls, I would really appreciate a whitelist feature as I only want to track 2 of my wifi devices, which I told to use static MACs.

Is there anything I could to to merge this? I'd strongly prefer an upstream solution instead of maintaining my own repo.

PS: thanks for creating this package :-)

if [ -n "$hass_whitelist_devices" ] && ! array_contains "$hostname" $hass_whitelist_devices; then
logger -t $0 -p warning "push_event ignored, $hostname not in whitelist."
elif [ -z "$hostname" ]; then
logger -t $0 -p warning "sync_state ignored, hostname for $mac is empty."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can tell, this is unrelated to the whitelist feature and should be removed (also, it is buggy, since it can suppress events from devices before they have gone through DHCP)

Comment on lines +148 to +149
elif [ -z "$hostname" ]; then
logger -t $0 -p warning "sync_state ignored, hostname for $mac is empty."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants