Inputs have the following functions available to them:
-
self.set_custom_option(option, value), where option is a string, and value can be any JSON serializable variable type (dict, list, str, bool).
-
self.get_custom_option(option), where option is the string used with set_custom_option(). If there are no values found in the database for the option, None is returned.
You can see these functions used in the Anyleaf pH Input.
For building the capacity for the Input module to perform calibration, you can also reference the Anyleaf pH Input, where you can see a message, a numerical input, and three buttons are defined in the INPUT_INFORMATION dictionary:
Further down in the module you can see there are functions named after the id of each of these buttons, calibrate_slot_1(args_dict), calibrate_slot_2(args_dict), and calibrate_slot_3(args_dict). args_dict that is passed to these functions contains the value from the numerical input that was defined along with the buttons. This allows you to pass values from the user to the function that is executed when the user presses each button. In conjunction with the set and get functions, you can then store values in the database to be used later. In this example, a calibration is performed, the values are stored in the database, and these values are queried from the database the next time the Input is activated.
The Anyleaf pH Input probably has all the information you need to get your custom Input calibration working (in addition to the ADS1115 Input). Let me know if you have any other questions. If you develop a working Input, please share and I’ll add it to the built-in set.