Hello Peter,
So while I didn’t fully digest the script you linked to, it was very helpful in working this issue out. What I did notice is any hostname with an underscore never made it into ‘/etc/unbound/dhcp-leases.conf’ which I believe is by design since it’s an invalid character.
By chance there was a Tasmota commit this week to avoid the invalidly generated hostnames:
https://github.com/arendst/Tasmota/commit/e039edde334541ecd4cfe50590f0e972180db114
Could you share your view on scenario where a hostname changes on a fixed lease? Seems the new hostname doesn’t automatically update DNS records, but maybe that’s by design.
And Thanks.