I am running Home Assistant Core 2021.12.3. I added opnsense to my configuration.yaml just as the integration page instructs.
In the system info integration list, OPNSense shows up as being installed, but it does not appear on the integration page (even after checking the boxes to show ignored/disabled integrations).
My configuration shows that it is valid, and there are no messages in the log mentioning this integration.
I am guessing I did something wrong, but don’t know where to look to find out what. Are there extra more detailed logs than what shows up by clicking “Load Full Home Assistant Log”?
That is the correct behavior for integrations configured from yaml. Only integrations configured from GUI are shown there.
You should probably add the optional tracker_interfaces
configuration variable to have device tracker entities added.
Thank you. Probably not my brightest question, but I guess most of my integrations have been done through the GUI thus far.
I see the entities showing up now, even without adding tracker_interfaces
.
Do you know if it is expected that the device_tracker entities would simply be named by MAC address, and are not aware of hostnames (even in the entity attributes)? From what I could find about the OPNSense API, it is not capable of giving information on current DHCP leases (Port DHCPv4 leases page to MVC; fix #3095 by MichaelDeciso · Pull Request #3110 · opnsense/core · GitHub), so maybe the devices are found through some other means that does not offer hostname information?
The device trackers seem to be based on the ARP table.
The integration seems to have some hostname detection functionality, but I’m not sure how that works. The actual API requests are done by pyopnsense
. The hostname would have to be part of the result of get_arp
, and all that does is it parses the json output of the diagnostics/interface/getArp
API endpoint. I could not find any documentation on what exactly that endpoint should return, so I have no idea if there’s even a chance of the hostname detection working.
Thanks for that API call, using that I see that it returns the following for each device:
{
"mac"
"ip"
"intf"
"expired"
"expires"
"permanent"
"type"
"manufacturer"
"hostname"
"intf_description"
}
Most of the hostnames are blank though, it is only showing hostnames which seem to be reported by the devices, and all of the hostnames I have written in with static routes are not shown, which is a bummer.
It is interesting that while this API call returns IP addresses, they are not shown in the entity attributes.
That’s because the integration only cares about the manufacturer
. I guess you could implement ip
yourself quite easily.
Was thinking the same thing, might have a go at it.
FYI: you can find an OPNsense custom integration made by @travisghansen with all the bells and whistles here: OPNsense Integration - Third party integrations - Home Assistant Community (home-assistant.io)