mDNS-SD event when record changes

I am trying to implement a driver for a switch device which publishes its current state (on/off) in a TXT mDNS-SD record. I.e. when discovery is requested it publishes its mDNS-SD record including the TXT with its current state, but it also proactively publishes a new mDNS-SD record whenever the state changed. I’d like to use this to ensure my device state in Homey is up to date (especially if it changed outside of Homey).

Overall mDNS-SD support built-in to Homey discovery works well with the device. I can successfully use it for initial pairing and in my device onDiscoveryResult, onDiscoveryAvailable work fine; as documented though, onDiscoveryAvailable only gets called once upon first discovery/initialization.

Is there any way in the built-in mDNS-SD support where my App/Driver/Device can be notified/any event I can subscribe to when the mDNS-SD record changed?

I could probably build something myself based on multicast-dns but would prefer to make use of the built-in mDNS-SD support if it can do this.

Have you tried using the onDiscoveryAddressChanged and onDiscoveryLastSeenChanged methods to see if they get triggered?

Yes, I have defined a onDiscoveryAddressChanged and onDiscoveryLastSeenChanged, but they do not appear to be triggered when that TXT record changes.

Which makes sense I suppose, onDiscoveryAddressChanged should only trigger if the same device is seen again with a new IP.

Not entirely sure how onDiscoveryLastSeenChanged is supposed to behave. Documentation says:

This method is called when the device has been found again.

Which is somewhat vague. “found again” does that mean is first had to be lost (i.e. the device was not seen for quite a while, considered to be offline and then it popped up again)? Which unfortunately would not directly help in my situation. Or is a “found again” simply “seen again” (with or without any modified records)? That would be exactly what I need, but it does not appear to work in practice then.

I agree it’s vague.

If none of the methods are triggered, it’s probably not possible to do this with the built-in discovery system, which is really intended for discovery only and not for state updates.