Open zxdavb opened 5 years ago
Having thought about this, I would expect this code not to:
post $(build_payload "$mac" "$(get_host_name $mac)" "$timeout")
if $(get_host_name $mac)
is a NULL string.
The reasoning is that:
a) you could have a lot of devices on your WiFi LAN, and it will be painful to keep HA's known_devices.yaml
up to date (e.g. someone visits and uses your WiFi)
b) to choose which devices end up in HA, just make sure it has a lease and a reverse DNS entry (the last line, below):
uci add dhcp host
uci set dhcp.@host[-1].name=my-smartphone
uci set dhcp.@host[-1].mac='08:18:13:25:c1:87'
uci set dhcp.@host[-1].ip=192.168.0.100
uci set dhcp.@host[-1].dns=1
Is nslookup by default using router's resolv.conf
defined DNS server? If you point it to router itselves dnsmasq, the DNS lookup will have no problem.
@zxdavb are you running regular dnsmasq? If so, the empty hostname is not because of not having set up the reverse DNS zone, but rather because the association event precedes assigning of a DNS name. Any subsequent events will likely have the correct DNS name, e.g. polling or disassociation events. Can you confirm that?
If so, this issue is essentially resolved by https://github.com/home-assistant/home-assistant/pull/31886
I am sorry, I have too much going on to help with this at the moment.
If the
nslookup
fails, then maybe a warning in the log file would be a good idea?I was getting (note
host_name
is a zero-length string,""
):instead of:
This happens when reverse name lookups fails in
function get_host_name
infunctions.sh
:Say:
logger -t $0 -p warning "Reverse DNS is not setup, so names cannot be resolved"