-
Notifications
You must be signed in to change notification settings - Fork 31
Add multiple features without breaking existed #45
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
base: master
Are you sure you want to change the base?
Conversation
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.
How is it listening for dnsmasq events? |
echo "dhcp-script=/usr/lib/hass-tracker/push_event.sh" >> /etc/dnsmasq.conf |
[ -z "$hostname" ] && hostname="$(get_host_name $mac)" | ||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will ignore devices with no hostname?
# get hostname for mac | ||
nslookup "$(get_ip $1)" | grep -o "name = .*$" | cut -d ' ' -f 3 | ||
domain="$(uci get dhcp.@dnsmasq[0].domain)" | ||
nslookup "$(get_ip $1)" | grep -o "name = .*$" | cut -d ' ' -f 3 | sed -e "s/\\.$domain//" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you strip the domain?
resp=$(curl "$hass_host/api/services/device_tracker/see" -sfSX POST \ | ||
config_get hass_curl_insecure global curl_insecure | ||
|
||
[ -n "$hass_curl_insecure" ] && curl_param="-k" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if hass_curl_insecure=0
this would still add the parameter, contrary to expectation
The modification is a bit messy so I combine the features inside one PR.
I didn't test the build. Only scp'ed the script with modified one a.nd it works..
Hopefully this could fix #37, fix #43, fix #8.