I was looking at this
Does anyone know if there is a way to find know devices using pfsense router as a device tracker in Home Assistant? My network is using a pfsense router and not a normal big name company router?
I was looking at this
Does anyone know if there is a way to find know devices using pfsense router as a device tracker in Home Assistant? My network is using a pfsense router and not a normal big name company router?
Use Nmap or ping. Neither actually use the router, instead they probe your network to see what is responding.
Below is my setup for reference. Works well for me.
https://github.com/SilvrrGIT/HomeAssistant/blob/master/device_tracker.yaml
This is all new to me and thanks for the help!.
@silvrr I was looking at your .yaml files in github, are these crated by you or does HASS create these and link them with the links to the configuration.yaml. Like i said im new to this but kind of trying to understand the process of creating the configurations. I dont ahve anything outside my cell phones and a couple of PCâs to actually use. I currently am in the process of moving into a new house in the next 15 days and wanted to kind of get my Home Assistant server setup. with the essentials that matter right now. I was just wondering about the config.yaml and how to actual set it up for what i may use at first. I really like how you structured yours but wanted to know if it was how HASS did it or if you mapped the configs to the yamls your self?
I use the !include option to split up my files and you have to set it up that way, hass wonât do it automatically. After awhile with having everything in the main configurtation file it was getting to big and was difficult to navigate.
If you look at my main configuration.yaml file there is a section labled as âlinks to individual configuration filesâ which then allows the main configuration.yaml file to reference the other files by using the !include option.
If you are just getting started everything can go in the one file.
I have a PFSENSE too. nmap works perfect with it. this is my config if you want to copy it.
The range of ip addresses I have is given by the dhcp server in PFSENSE. You need to change yours obviously.
- platform: nmap_tracker
hosts: 192.168.254.150-239
home_iterval: 1
options: = "-sS --privileged --host-timeout 5s"
interval_seconds: 30
consider_home: 300
Thanks to you both for the info. I got it setup and working.
Anyone interested in testing a pfSense device tracker I am working on? Everything seems to work fine for me, but would like a few more testers before I submit the pull request.
I´m willing to test it
I can also test.
I can test also.
@Supersonical @quasar66 @silvrr Awesome thanks!
So a little back story for what I tried just in case you are wondering why I am doing it the way I am. I am currently making a device tracker for Unifi access points as wel (no Unifi controller required)l. That device tracker connects to the AP via SSH and pulls some JSON with all of the devices currently connected. So I figured I would do the same thing and SSH over to my pfSense box and pull the arp table from it. Well that didnât work for some reason, I think because of the prompt that pfSense brings you to when you first login? So after thinking for a few minutes I found out pfSense has cURL installed and Cron. Which lead me to this methodâŚ
prerequisites that must be performed on the pfSense system.
The command in the screenshot is as follows. Make sure to replace the IP address with your HA boxes IP address.
/usr/sbin/arp -a > /root/arp.tmp && /usr/local/bin/curl -X POST -F 'data=@/root/arp.tmp' http://192.168.5.5:8123/api/pfsense
This will dump the contents of the ARP table every minute to a file called arp.tmp and then upload that file to the endpoint http://192.168.5.5:8123/api/pfsense
Now, for the Home Assistant side of things.
device_tracker:
- platform: pfsense
You should end up with all the clients connected to your pfSense box (via ethernet for sure maybe others�)
If you get everything running and still arenât seeing devices, you can turn on debug logging and get some helpful output. You should see newly connected devices show up within 1 minute and they will drop off whenever they expire from the arp table. I am not sure what the default for that value is, but I am sure it can be configured in pfSense.
If you have checked everything and still donât see devices send me the output of your arp -a
command on your pfSense box via a PM or sanitize the sensitive stuff out and reply here.
I created the folder like below, is that correct?
â/home/username/.homeassistant/custom_components/device_tracker/pfsense.pyâ
FYI, I´m running SSL, should i set the cron adress to https:// ?
I can see that data is being added to arp.tmp
I´m not seeing anything in HA gui right now.
Thanks!
If you are running SSL via Home Assistants settings yes it should be https://. I for example am running HA non-SSL but have nginx doing my SSL for external access. Internally I can access http.
The folder/path looks correct.
I´m doing something wrong, I cannot see anything in the logs besides
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.loader] Loaded device_tracker.pfsense from custom_components.device_tracker.pfsense
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.pfsense
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=name=all devices, visible=False, object_id=all_devices, entities=[âdevice_tracker.volvo_kox342â, âdevice_tracker.iphoneâ], service=set, domain=group, service_call_id=140462976928624-1>
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=group.all_devices, old_state=None, new_state=<state group.all_devices=unknown; auto=True, friendly_name=all devices, order=5, hidden=True, entity_id=(âdevice_tracker.volvo_kox342â, âdevice_tracker.iphoneâ), assumed_state=False @ 2017-11-06T19:28:33.815941+01:00>>
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=140462976928624-1>
2017-11-06 19:28:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=see, domain=device_tracker>
The good thing is it doesnât look like it is blowing up.
Can you enabled debug for pfsense?
logger:
default: warning
logs:
homeassistant.components.device_tracker.pfsense: debug
And see if you get anything else? You could also post some screenshots of your pfsense cron entry, or try executing the curl command manually from the terminal in pfsense to see if it is failing?
This is what i get from Pfsense shell
curl: (52) Empty reply from server
the log is empty seems their is no warnings only errors
So I did a little research on that error and one thing they mentioned was issuing an http command to a server running https can cause it. Did you change the call from http to https?
yes
/usr/sbin/arp -a > /root/arp.tmp && /usr/local/bin/curl -X POST -F âdata=@/root/arp.tmpâ https://10.10.2.188:8123/api/pfsense
Hmmmm Iâll try pointing mine to the SSL endpoint and see what happens. Do you have anything âbetweenâ pfsense and the box running HA? A firewall or proxy or something?