Working well for me, appreciate this.
I was in the middle of adapting my system to use this pfSense/cron job when I scrolled down and saw the SNMP component. It configured right up and is working great! Thank you!
I find that I canāt see wifi_5G iphone
Hello,
How long it takes to detect home stat?
Best regards
Iām so sorry, Iāve been gone from the forums for a while. To answer your question, the detection is based upon your interval_seconds line. It also depends on which devices your using to detect presence. I use our phones. If we happen to turn off wifi on the phone while gone then it doesnāt detect us at all! However, if our wifi is on it is pretty quick. I also use it to know which computers are on throughout the house, which is also handy.
mine was working after i update the unifi controler, but the when we arrived was ok about one minute or so , when we were away tokked much more about 9 to10 min.
iām using the mac adress to detect.
but now it donāt detect:(
sorry it was other suject that i was refering.
Does this integration work under 0.105?
Iām struggling with: āConfiguration invalidā āPlatform error device_tracker.pfsense - Integration āpfsenseā not found.ā
I created the pfsense.py file in the device_tracker folder under custom_components. Do i need a manifest.json file or __init__.py or something else?
Sorry Iām not sure, I havenāt used pfsense for a few years now and HA has changed a ton.
Okay, i knew it was a long shot. Thank you for your quick reply though
Iām using pfsense with SNMP and it works fine. I use this configuration:
device_tracker:
- platform: snmp
host: 10.0.0.254
community: !secret community
baseoid: 1.3.6.1.2.1.4.22.1.2
Nice! I will look into that solution
Got it working already
Two questions:
- How fast does the device update. Is it based upon the DHCP leases? It seems that the online to offline state is quit slow but the offline to online state is fast.
- Is it possible to import hostname of af new device?
Itās not from DHCP, it is the table of all devices in the network. Youāll find a description here:
As for speed it works fast enough for my use - and as far as I can tell the limiting factor is my phone taking some time before it actually finds and connects to my wifi.
The MAC addresses from are updated by the pfSense ARP (Address Resolution Protocol) table. Default is 20 minutes from last time the ARP cache saw the device in question.
You can monitor the āexpirationā by logging into pfSense and go to Diagnostics > ARP Table, you will see all the devices and a second-value counting down. It is updated either when there is traffic from the device thru the router, or when a device replies to an ARP request packet on the network and the router hears it. Some things play better than others (our LG Android phones seem to not update the table as often as computers and tablets).
The expiration is set by a kernel variable which you can add a custom value to adjust if you want a shorter time. The risk if itās too short is there will be more ARP resolution traffic on your network and things may show as ānot onlineā when they really are. Probably not a big deal on a small home network to go as low as 5 minutes, but I found I had to go up to 6 minutes with a āconsider homeā of 6 minutes to avoid some phones dropping out when they are really still home.
The default value is 20 minutes for ARP purging. You can go to System > Advanced > Tunables, and modify (create) ānet.link.ether.inet.max_ageā value in seconds. For 6 minutes, I set it to 360.
For the Hassio tracker, I found this worked most reliably (avoiding false-negatives - I really donāt want lights and radios going on-off scaring us when we are home but phones are idle)
# pfSense device tracker
# Useful command to browse SNMP output: "snmpwalk -Os -c public -v 2c 192.168.1.1"
device_tracker:
- platform: snmp
host: 192.168.1.1
community: public
baseoid: .1.3.6.1.2.1.4.22.1.2
interval_seconds: 20
consider_home: 360
I also strongly recommend you only turn on the SNMP features you use, just to cut down on what might be exposed and what resources might be used.
Under Services > SNMP I found the only thing I needed to leave enabled was āSNMP modules: MibIIā and I also restricted it only to the VLAN/Interface that my trusted network devices are sitting on.
One other note, I also found I could fiddle with the SNMP string to get Hassio to see all VLANs all devices, or only one VLAN of devices (using SNMPwalk command, looking at output) but I donāt know if itās a predictable pattern (e.g. VLAN-ID, or ???). This could be useful if you REALLY only care about tracking devices on a specific VLAN vs tracking all VLANs.
As for hostnameā¦I havenāt looked into that, I have duplicate hostnames because some people have the same model of phone and they all show as āBRAND-MODELā which is useless if I canāt tell which is what. I make a āpersonā for each āthingā I want to track, and add the relevant MAC addresses to it. For example, my TV is āa personā so I can track if itās on or off, as is my HTPC (with both network MAC addresses added to the āpersonā). The hostname thing also gets funky with stuff that doesnāt properly report a hostname (e.g. static IP devices) but the MAC addresses work on everything, nomater what.
If you really want to investigate what else you can pull, look at the snmpwalk command and you can manually browse thru everything that pfSense is reporting looking for fields of interest.
The is excellent explanation. Answered so many questions i did not yet ask. Thank you for your thorough walk through the configurations and nubs to tweak.
I will disable the SNMP modules that are not in use and good point about the hostname.
Thanks for that detailed info. One thing that can help make the states a lot more reliable is to combine this with something like owntracks (or any other sensor) in a bayesian sensor configuration.
Hey mmiller7, Thank you for this great explanation!
Just wondering.
As mentioned some devices like iPhone likes to go sleep and can then appair away.
Can this be overridden by setting a shorter maximum lease time?
Then the device might be forces to wake up to re-lease the address? Anyone know?
Hey everyone! Iāve put together a new integration for pfSense which device_tracker support among other things. No need for fauxapi.