Display Asset in Maps
GPS Coordinates
The Kelvin UI can display the Assets on the global map in the Operations Overview page.
To do this go to the parent Asset and add child Assets by using the longitude and latitude keys in the array under the properties key of the Asset.
Note
The examples here are for creating an Asset. You can also add these properties when updating an Asset.
You can only see the Asset's location in the Operations Overview map.
The parameters are not shown and are not editable in the Kelvin UI.
Adding properties will not work in the built-in Swagger tool provided by Kelvin. If you need to add properties, then you will need to use a different API client or use curl.
curl -X "POST" \
"https://<url.kelvin.ai>/api/v4/assets/create" \
-H "Authorization: Bearer <Your Current Token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "doc_demo_asset",
"title": "Documentation Demo Asset",
"asset_type_name": "pcp",
"properties": [
{
"name": "longitude",
"title": "Longitude",
"value": 37.78
},
{
"name": "latitude",
"title": "Latitude",
"value": -122.45
}
]
}'
The response will look like this;
{
"name":"doc_demo_asset",
"title":"Documentation Demo Asset",
"status":{
"state":"unknown",
"last_seen":null
},
"asset_type_name":"pcp",
"asset_type_title":"Doc Demo Asset",
"properties":[
{
"name": "longitude",
"title": "Longitude",
"value": 37.78
},
{
"name": "latitude",
"title": "Latitude",
"value": -122.45
}
],
"created":"2024-04-27T04:00:32.747852Z",
"updated":"2024-04-27T04:00:32.747852Z"
}
from kelvin.api.client import Client
# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")
# Create Asset
response = client.asset.create_asset(
data={
"name": "doc_demo_asset",
"title": "Documentation Demo Asset",
"asset_type_name": "pcp",
"properties": [
{
"name": "longitude",
"title": "Longitude",
"value": 37.78
},
{
"name": "latitude",
"title": "Latitude",
"value": -122.45
}
]
}
)
print(response)
You will get a response similar to this;
asset_type_name='pcp' asset_type_title='Progressing Cavity Pump' created=datetime.datetime(2024, 5, 23, 8, 52, 58, 422300, tzinfo=datetime.timezone.utc) name='doc_demo_asset' properties=[AssetProperty(name='longitude', title='Longitude', value='37.78'), AssetProperty(name='latitude', title='Latitude', value='-122.45')] status=AssetStatusItem(last_seen=None, state=<AssetState.unknown: 'unknown'>) title='Documentation Demo Asset' updated=datetime.datetime(2024, 5, 23, 8, 52, 58, 422300, tzinfo=datetime.timezone.utc)
Linked Assets
The Kelvin UI can visualize linked Assets by connecting them with a line on the global map in the Operations Overview page.
To do this go to the parent Asset and add child Assets by using the associated_assets keys in the array under the properties key of the Asset.
Note
The examples here are for creating an Asset. You can also add these properties when updating an Asset.
You can only see the Asset links in the Operations Overview map.
The parameters are not shown and are not editable in the Kelvin UI.
Adding properties will not work in the built-in Swagger tool provided by Kelvin. If you need to add properties, then you will need to use a different API client or use curl.
curl -X "POST" \
"https://<url.kelvin.ai>/api/v4/assets/create" \
-H "Authorization: Bearer <Your Current Token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "doc_demo_asset",
"title": "Documentation Demo Asset",
"asset_type_name": "pcp",
"properties": [
{
"name": "associated_assets",
"title": "Associated Assets",
"value": "plunger_lift_02,plunger_lift_03,plunger_lift_05"
}
]
}'
The response will look like this;
{
"name":"doc_demo_asset",
"title":"Documentation Demo Asset",
"status":{
"state":"unknown",
"last_seen":null
},
"asset_type_name":"pcp",
"asset_type_title":"Doc Demo Asset",
"properties":[
{
"name": "associated_assets",
"title": "Associated Assets",
"value": "plunger_lift_02,plunger_lift_03,plunger_lift_05"
}
],
"created":"2024-04-27T04:00:32.747852Z",
"updated":"2024-04-27T04:00:32.747852Z"
}
from kelvin.api.client import Client
# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")
# Create Asset
response = client.asset.create_asset(
data={
"name": "doc_demo_asset",
"title": "Documentation Demo Asset",
"asset_type_name": "pcp",
"properties": [
{
"name": "associated_assets",
"title": "Associated Assets",
"value": "plunger_lift_02,plunger_lift_03,plunger_lift_05"
}
]
}
)
print(response)
You will get a response similar to this;
asset_type_name='pcp' asset_type_title='Progressing Cavity Pump' created=datetime.datetime(2024, 5, 23, 8, 52, 58, 422300, tzinfo=datetime.timezone.utc) name='doc_demo_asset' properties=[AssetProperty(name='associated_assets', title='Associated Assets', value='plunger_lift_02,plunger_lift_03,plunger_lift_05')] status=AssetStatusItem(last_seen=None, state=<AssetState.unknown: 'unknown'>) title='Documentation Demo Asset' updated=datetime.datetime(2024, 5, 23, 8, 52, 58, 422300, tzinfo=datetime.timezone.utc)

