Just ran into an issue I’m not sure what to do…
Let’s say I have an addon that I’m creating (ahem sony) and when I discover the device, the addon writes a bunch of default configuration options I get from the device. For this example, let’s say it’s the mac address of the device (the sony device has an api that returns the mac address and I write it to the configuration). The addon needs to know the mac address to send WOL packets correctly.
Now - the mac address is correct in about 95% of the cases but there are a few devices that return an incorrect mac address (not technically incorrect [it’s still a valid mac address] - it’s just the wrong mac address).
Because of that - I made the mac address a configuration option to allow the end user then to ‘correct’ the mac address to the correct one.
All great until the next discovery packet comes into the system - then I query the mac address, put the ‘incorrect’ mac address into the configuration and send the result. This will then, unfortunately, overwrite the ‘correct’ mac address that the user entered.
What would be the correct way of handling this? I don’t see anything in the config xml that would help but hoping someone might suggest something.
My latest thoughts is to write those variables that default from device but can be overwritten by the user as PROPERTIES instead. The addon would then check to see if a configuration has been set by the user and if not, fall back to the property value.