Custom Device Network Id (DNI) for Shelly device gets overwritten after clicking save preferences

This is something that i've noticed for a fairly long time now but I had always been running fairly old firmware on the Hubitat, so I assumed that could be the cause so never raised it. Now I am running the latest version (2.3.2.139) and the issue still exists.

When getting the Shelly devices to work correctly, we must change the Device Network Id (DNI) to the hex value of the IP address so that when the Shelly device updates the Hubitat with its state, the Hubitat knows what device it is for.

This works all good and well, except when you need to change one of the preferences. After clicking "Save Preferences" the preferences get saved and everything looks good on the page, but then whenever the Shelly tries to send Hubitat an update, we see in the logs "Received data from 10.10.130.11, no matching device found for 10.10.130.11, 0A0A820B, null for 0A0A820B".

Low and behold if you go and do a browser refresh the device page, it now shows the DNI being changed to something different. All I changed on the preferences was to disable the Description text logging.

Hoping the Hubitat team can fix this really annoying behaviour/bug.

@bobbyD Is this a known issue? Or something that might get fixed in the future?

Actually, it doesn't need to be the ip in hex, the dotted ip, or the mac address as well as the ip in hex all should work...
The shelly code queries the device for its mac address using the preference setting ip address, it then writes the received mac in the network dni....

Can you verify the MAC address for this device?

Ok thats good to know that it doesn't actually need to be the IP in hex.

The MAC address of the Shelly is 8CAAB574CE88 which is correct (and its the DNI that the device keeps getting reset to), however I think there appears to be an assumption in the built in driver that the Shelly is on the same subnet as the Hubitat.

So even though the logic is correct in that the mac address is dynamically discovered from the Shelly device itself, unfortunately because the Shelly is in a different subnet, when the packet is received by Hubitat it has the MAC address of the router, and hence it doesn't match the DNI.

Not sure how you want to tackle this @mike.maxwell ?? Would you detect in the driver that the Shelly is not in the same subnet as the Hub, and then use IP (or IP hex representation) instead of MAC for the DNI? Or do you give us, the users, a preference to specify when the Shelly is in another subnet, which will then mean that the default behaviour of discovering the MAC would be changed to using the supplied IP for the DNI.