Closed o0shojo0o closed 1 week ago
I'm on HA 2024.10.1 - OPNsense 24.7.5_3, sensor working fine:
I use the ISC DHCPv4
Dennis, could you please enable debug log on the integration and reload the integration, then attach it here so @Snuffy2 can take a look. Thanks.
I think this is due to my MAC assignments without an IP address
I think this is due to my MAC assignments without an IP address
I don't understand: you use DHCP without assigning IPs?
This allows you to link the MAC to a name.
You do that for Firewall rules? Couldn't you use Aliases for that?
I do it so that the name and not just the MAC appears in the analysis tools and Adguard
Reverse DNS lookups don't work? I use AGH and hostnames are resolved fine through reverse DNS lookups.
@Snuffy2 if the IP address field is empty, it shouldn't be counted as a lease.
Are there entries without an IP currently showing/being counted?
Are there entries without an IP currently showing/being counted?
Sorry: counted = processed
. An error is being thrown in HA (get_dhcp_leases), check OP.
I see this in the code:
for if_subnet in sorted_leases.values():
sorted_if: list = sorted(
if_subnet, key=lambda x: normalize_ip(x["address"])
)
if_subnet: list = sorted_if
What happens if address is None
?
Gotcha. Sorry, looking on a phone and missed the error in the OP. Yeah I'll handle if no IP. Does it still count as a lease then?
Also, Kea does not currently show whether a lease is static or dynamic. ISC does/did. I wanted to show this in the attributes but for Kea will need to also pull in the reservation list separately and merge.
Does it still count as a lease then?
No it doesn't. And if you ask me, a proper DHCP implementation shouldn't allow an empty IP address. I would have to look to the RFC to be sure, but a DHCP service main purpose is to assign IP addresses, having an empty IP makes no sense to me.
Also, Kea does not currently show whether a lease is static or dynamic. ISC does/did.
If I interpret the docs correctly, the Leases DHCPv4
should only contain dynamic leases.
Well the Kea Leases page and the Kea API definitely return active static leases as well as the active dynamic ones.
Well the Kea Leases page and the Kea API definitely return active static leases as well as the active dynamic ones.
I just migrated from ISC DHCP to ISC Kea (migrated all static leases through this tool), and you're right, the official docs are wrong: that page shows every kind of lease, without a column distinguishing static/dynamic.
What about the REST API? Is there a type field in the json?
Nope. As I said, I'd have to also pull in the reservation list separately and merge them together. Examples of each dhcp entry type are currently as comments in pyopnsense/init.py around line 700.
I'm wondering if the info is there but just not in the REST API, might be worth asking OPNsense devs in that case.
What happened?
The new "DHCP Leases All" sensor has no data
hass-opnsense Version
v0.3.5-beta.1
OPNsense Firmware
24.7.5_3
Home Assistant Version
2024.10.0
Relevant logs
Additional Details
I use the ISC DHCPv4