jokob-sk / NetAlertX

🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
3.15k stars 186 forks source link

Don´t publish MQTT Sensor if device name is "(name not found)" #732

Closed AdmiralRaccoon closed 4 months ago

AdmiralRaccoon commented 4 months ago

Is there an existing issue for this?

Am I willing to test this? 🧪

Can I help implement this? 👩‍💻👨‍💻

Is your feature request related to a problem? Please describe

Many hostnames can not be resolved, and NetAlertX tags the name as (name not found).

Usually, I will change the name manually, but the MQTT Plugin has already published the device to home Assistant, and the entites will have the name "sensor.name_not_found_last_ip_1, sensor.name_not_found_last_ip_2", and so on, resulting in renaming each entity in Home Assistant to the correct name.

Describe the solution you'd like

If NetAlertX detects a device and can´t resolve the hostname and tags it as (Name not found), these devices should not been published by MQTT, as long as the device has not been renamed.

EDIT: After thinking about, it would be nice if this could be and optional feature for every subnet. If this would be a global feature, i wouldn´t be informed if there are any new devices in the guest vlan, as they often have blank names (especially android devices). And for guest devices, there is no need for manually naming.

Describe alternatives you've considered

Renaming all entities manually in Home Assistant. :-D

Anything else?

-

jokob-sk commented 4 months ago

Hey @AdmiralRaccoon ,

That makes sense.

image

This should be available in the next release. Please have a look at the netalertx-dev docker image, in about 15 minutes (or after the last action finishes) from now.

👉If I don't get a confirmation that this is working I might pull out the feature to prevent bugs.

Make sure you refresh your browser cache - and click the 🔄 refresh button in the top right corner.

It would be great if you could test this (backup everything first or use a new container) on your end by switching to the above image and letting me know if the issue was resolved/the new feature is working.

⭐ This feature took 30min ⏳ to implement - consider becoming a sponsor or sharing the app on socials⭐

Thanks in advance, j

AdmiralRaccoon commented 4 months ago

thanks, I will test it as second thing in the morning. first thing is coffee

AdmiralRaccoon commented 4 months ago

I´ve tried testing it but I´m struggling getting the device page loaded: The Loading Icon won´t disappear, I tried clearing cache, private window, another browser.

Usually, it disappears after some time, but today nothing happens since 1,5 hours.

image

However, when going through the "monitoring" tab, I can see my "Name not found" test devices, and this time they don´t appear within Home Assistant, so I guess it works.

jokob-sk commented 4 months ago

Great, thanks for checking!

Make sure you refresh your browser cache - and click the 🔄 refresh button in the top right corner. If the issue persists, please screenshot the Dev Console tab in your browser. I'm also pushing out a couple of fixes, but they should not influence this.

jokob-sk commented 4 months ago

Releasing -> closing