How to update a property of a device

Good morning

When creating a driver, you can set some properties (Drivers & Devices - Homey Apps SDK), but is there a way to update the value of these properties?

For example, can we update the device id that is being used in the documentation?

The use case I have is that I want to add properties that are not know when adding the device in the beginning.

In my code I’d like to add extra fields in my driver and update them in the device class. (Homey-Wemportal/driver.js at main · reyntjensw/Homey-Wemportal · GitHub)

No, you can’t add fields to data afterwards.

However, that field is only used to uniquely identify the device. I assume that when you first pair the device, the value you put it in (item.ID) is already unique. So there’s no need to add additional properties.

If you want to store additional information about your device at a later point, you can use setStoreValue or setSettings.

Basically, there are three “data stores” related to a device:

  • data: an immutable store (cannot be changed once the device is paired) used to uniquely identify the device
  • settings: a mutable store to store (user-changeable) settings information in (for example, an IP address of a device or login credentials)
  • store: a mutable store to store internal device information in (for instance, a login token)

Hi @robertklep

The store methode is the best for my use case, thanks a lot (again :slight_smile: )