Recommendations
Recommendation Messages
Kelvin SmartApps™ can publish a Recommendation Message if the goal is to recommend one or more Control Changes to a given Asset. These will asyncronously reach the cloud and get to a state where they'll be pending user's Approval.
The Recommendation Object supports the following attributes:
| Attribute | Required | Description |
|---|---|---|
resource |
required | The KRNAsset that this Recommendation is meant for. |
type |
required | The Recommendation type (String). (e.g. speed_increase, speed_decrease, etc) |
expiration_date |
optional | Absolute datetime or a timedelta (from now) when the Control Change will expire. |
description |
optional | Detailed description for the Recommendation. |
confidence |
optional | Confidence of the recommendation (from 1 to 4). |
control_changes |
required | List of ControlChange Objects associated with the recommendation. |
metadata |
optional | Metadata for the recommendation. |
auto_accepted |
optional | Sets the Recommendation as auto accepted (Default is False). |
This is how they can be created and published:
from datetime import timedelta
from kelvin.application import KelvinApp
from kelvin.message import ControlChange, Recommendation
from kelvin.krn import KRNAssetDataStream, KRNAsset
(...)
# Create a Control Change
control_change = ControlChange(
resource=KRNAssetDataStream("my-motor-asset", "motor_speed_set_point"),
payload=1000,
expiration_date=timedelta(minutes=5)
)
# Create and Publish a Recommendation
await app.publish(
Recommendation(
resource=KRNAsset("my-motor-asset"),
type="decrease_speed",
control_changes=[control_change]
)
)