Windows 10 PC always shows as not_home in device tracker

your right.
if you can see any file on the win10 PC then you only have to use set_state from a sensor to home.

so something in the line of:

import appdaemon.appapi as appapi
import datetime


class device_tracker(appapi.AppDaemon):

  def initialize(self):
    runtime = datetime.time(0, 0, 0)
    self.run_minutly(test,runtime)

  def test(self,kwargs):
    try:
      fo=open(self.args["your_file"],"r")
      status="home"
    except:
      status="not_home"
    self.set_status(self.args["your_device"],status)

and if you put yourfile and yourdevice in the config you can use that for all your devices.

i think this app is complete now

Looks good to me :wink:

But it was more than 2 lines - bummer!

2 Likes

maybe you can make it shorter.

i did it just in a few minutes in between trying to get some arduinosketches to work. (which isnt going like i wish :stuck_out_tongue: )

1 Like

by the way @rpitera you could off course also use nmap out of appdaemon :wink:

Actually I ended up solving this with SNMP (on the clients since FiOS routers don’t allow access and aren’t supported in HA).

I’m going to write up the steps and link the post to here.

but you got me thinking again about making my own devicetracker.
based on nmap and not mac adress based but IP based.
and it could be easy to make groups to where some of them give the value home versus not_home and others online versus offline.

I did a tutorial on my SNMP solution here:

Hope it helps someone!

1 Like

note: i have seen that some windows 10 machine (especial pro edition) seem to need to explicit allow ping request on the firewall . i also have see nmap scan to be recorded as attack attempt on the domain controller log.

I specifically allowed pings on the firewall and I mentioned in post #11 that Ping was working at all points during the testing; it was only NMap that wasn’t allowing contact without elevated privileges.

I don’t have a domain in my home network; it’s a workgroup but thanks for the warning!

I’ve recently moved my HASS from Windows to Raspberry PI and with the same problem that Windows 10 based devices are not detectable by nmap device tracker. The configuration of the tracker is the same, so it must be some difference between Windows nmap and Linux nmap, does anyone have an idea about this difference?

NMap needs elevated privileges to see the Windows PCs. That’s why I went the SNMP route instead. You can edit the core files for this, but then you have to do it again after every update. Personally, I don’t like editing core files.

@rpitera, what kind of elevated privileges? Does it mean that the privileges are different for nmap on Windows and Linux? The nmap scanner can be customised e.g. scan options: " --privileged -sP " if it is the case without changing the core.
Unfortunately, SNMP doesn’t work for some reason, probably, I cannot find the right baseovid.

It was quite sometime back, but I think I had to run nmap from the commandline as root (sudo) and use the -Pn option.

Did you look at my tutorial in the thread about the baseoid I used? The OID I chose from the HOST.MIB was the one that displays the host’s name because this makes it easy when creating the templates and also because it is common to all Windows versions. That OID is: 1.3.6.1.2.1.1.5.0

@rpitera, I used device tracker SNMP with my router AirportExtreme. It seems to me that I’ve found the right oid 1.3.6.1.4.1.63.501.3.2.2.1.1 because it detects new devices however it shows everything offline.

Ah, you’re going to the router - my tutorial is for creating sensors based on SNMP support on the Windows boxes themselves.

Your idea is interesting, however, it requires additional manipulations with Windows 10 while I’m looking for a solution where hass and local network infrastructure could be involved.

I had the same problem and fixed it by adding the “-PS” Switch to nmap’s list of arguments with Ports 135 and 445:

scan_options: " -PS135,445 -F --host-timeout 5s"

Those ports should be open by default and are related to Windows RPC service (135) and Network File Sharing (445).

5 Likes

And just like that, all of my devices are now showing properly at home - and not just the Win 10 devices either.

I feel like I wrote that whole SNMP tutorial for nothing, now. LOL

Thanks, @thomaswr!

Thank you!
It works perfectly. Maybe you should consider to add this to the documents :wink:

Strange thing is that now my Acurite weather relay is now showing as down, which it never did before. I know it’s up as WeatherUnderground and Acurite will email me if it’s down for more than a few minutes.

Will have to look into this.