Skip to content

Asset Parameters

Asset Parameters can optionally be defined and accessed by Kelvin SmartApps™ in order to parameterize the assets to which Kelvin SmartApps™ has been deployed to. This use case is gonna be explained in the following section.

In order to support Asset Parameters, Kelvin SmartApps™ needs to define each parameter upon the app.yaml:

app:
  type: kelvin
  kelvin:

    parameters:
    - name: speed_decrease_set_point
      data_type: number
      default:
        value: 1000
      schema:
        title: "Speed Decrease SetPoint"
        minimum: 1000
        maximum: 3000
    - name: temperature_max_threshold
      data_type: number
      default:
        value: 75
      schema:
        title: "Temperature Max Threshold"
        minimum: 50
        maximum: 100
Where:

  • name: This will be used in the Python code to reference the input. It must contain only lowercase alphanumeric characters. The characters ., _ and - are allowed to separate words instead of a space BUT can not be at the beginning or end of the name.
  • data_type: number, boolean or string.
  • default: [optional] sets a default value that will be applied to each
  • schema: [optional] sets a title and/or its minimum and maximum value boundaries

This is how to access Asset Parameters:

  • assets Object

    Access a single Asset Parameter value directly from an assets Dictionary Object embedded within KelvinApp:

    import asyncio
    
    from kelvin.application import KelvinApp
    
    
    async def main() -> None:
        app = KelvinApp()
        await app.connect()
    
        (...)
    
        # Get Asset Parameter
        temperature_max_threshold = app.assets["my-motor-asset"].parameters["temperature_max_threshold"]
    

    Info

    app.assets will only be available after app.connect()

Asset Parameter updates can be done through the UI: