Edge driver - programmatically set a preferences field?

Hi all,

I’ve written an Edge LAN driver for an appliance and have a discovery mechanism working for it which scans the network and creates a device for the discovered appliance - great so far.

I want to store the IP address (and possibly other settable properties of the discovered device) in the device properties such that the user can later go and view/change them, like if the IP changes after a reboot, or they want to view/change the appliance’s screen brightness.

However, I’ve not been able to do this - I’ve tried setting the preferences string (containing the IP for the discovered device in an appropriate field) in the metadata passed to try_create_device(metadata)

I‘ve also tried later setting it by calling device:try_update_metadata({ preferences = pref_json }) but neither of those end up setting the preference value, such that when I open the settings page in the app, the fields are all still blank (the default).

How can I set values for preferences on discovery, but still allow the user to go view/change them later?

If preferences are not programmatically settable, how else can I achieve the desired capability?

Thanks,

John

Preferences cannot be changed from the driver, only manually by the user.

You’ll have to create custom capabilities instead if you want to have the values in sync. Or use standard capabilities when it makes sense, for instance for the screen brightness. Or the Mode capability.

OK, thanks for the explanation, stops me wasting more time trying to get it working!