enesbcs / owrtwifi2mqtt

A simple shell script to detect presence of Wifi devices (smartphones, tablets, Amazon Dash Buttons, ..) and post the results via MQTT.
2 stars 1 forks source link

standalone Wi-Fi AP (DHCP server running on router) #1

Open dannutu opened 4 weeks ago

dannutu commented 4 weeks ago

Thanks a lot for this small script, it was exactly what I was looking for, with Autodiscovery as the cherry on top! :)

Sadly though I bumped into an issue: my Wi-Fi setup has the DHCP server running on the router, not on the AP (they are separate physical devices), so the /tmp/dhcp.leases file on the AP is empty. Do you have any idea how to fetch the hostnames for MAC addresses from the router when needed? I reckon I could change your script to scp the file between devices when needed but I feel there must be a more "elegant" solution. If I was aware of any "trigger" from Dnsmasq for managing the MAC addresses or updating the /tmp/dhcp.leases file I could run a script similar with yours to publish the new MAC-hostname associations as retained MQTT messages.

Thanks again!

dannutu commented 4 weeks ago

ok, so it seems that hotplugd should catch all dhcp updates, which is good. however I am still unsure why it can successfully execute some commands (e.g. touch /tmp/file) but not other (e.g. logger -t hotplug.dhcp text, or even /usr/bin/logger -t hotplug.dhcp text). logger -t hotplug.dhcp text works as expected from the cli. one rabbit hole leading to another one... :)