Units
Definiton
API Payload
Class
class SiUnit:
"""
A class used to represent International System of Units (SI) in Altergo
...
Attributes
----------
id : str
The unique identifier of the SI unit
name : str
The name of the SI unit
created_at : datetime
The date and time when the SI unit was created
updated_at : datetime
The date and time when the SI unit was last updated
"""
id: Optional[str] = None
name: Optional[str] = None
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
Setup
#Altergo parameters to connect with Client
ALTERGO_FACTORY_API= 'https://altergo.io/' #Default Factory API
ALTERGO_IOT_API= 'https://iot.altergo.io/' #Default IOT API
apiKey = "Your API KEY" #API key of the client
model_name='KB Demo' #Blueprint from which assset is made
serial_number='KB Demo_1'#Unique serial number to identify asset
info
API keys are user bound
from altergo_sdk.models.v2 import SiUnit
altergoApiKey = apiKey
_client = {
"apiKey": altergoApiKey,
"factory_api": ALTERGO_FACTORY_API,
"iot_api":ALTERGO_IOT_API
}
altergoApi = Client(**_client)
Create
To create a new SI Unit and add it to the platform, you will need to instanciate a SIUnit object and use the createSiUnit method
si_unit_of_temperature = '°C' # Symbol you want to be displayed for the unit
newSiUnitTemperature = SiUnit()
newSiUnitTemperature.name = si_unit_of_temperature
createdSiUnitTemperature = newAltergoClient.createSiUnit(
newSiUnit=newSiUnitTemperature
)
info
Unit name are usually the symbol for the unit. As seen in the example