Timeseries Data
Timeseries Data Messages
Output (Number/Boolean/String) Objects support the following attribute:
| Attribute | Required | Description |
|---|---|---|
payload |
required | Number, Boolean or String value, depending on the data_type |
In order to publish an output Data Message, the first requirement is to add the intended outputs to the app.yaml as follows:
app:
type: kelvin
kelvin:
outputs:
- data_type: number
name: motor_temperature_fahrenheit
- data_type: boolean
name: motor_error
- data_type: string
name: motor_error_description
Afterwards, the user needs to create and publish each output Data Message according to its data_type:
- Number:
from kelvin.message import Number
from kelvin.krn import KRNAssetDataStream
(...)
# Create and Publish a Number
await app.publish(
Number(resource=KRNAssetDataStream(asset, "motor_temperature_fahrenheit"), payload=97.3)
)
Boolean:
from kelvin.message import Boolean
from kelvin.krn import KRNAssetDataStream
(...)
# Create and Publish a Boolean
await app.publish(
Boolean(resource=KRNAssetDataStream(asset, "motor_error"), payload=True)
)
String:
from kelvin.message import String
from kelvin.krn import KRNAssetDataStream
(...)
# Create and Publish a String
await app.publish(
String(resource=KRNAssetDataStream(asset, "motor_error_description"), payload="Temperature is too high")
)