Skip to content

Asset Parameter

Asset Parameter Messages

Kelvin SmartApps™ can publish an Asset Parameter Message in order to (asynchronously) update a given Asset Parameter for a given Asset.

The Asset Parameter update will persist as soon as this message is synced with the Kelvin Cloud.

Note

A user can also change the Asset Parameter value through the Kelvin UI.

Any changes done automatically by an application will be updated on the Kelvin UI screen.

You can see the configuration options for a Kelvin SmartApp™ for an Asset in SmartApp section of the Kelvin UI.

The AssetParameter Object supports the following attributes:

Attribute Required Description
resource required The KRNAssetParameter that this update is meant for.
value required Asset Parameter value (Boolean, Integer, Float or String).
comment optional Detailed description of the Asset Parameter update.

Examples

Basic Usage

This is how they can be created and published in a Kelvin SmartApp™:

from datetime import timedelta, datetime

from kelvin.application import KelvinApp
from kelvin.message import AssetParameter
from kelvin.krn import KRNAssetParameter

(...)

# Create and Publish AssetParameter
await app.publish(
    AssetParameter(
        resource=KRNAssetParameter("my_asset", "my_parameter"),
        value=100,
        comment="reason why the parameter was updated"
    )
)

App to App Usage

Asset Parameters can also be automatically updated from one Kelvin SmartApp™ to another Kelvin SmartApp™.

There needs to be an Internet connection to the Kelvin Cloud even if both Kelvin SmartApps™ are deployed to the same Cluster.

In the Kelvin SmartApp™ program, it can produce an update Asset Parameter value(s) to another Kelvin SmartApp™ like this;

from kelvin.message import AssetParameters, AssetParameter
from kelvin.krn import KRNAppVersion

(...)

await app.publish(
  AssetParameters(
    parameters=[
      AssetParameter(resource=KRNAssetParameter(asset, "min_treshold"), value=0), 
      AssetParameter(resource=KRNAssetParameter(asset, "max_treshold"), value=50)
    ],
    resource=KRNAppVersion(target_app_name, "1.0.0")
  )
)