Hi,
I have a water tank sensor that tells me the water level in a tank (in cm). In my homey driver i want to translate this into the amount of water stored in the tank, so i need to multiply the height reported by the number of liters per cm of water (computed from the tank capacity and height when full). In order to do this i need to store an editable setting somewhere against the device that stores this conversion factor.
The way I implemented this is to define a device settings in the driver.settings.compose.json file - which then exposes this setting via the Homey GUI. When the setting is updated, in the onSettings method I then use the setStoreValue API to store these settings. When I receive a level update from the device I retrieve the conversion factor using the getStoreValue and then multiply the reported value and set a new capability to store the amount of water in the tank.
This works, but I don’t think that is the best way to do this - is there a better way?