Classes defined in Layrz SDK
There is the definition of all of our classes and enums in the Layrz SDK. With that, you can explore the possibilities of our Python functions for charts, reports, triggers and sensors.
Feel free to contact us at support@layrz.com if you have trouble understanding any of these classes or enums, or need assistance with anything else.
Ats
Classes
AtsEntry
| Attribute | Description | Field Type |
|---|---|---|
AtsEntry.pk | Defines the ID of the ATS entry | int |
AtsEntry.old_tank_level | Defines the old tank level in liters | float |
AtsEntry.new_tank_level | Defines the new tank level in liters | float |
AtsEntry.density | Density of the fuel in kg/m3 | float |
AtsEntry.temperature | Temperature of the fuel in Celsius | float |
AtsEntry.is_executed_by_command | Defines if the entry was executed by a command | bool |
Let's look an example:
from layrz_sdk.entities import AtsEntry
ats_entry = AtsEntry(
pk=1,
old_tank_level=1000.0,
new_tank_level=1200.0,
density=850.0,
temperature=20.0,
is_executed_by_command=True
)
ats_entry.pk
#> 1
ats_entry.old_tank_level
#> 1000.0
ats_entry.new_tank_level
#> 1200.0
ats_entry.density
#> 850.0
ats_entry.temperature
#> 20.0
ats_entry.is_executed_by_command
#> TrueAtsExitExecutionHistory
| Attribute | Description | Field Type |
|---|---|---|
AtsExitExecutionHistory.pk | Defines the ID of the ATS exit execution history | int |
AtsExitExecutionHistory.from_asset_id | Defines the ID of the asset from which the exit was executed | int |
AtsExitExecutionHistory.to_asset_id | Defines the ID of the asset to which the exit was executed | int |
AtsExitExecutionHistory.status | Defines the status of the exit execution | Literal['PENDING', 'FAILED', 'SUCCESS'] |
AtsExitExecutionHistory.from_app | Defines the ID of the app from which the exit was executed | Literal['ATSWEB', 'ATSMOBILE', 'NFC'] , none |
AtsExitExecutionHistory.error_response | Defines the error response of the exit execution, if any | str, none |
AtsExitExecutionHistory.generated_by_id | Defines the ID of the user who generated the exit execution | int |
AtsExitExecutionHistory.queue_id | Defines the ID of the queue in which the exit execution was placed | int , none |
AtsExitExecutionHistory.to_asset_mileage | Defines the mileage of the asset to which the exit was executed | float, none |
AtsExitExecutionHistory.created_at | Defines the date of creation of the exit execution | datetime |
AtsExitExecutionHistory.updated_at | Defines the date of last update of the exit execution | datetime |
Let's look an example:
from layrz_sdk.entities import AtsExitExecutionHistory
ats_exit_execution_history = AtsExitExecutionHistory(
pk=1,
from_asset_id=1,
to_asset_id=2,
status='SUCCESS',
from_app='ATSWEB',
error_response=None,
generated_by_id=1,
queue_id=None,
to_asset_mileage=1000.0,
created_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
updated_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
ats_exit_execution_history.pk
#> 1
ats_exit_execution_history.from_asset_id
#> 1
ats_exit_execution_history.to_asset_id
#> 2
ats_exit_execution_history.status
#> "SUCCESS"
ats_exit_execution_history.from_app
#> "ATSWEB"
ats_exit_execution_history.error_response
#> None
ats_exit_execution_history.generated_by_id
#> 1
ats_exit_execution_history.queue_id
#> None
ats_exit_execution_history.to_asset_mileage
#> 1000.0
ats_exit_execution_history.created_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_exit_execution_history.updated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)AtsOperation
| Attribute | Description | Field Type |
|---|---|---|
AtsOperation.pk | Defines the ID of the operation | int |
AtsOperation.purchased_at | Defines the purchase time of the operation | datetime |
AtsOperation.order_status | Defines the status of the operation | Literal['GENERATED', 'IN_TRANSIT', 'WAITING_TO_DISPATCH', 'DELIVERED', 'READY_TO_OPERATE', 'UNLOADING_OPERATION', UNLOADING_FUEL', 'UNLOADING_FUEL_INTERRUPTED', 'DESTINATION_BERTH_EXIT', 'ORIGIN_BERTH_EXIT'] |
AtsOperation.category | Defines the category of the operation | Literal['PICKUP', 'PICKUP_TO_SUPPLIER', 'TRANSFER', 'DELIVERY_TO_SUPPLIER', 'DELIVERY_TO_RESELLER', 'FOR_SALE_OUTSIDE', 'DELIVERY_TO_STORAGE', 'RETURN_FROM_STORAGE', 'NOT_DEFINED'] |
AtsOperation.deliver_category | Defines the deliver category of the operation | Literal['SAME_STATE', 'OTHER_STATE', 'NOT_DEFINED'] |
AtsOperation.seller_asset_id | Defines the ID of the seller asset associated with the operation | int |
AtsOperation.transport_asset_id | Defines the ID of the transport asset associated with the operation | int |
AtsOperation.finished_at | Defines the finished at of the operation | datetime , none |
AtsOperation.history | Defines the list of movements of the operation | AtsOperationMovement |
AtsOperation.purchase_orders | Defines the list of purchase orders associated with the operation | AtsPurchaseOrder |
Let's look an example:
from layrz_sdk.entities import AtsOperation
ats_operation = AtsOperation(
pk=1,
purchased_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
order_status='GENERATED',
category='PICKUP',
deliver_category='SAME_STATE',
seller_asset_id=1,
transport_asset_id=2,
history=[],
purchase_orders=[],
finished_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
ats_operation.pk
#> 1
ats_operation.purchased_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_operation.order_status
#> "GENERATED"
ats_operation.category
#> "PICKUP"
ats_operation.deliver_category
#> "SAME_STATE"
ats_operation.seller_asset_id
#> 1
ats_operation.transport_asset_id
#> 2
ats_operation.history
#> []
ats_operation.purchase_orders
#> []
ats_operation.finished_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)AtsOperationMovement
| Attribute | Description | Field Type |
|---|---|---|
AtsOperationMovement.pk | Defines the ID of the operation movement | int , none |
AtsOperationMovement.created_at | Defines the creation time of the operation movement | datetime , none |
AtsOperationMovement.status | Defines the status of the operation movement | Literal['GENERATED', 'IN_TRANSIT', 'WAITING_TO_DISPATCH', 'DELIVERED', 'READY_TO_OPERATE', 'UNLOADING_OPERATION', UNLOADING_FUEL', 'UNLOADING_FUEL_INTERRUPTED', 'DESTINATION_BERTH_EXIT', 'ORIGIN_BERTH_EXIT'] , none |
AtsOperationMovement.asset_id | Defines the ID of the asset associated with the operation movement | int , none |
AtsOperationMovement.operation_id | Defines the ID of the operation associated with the operation movement | int , none |
Let's look an example:
from layrz_sdk.entities import AtsOperationMovement
ats_operation_movement = AtsOperationMovement(
pk=1,
created_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
status='GENERATED',
asset_id=1,
operation_id=2,
)
ats_operation_movement.pk
#> 1
ats_operation_movement.created_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_operation_movement.status
#> "GENERATED"
ats_operation_movement.asset_id
#> 1
ats_operation_movement.operation_id
#> 2AtsPossibleEntry
| Attribute | Description | Field Type |
|---|---|---|
AtsPossibleEntry.initial_tank_level | Defines the initial tank level in liters | float |
AtsPossibleEntry.tank_accumulator | Defines the tank accumulator in liters | float |
AtsPossibleEntry.is_ready | Defines whether the entry is ready for processing | bool |
AtsPossibleEntry.is_validated | Defines whether the entry is validated | bool |
AtsPossibleEntry.start_at | Defines the start time of the entry | datetime |
AtsPossibleEntry.end_at | Defines the end time of the entry | datetime |
AtsPossibleEntry.accumulator_history | Defines the history of the tank accumulator | list[float] |
AtsPossibleEntry.is_recalculated | Defines whether the entry is recalculated | bool |
AtsPossibleEntry.is_blackbox | Defines whether the entry is a blackbox | bool |
AtsPossibleEntry.is_executed_by_command | Defines whether the entry is executed by command | bool |
AtsPossibleEntry.is_ready_by_reception | Defines whether the entry is ready by reception | bool, none |
AtsPossibleEntry.false_positive_count | Defines the count of false positive detections | int |
AtsPossibleEntry.reception_id | Defines the ID of the reception associated with the entry | int |
Let's look an example:
from layrz_sdk.entities import AtsPossibleEntry
ats_possible_entry = AtsPossibleEntry(
initial_tank_level=1000.0,
tank_accumulator=200.0,
is_ready=True,
is_validated=False,
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
accumulator_history=[1000.0, 1200.0, 1400.0],
is_recalculated=False,
is_blackbox=False,
is_executed_by_command=True,
is_ready_by_reception=None,
false_positive_count=0,
reception_id=1
)
ats_possible_entry.initial_tank_level
#> 1000.0
ats_possible_entry.tank_accumulator
#> 200.0
ats_possible_entry.is_ready
#> True
ats_possible_entry.is_validated
#> False
ats_possible_entry.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_possible_entry.end_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_possible_entry.accumulator_history
#> [1000.0, 1200.0, 1400.0]
ats_possible_entry.is_recalculated
#> False
ats_possible_entry.is_blackbox
#> False
ats_possible_entry.is_executed_by_command
#> True
ats_possible_entry.is_ready_by_reception
#> None
ats_possible_entry.false_positive_count
#> 0
ats_possible_entry.reception_id
#> 1AtsPossibleExit
| Attribute | Description | Field Type |
|---|---|---|
AtsPossibleExit.pk | Defines the primary key of the exit entry | int |
AtsPossibleExit.identifier | Defines the identifier of the exit entry | str, none |
AtsPossibleExit.initial_tank_volume | Defines the initial tank volume of the exit entry | float, none |
AtsPossibleExit.initial_fluxometer | Defines the initial fluxometer of the exit entry | float, none |
AtsPossibleExit.total_liters | Total liters of fuel involved in the exit | float |
AtsPossibleExit.is_ready | Defines if the exit entry is ready for processing | bool |
AtsPossibleExit.is_validated | Defines if the exit entry is validated | bool |
AtsPossibleExit.in_progress | Defines if the exit entry is in progress | bool |
AtsPossibleExit.start_at | Defines the start time of the exit entry | datetime |
AtsPossibleExit.end_at | Defines the end time of the exit entry | datetime, none |
AtsPossibleExit.is_recalculated | Defines if the exit entry is recalculated | bool |
AtsPossibleExit.is_blackbox | Defines if the exit entry is a blackbox | bool, none |
AtsPossibleExit.false_positive_count | Defines the count of false positive detections | int, none |
Let's look an example:
from layrz_sdk.entities import AtsPossibleExit
ats_possible_exit = AtsPossibleExit(
pk=1,
identifier="exit_001",
initial_tank_volume=1000.0,
initial_fluxometer=500.0,
total_liters=200.0,
is_ready=True,
is_validated=False,
in_progress=False,
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=None,
is_recalculated=False,
is_blackbox=None,
false_positive_count=0
)
ats_possible_exit.pk
#> 1
ats_possible_exit.identifier
#> "exit_001"
ats_possible_exit.initial_tank_volume
#> 1000.0
ats_possible_exit.initial_fluxometer
#> 500.0
ats_possible_exit.total_liters
#> 200.0
ats_possible_exit.is_ready
#> True
ats_possible_exit.is_validated
#> False
ats_possible_exit.in_progress
#> False
ats_possible_exit.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_possible_exit.end_at
#> None
ats_possible_exit.is_recalculated
#> False
ats_possible_exit.is_blackbox
#> None
ats_possible_exit.false_positive_count
#> 0AtsPurchaseOrder
| Attribute | Description | Field Type |
|---|---|---|
AtsPurchaseOrder.pk | Defines the ID of the purchase order | int |
AtsPurchaseOrder.purchased_at | Defines the purchase time of the purchase order | datetime |
AtsPurchaseOrder.order_status | Defines the status of the purchase order | Literal['GENERATED', 'IN_TRANSIT', 'WAITING_TO_DISPATCH', 'DELIVERED', 'READY_TO_OPERATE', 'UNLOADING_OPERATION', UNLOADING_FUEL', 'UNLOADING_FUEL_INTERRUPTED', 'DESTINATION_BERTH_EXIT', 'ORIGIN_BERTH_EXIT'] |
AtsPurchaseOrder.order_id | Defines the order ID of the purchase order | int |
AtsPurchaseOrder.category | Defines the category of the purchase order | Literal['PICKUP', 'PICKUP_TO_SUPPLIER', 'TRANSFER', 'DELIVERY_TO_SUPPLIER', 'DELIVERY_TO_RESELLER', 'FOR_SALE_OUTSIDE', 'DELIVERY_TO_STORAGE', 'RETURN_FROM_STORAGE', 'NOT_DEFINED'] |
AtsPurchaseOrder.deliver_category | Defines the deliver category of the purchase order | Literal['SAME_STATE', 'OTHER_STATE', 'NOT_DEFINED'] |
AtsPurchaseOrder.seller_asset_id | Defines the ID of the seller asset associated with the purchase order | int |
AtsPurchaseOrder.transport_asset_id | Defines the ID of the transport asset associated with the purchase order | int , none |
AtsPurchaseOrder.asset_id | Defines the ID of the asset associated with the purchase order | int |
AtsPurchaseOrder.delivered_at | Defines the deliver time of the purchase order | datetime , none |
AtsPurchaseOrder.eta | Defines the ETA of the purchase order | datetime, none |
AtsPurchaseOrder.eta_updated_at | Defines the ETA last updated of the purchase order | datetime, none |
AtsPurchaseOrder.invoice_type | Defines the invoice type of the purchase order | Literal['NFe', 'CTe'] |
AtsPurchaseOrder.operation_id | Defines the ID of the operation associated with the purchase order | int, none |
AtsPurchaseOrder.products_information | Defines the products information | list[dict[str, Any]] |
AtsPurchaseOrder.seller_asset | Defines the seller asset | Asset |
AtsPurchaseOrder.transport_asset | Defines the transport asset | Asset |
AtsPurchaseOrder.asset | Defines the asset (destination) | Asset |
Let's look an example:
from layrz_sdk.entities import AtsPurchaseOrder
ats_purchaseorder = AtsPurchaseOrder(
pk=1,
purchased_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
order_status='GENERATED',
order_id=5555,
category='PICKUP',
deliver_category='SAME_STATE',
seller_asset_id=1,
transport_asset_id=2,
asset_id=3,
delivered_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
eta=datetime.datetime.now(tz=ZoneInfo('UTC')),
eta_updated_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
invoice_type='NFe',
operation_id=1,
products_information=[
{
"ncm": "27101921",
"cfop": "5656",
"name": "OLEO DIESEL B S10-ADITIVADO - ONU1202 CL3 N.30(ANP 820101033) Reg.627",
"quantity": "20000.0000",
"unit_value": "5.43",
"subcategory": {
"pBio": "15.0000",
"UFCons": "MT",
"descANP": "ÓLEO DIESEL B S10 - ADITIVADO",
"cProdANP": "820101033",
"origComb": {
"pOrig": "100.0000",
"cUFOrig": "51",
"indImport": "0"
}
},
"measure_unit": "L",
"product_value": "108600.00"
}
],
seller_asset=Asset(pk=1, name='Seller asset', operation_mode='DISCONNECTED'),
transport_asset=Asset(pk=2, name='Transport asset', operation_mode='DISCONNECTED'),
asset=Asset(pk=3, name='My asset', operation_mode='DISCONNECTED')
)
ats_purchaseorder.pk
#> 1
ats_purchaseorder.purchased_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_purchaseorder.order_status
#> "GENERATED"
ats_purchaseorder.order_id
#> 5555
ats_purchaseorder.category
#> "PICKUP"
ats_purchaseorder.deliver_category
#> "SAME_STATE"
ats_purchaseorder.seller_asset_id
#> 1
ats_purchaseorder.transport_asset_id
#> 2
ats_purchaseorder.asset_id
#> 3
ats_purchaseorder.delivered_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_purchaseorder.eta
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_purchaseorder.eta_updated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_purchaseorder.invoice_type
#> "NFe"
ats_purchaseorder.operation_id
#> 1
ats_purchaseorder.products_information
#> []
ats_purchaseorder.seller_asset
#> Asset(pk=1, name='Seller asset', operation_mode='DISCONNECTED')
ats_purchaseorder.transport_asset
#> Asset(pk=2, name='Transport asset', operation_mode='DISCONNECTED')
ats_purchaseorder.asset
#> Asset(pk=3, name='My asset', operation_mode='DISCONNECTED')AtsReception
| Attribute | Description | Field Type |
|---|---|---|
AtsReception.pk | Defines the primary key of the reception | int |
AtsReception.real_volume | Defines the real volume of the reception | float, none |
AtsReception.received_at | Defines the received time of the reception | datetime |
AtsReception.fuel_type | Defines the fuel type of the reception | str |
AtsReception.is_merged | Defines if the reception is merged | bool |
AtsReception.order_id | Defines the order ID of the reception | int, none |
Let's look an example:
from layrz_sdk.entities import AtsReception
ats_reception = AtsReception(
pk=1,
real_volume=1000.0,
received_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
fuel_type="Diesel",
is_merged=False,
order_id=None
)
ats_reception.pk
#> 1
ats_reception.real_volume
#> 1000.0
ats_reception.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
ats_reception.fuel_type
#> "Diesel"
ats_reception.is_merged
#> False
ats_reception.order_id
#> NoneActions
Enums
ActionGeofenceOwnership
| Attribute | Description |
|---|---|
ActionGeofenceOwnership.NONE | Not assigned to any owner (Orphan) |
ActionGeofenceOwnership.ASSET | Assigns the geofence to the owner of the asset |
ActionGeofenceOwnership.ACTION | Assigns the geofence to the owner of the action |
ActionKind
| Attribute | Description |
|---|---|
ActionKind.LINK | Links or unkinks an asset or device to the parent asset |
ActionKind.PERFORM_OPERATION | Performs an operation over the activation |
ActionKind.SEND_TO_OUTBOUND | Sends the action to the outbound service |
ActionKind.PERFORM_COMMAND | Performs a command over the activation |
ActionKind.TO_MONITOR_CENTER | Sends the action to the monitor center |
ActionKind.TO_CHECKPOINT_ROUTE | Sends the action to the checkpoint route |
ActionKind.CORE_PROCESS | Core process of the action |
ActionKind.CREATE_GEOFENCE | Creates a geofence for the action |
ActionKind.PURCHASE_ORDER_STATUS | Updates the purchase order status |
ActionKind.EXCHANGE | Sends the activation to the exchange service |
ActionSubKind
| Attribute | Description |
|---|---|
ActionSubKind.LINK | Link asset or user to the parent asset |
ActionSubKind.UNUSED | Unused action sub kind, not linked to any action kind |
ActionSubKind.UNLINK | Unlink asset or user from the parent asset |
ActionSubKind.BOTH | Link and unlink asset or user to the parent asset |
Classes
Action
| Attribute | Description | Field Type |
|---|---|---|
Action.pk | Defines the ID of the action | int |
Action.name | Defines the name of the action | str |
Action.command_id | Defines the ID of the command associated with the action | int, none |
Action.subkind | Defines the subkind of the action | ActionSubKind |
Action.wait_for_image | Whether to wait for an image to be taken before executing the action | bool |
Action.geofence_category | Defines the category of the geofence associated with the action | GeofenceCategory |
Action.geofence_name_formula | Defines the name formula of the geofence associated with the action | str |
Action.geofence_radius | Defines the radius of the geofence associated with the action | float , none |
Action.mappit_route_id | Route ID for Mappit integration | int, none |
Action.new_geofence_ownership | Defines the new ownership of the geofence associated with the action | ActionGeofenceOwnership |
Let's look an example:
from layrz_sdk.entities import Action
action = Action(
pk=1,
name="My Action",
command_id=None,
subkind=ActionSubKind.LINK,
wait_for_image=True,
geofence_category=GeofenceCategory.POLYGON,
geofence_name_formula="My Geofence",
geofence_radius=100.0,
mappit_route_id=None,
new_geofence_ownership=ActionGeofenceOwnership.ASSET
)
action.pk
#> 1
action.name
#> "My Action"
action.command_id
#> None
action.subkind
#> ActionSubKind.LINK
action.wait_for_image
#> True
action.geofence_category
#> GeofenceCategory.POLYGON
action.geofence_name_formula
#> "My Geofence"
action.geofence_radius
#> 100.0
action.mappit_route_id
#> None
action.new_geofence_ownership
#> ActionGeofenceOwnership.ASSETBroadcasts
Enums
BroadcastStatus
| Attribute | Description |
|---|---|
BroadcastStatus.OK | The message was sent successfully |
BroadcastStatus.BADREQUEST | The message was sent but was rejected by the service |
BroadcastStatus.INTERNALERROR | The message cannot be send due a internal error |
BroadcastStatus.UNAUTHORIZED | The message cannot be send due an issue with credentials or service is down |
BroadcastStatus.UNPROCESSABLE | The message was sent but was rejected by the service (Unexpected rejection) |
BroadcastStatus.DISCONNECTED | The message was sent successfully and performed a disconnection procedure |
Classes
BroadcastRequest
| Attribute | Description | Field Type |
|---|---|---|
BroadcastRequest.parsed | Defines the JSON data sent to the service | dict |
BroadcastRequest.raw | Defines the raw data sent to the service | str |
Let's look an example:
from layrz_sdk.entities.broadcast import BroadcastRequest
broadcast_request = BroadcastRequest(
parsed={"key1": "value1", "key2": "value2"},
raw="My raw content"
)
broadcast_request.parsed
#> {"key1": "value1", "key2": "value2"}
broadcast_request.raw
#> "My raw content"BroadcastResponse
| Attribute | Description | Field Type |
|---|---|---|
BroadcastResponse.parsed | Defines the JSON structure of the service's response | dict |
BroadcastResponse.raw | Defines the raw data of the service's response | str |
Let's look an example:
from layrz_sdk.entities.broadcast import BroadcastResponse
broadcast_response = BroadcastResponse(
parsed={"key1": "value1", "key2": "value2"},
raw="My raw content"
)
broadcast_response.parsed
#> {"key1": "value1", "key2": "value2"}
broadcast_response.raw
#> "My raw content"BroadcastResult
| Attribute | Description | Field Type |
|---|---|---|
BroadcastResult.service_id | It's the ID of the outbound service | int |
BroadcastResult.asset_id | It's the ID of the asset | int |
BroadcastResult.status | Defines the status of the submission | BroadcastStatus |
BroadcastResult.request | Defines the data sent to the service | BroadcastRequest |
BroadcastResult.response | Defines the response of the service | BroadcastResponse |
BroadcastResult.submitted_at | Defines the date of the submission | datetime |
Let's look an example:
from layrz_sdk.entities.broadcast import BroadcastResult
broadcast_result = BroadcastResult(
service_id=1,
asset_id=1,
status=BroadcastStatus.OK,
request=BroadcastRequest(
parsed={"key1": "value1", "key2": "value2"},
raw="My raw content"
),
response=BroadcastResponse(
parsed={"key1": "value1", "key2": "value2"},
raw="My raw content"
),
submitted_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
broadcast_result.service_id
#> 1
broadcast_result.asset_id
#> 1
broadcast_result.status
#> "OK"
broadcast_result.request
#> BroadcastRequest(parsed={"key1": "value1", "key2": "value
broadcast_result.response
#> BroadcastResponse(parsed={"key1": "value1", "key2": "value
broadcast_result.submitted_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)BroadcastService
| Attribute | Description | Field Type |
|---|---|---|
BroadcastService.pk | Defines the ID of the service | int |
BroadcastService.name | Defines the name of the service | str |
BroadcastService.credentials | Defines the credentials of the service | dict[str, Any] |
Let's look an example:
from layrz_sdk.entities.broadcast import BroadcastService
broadcast_service = BroadcastService(
pk=1,
name="My Broadcast Service",
credentials={"key1": "value1", "key2": "value2"}
)
broadcast_service.pk
#> 1
broadcast_service.name
#> "My Broadcast Service"
broadcast_service.credentials
#> {"key1": "value1", "key2": "value2"}BroadcastPayload
| Attribute | Description | Field Type |
|---|---|---|
BroadcastPayload.asset | It's Asset object | Asset |
BroadcastPayload.primary_device | It's Primary device object | Device |
BroadcastPayload.trigger | Trigger object, if available | Trigger |
BroadcastPayload.message_id | It's the ID of the message | int, str |
BroadcastPayload.service | It's the ID of the service | BroadcastService |
BroadcastPayload.position | It's the position data, if available | dict[str, Any] |
BroadcastPayload.sensors | It's the sensor data, if available | dict[str, Any] |
BroadcastPayload.payload | It's the payload data, if available | dict[str, Any] |
BroadcastPayload.received_at | It's Broadcast payload received date | datetime |
Let's look an example:
from layrz_sdk.entities.broadcast import BroadcastPayload
broadcast_payload = BroadcastPayload(
asset=Asset(pk=1, name="My Asset"),
primary_device=Device(pk=1, name="My Device"),
trigger=Trigger(pk=1, name="My Trigger", code="my_trigger"),
message_id=1,
service=BroadcastService(pk=1, name="My Broadcast Service", credentials={"key1": "value1", "key2": "value2"}),
position={"x": 0, "y": 0},
sensors={"sensor1": 1, "sensor2": 2},
payload={"key1": "value1", "key2": "value2"},
received_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
broadcast_payload.asset
#> Asset(pk=1, name="My Asset")
broadcast_payload.primary_device
#> Device(pk=1, name="My Device")
broadcast_payload.trigger
#> Trigger(pk=1, name="My Trigger", code="my_trigger")
broadcast_payload.message_id
#> 1
broadcast_payload.service
#> BroadcastService(pk=1, name="My Broadcast Service", credentials={"key1": "value1", "key2": "value2"})
broadcast_payload.position
#> {"x": 0, "y": 0}
broadcast_payload.sensors
#> {"sensor1": 1, "sensor2": 2}
broadcast_payload.payload
#> {"key1": "value1", "key2": "value2"}
broadcast_payload.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)OutboundService
| Attribute | Description | Field Type |
|---|---|---|
OutboundService.pk | Defines the ID of the outbound service | int |
OutboundService.name | Defines the name of the outbound service | str |
OutboundService.protocol_name | Defines the protocol name of the outbound service | str, none |
OutboundService.mqtt_topic | Defines the MQTT topic of the outbound service | str, none |
OutboundService.is_consumpted | Defines if the outbound service is consumpted | bool |
OutboundService.credentials | Defines the credentials of the outbound service | dict[str, Any] |
Let's look an example:
from layrz_sdk.entities.broadcast import OutboundService
outbound_service = OutboundService(
pk=1,
name="My Outbound Service",
protocol_name="HTTP",
mqtt_topic="my/topic",
is_consumpted=False,
credentials={"key1": "value1", "key2": "value2"}
)
outbound_service.pk
#> 1
outbound_service.name
#> "My Outbound Service"
outbound_service.protocol_name
#> "HTTP"
outbound_service.mqtt_topic
#> "my/topic"
outbound_service.is_consumpted
#> False
outbound_service.credentials
#> {"key1": "value1", "key2": "value2"}ExchangeService
| Attribute | Description | Field Type |
|---|---|---|
ExchangeService.pk | Defines the ID of the exchange service | int |
ExchangeService.name | Defines the name of the exchange service | str |
ExchangeService.credentials | Defines the credentials of the exchange service | dict[str, Any] |
ExchangeService.protocol_id | Defines the protocol ID of the exchange service | int, none |
ExchangeService.flespi_token | Defines the Flespi token of the exchange service | str, none |
ExchangeService.owner_id | Defines the owner ID of the exchange service | int, none |
Let's look an example:
from layrz_sdk.entities.broadcast import ExchangeService
exchange_service = ExchangeService(
pk=1,
name="My Exchange Service",
credentials={"key1": "value1", "key2": "value2"},
protocol_id=None,
flespi_token=None,
owner_id=None
)
exchange_service.pk
#> 1
exchange_service.name
#> "My Exchange Service"
exchange_service.credentials
#> {"key1": "value1", "key2": "value2"}
exchange_service.protocol_id
#> None
exchange_service.flespi_token
#> None
exchange_service.owner_id
#> NoneCases
Enums
CaseIgnoredStatus
| Attribute | Description |
|---|---|
CaseIgnoredStatus.NORMAL | The case was closed normally. |
CaseIgnoredStatus.IGNORED | The case was ignored in our monitors |
CaseIgnoredStatus.PRESSET | The case was closed automatically by a preset |
CaseIgnoredStatus.AUTO | The case was closed automatically by a expiry time |
CaseStatus
| Attribute | Description |
|---|---|
CaseStatus.PENDING | The case is pending or waiting for attention |
CaseStatus.FOLLOWED | The case is in following state, or a user is currently following the case |
CaseStatus.CLOSED | The case was closed |
Classes
Case
| Attribute | Description | Datatype |
|---|---|---|
Case.pk | Case ID | int |
Case.trigger | Trigger that activated the case | Trigger |
Case.asset_id | ID of the asset associated with the case | int |
Case.opened_at | Case receipt date | datetime |
Case.closed_at | Case closing date | datetime |
Case.comments | List of case comments submitted | list[Comment] |
Case.status | Status of the case | CaseStatus |
Case.ignored_status | Ignored status of the case | CaseIgnoredStatus |
Case.sequence | Sequence of the case, This is a unique identifier for the case | int, str |
Let's look an example:
from layrz_sdk.entities import Case
case = Case(
pk=1,
asset_id=1,
trigger=Trigger(pk=1, name="My Trigger", code="my_trigger"),
comments=[
Comment(pk=1, content="My comment", user=User(pk=1, name="User"), submitted_at=datetime.datetime.now(tz=ZoneInfo('UTC'))),
Comment(pk=2, content="My second comment", user=User(pk=2, name="User"), submitted_at=datetime.datetime.now(tz=ZoneInfo('UTC')))
],
opened_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
close_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
status=CaseStatus.PENDING,
ignored_status=CaseIgnoredStatus.NORMAL,
sequence=1
)
case.pk
#> 1
case.asset_id
#> 1
case.trigger
#> Trigger(pk=1, name="My Trigger", code="my_trigger")
case.comments
#> [
Comment(pk=1, content="My comment", user=User(pk=1, name="User"), submitted_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)),
Comment(pk=2, content="My second comment", user=User(pk=2, name="User"), submitted_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>))
]
case.opened_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
case.closed_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
case.status
#> CaseStatus.PENDING
case.ignored_status
#> CaseIgnoredStatus.NORMAL
case.sequence
#> 1Comment
| Attribute | Description | Field Type |
|---|---|---|
Comment.pk | Comment ID | int |
Comment.content | Comment content | str |
Comment.user | User which sent the comment | User |
Comment.submitted_at | Comment date sent | datetime |
Let's look an example:
from layrzsdk.entities import Comment
comment = Comment(
pk=1,
content="My comment",
user=User(pk=1, name="User"),
submitted_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
comment.pk
#> 1
comment.content
#> "My comment"
comment.user
#> User(pk=1, name="User")
comment.submitted_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)Trigger
| Attribute | Description | Field Type |
|---|---|---|
Trigger.pk | Trigger ID | int |
Trigger.name | Trigger Name | str |
Trigger.code | Unique trigger code | str |
Trigger.cooldown_time | Trigger cooldown time | timedelta |
Trigger.type_ | Defines the kind of the trigger | TriggerKind |
Trigger.presence_type | Defines the geofence kind of the trigger | TriggerGeofenceKind |
Trigger.case_type | Defines the case kind of the trigger | TriggerCaseKind |
Trigger.case_comment_pattern | Defines the comment pattern of the trigger | TriggerCommentPattern |
Trigger.case_comment_value | Defines the comment pattern value of the trigger | str, none |
Trigger.exact_hour | Defines the exact hour of the trigger | time, none |
Trigger.crontab_format | Defines the crontab format of the trigger | str, none |
Trigger.weekdays | Defines the weekdays of the trigger | list[Weekday] |
Trigger.is_plain_crontab | Defines if the trigger is a plain crontab | bool |
Trigger.timezone_id | Defines the timezone ID of the trigger | int , none |
trigger.parameters | Defines the parameters of the trigger | list[str] |
Trigger.manual_action_fields | Defines the fields for manual action in the trigger | list[dict[str, Any]] |
Trigger.formula | Defines the formula of the trigger, this formula is only LCL (Layrz Computation Language) compatible | str, none |
Trigger.is_legacy | Defines if the trigger is legacy, normally when a version of the trigger is not compatible with the current version of the SDK | bool |
Trigger.priority | Defines the priority of the trigger | int |
Trigger.color | Defines the color of the trigger | str , none |
Trigger.sequence | Defines the sequence of the trigger | int |
Trigger.care_protocol_id | Defines the care protocol ID of the trigger | int, none |
Trigger.owner_id | Owner ID | int, none |
Trigger.search_time_delta | Defines the search time delta of the trigger | timedelta, none |
Let's look an example:
from layrz_sdk.entities import Trigger
trigger = Trigger(
pk=1,
name="My Trigger",
code="my_trigger",
cooldown_time=datetime.timedelta(seconds=60),
type_=TriggerKind.FORMULA,
presence_type=TriggerGeofenceKind.ENTRANCE,
case_type=TriggerCaseKind.ON_FOLLOW,
case_comment_pattern=TriggerCommentPattern.STARTS_WITH,
case_comment_value="important",
exact_hour=None,
crontab_format=None,
weekdays=[Weekday.MONDAY],
is_plain_crontab=False,
timezone_id=1,
parameters=['param1', 'param2'],
manual_action_fields=['field1', 'field2'],
formula=None,
is_legacy=False,
priority=1,
color=None,
sequence=1,
care_protocol_id=1,
owner_id=1,
search_time_delta=datetime.timedelta(minutes=5)
)
trigger.pk
#> 1
trigger.name
#> "My Trigger"
trigger.code
#> "my_trigger"
trigger.cooldown_time
#> datetime.timedelta(seconds=60)
trigger.type_
#> TriggerKind.FORMULA
trigger.presence_type
#> TriggerGeofenceKind.ENTRANCE
trigger.case_type
#> TriggerCaseKind.ON_FOLLOW
trigger.case_comment_pattern
#> TriggerCommentPattern.STARTS_WITH
trigger.case_comment_value
#> "important"
trigger.exact_hour
#> None
trigger.crontab_format
#> None
trigger.weekdays
#> [Weekday.MONDAY]
trigger.is_plain_crontab
#> False
trigger.timezone_id
#> 1
trigger.parameters
#> ['param1', 'param2']
trigger.manual_action_fields
#> ['field1', 'field2']
trigger.formula
#> None
trigger.is_legacy
#> False
trigger.priority
#> 1
trigger.color
#> None
trigger.sequence
#> 1
trigger.care_protocol_id
#> 1
trigger.owner_id
#> 1
trigger.search_time_delta
#> datetime.timedelta(minutes=5)Weekday
| Attribute | Description |
|---|---|
Weekday.MONDAY | Represents Monday |
Weekday.TUESDAY | Represents Tuesday |
Weekday.WEDNESDAY | Represents Wednesday |
Weekday.THURSDAY | Represents Thursday |
Weekday.FRIDAY | Represents Friday |
Weekday.SATURDAY | Represents Saturday |
Weekday.SUNDAY | Represents Sunday |
TriggerKind
| Attribute | Description |
|---|---|
TriggerKind.FORMULA | Trigger is a formula trigger |
TriggerKind.PRESENCE_IN_GEOFENCE | Trigger is a presence in geofence trigger |
TriggerKind.EXACT_TIME | Trigger is an exact time trigger |
TriggerKind.AUTHENTICATION | Trigger is an authentication trigger |
TriggerKind.PYTHON_SCRIPT | Trigger is a Python script trigger |
TriggerKind.CASES_CHANGES | Trigger is a cases changes trigger |
TriggerKind.BHS_SPEEDING | Trigger is a BHS speeding trigger |
TriggerKind.BHS_PRESENCE | Trigger is a BHS presence trigger |
TriggerKind.MANUAL_ACTION | Trigger is a manual action trigger |
TriggerKind.NESTED | Trigger is a nested trigger |
TriggerGeofenceKind
| Attribute | Description |
|---|---|
TriggerGeofenceKind.ENTRANCE | Trigger is an entrance geofence trigger |
TriggerGeofenceKind.EXIT | Trigger is an exit geofence trigger |
TriggerGeofenceKind.BOTH | Trigger is a both geofence trigger (entrance and exit) |
TriggerCaseKind
| Attribute | Description |
|---|---|
TriggerCaseKind.ON_FOLLOW | Trigger is activated on follow events |
TriggerCaseKind.ON_COMMENT_PATTERN | Trigger is activated on comment pattern events |
TriggerCaseKind.ON_DISMISS | Trigger is activated on dismiss events |
TriggerCaseKind.ON_CLOSE | Trigger is activated on close events |
TriggerCommentPattern
| Attribute | Description |
|---|---|
TriggerCommentPattern.STARTS_WITH | Trigger is activated when the comment starts with a specific pattern |
TriggerCommentPattern.CONTAINS | Trigger is activated when the comment contains a specific pattern |
TriggerCommentPattern.ENDS_WITH | Trigger is activated when the comment ends with a specific pattern |
Charts
Enums
ChartAlignment
| Attribute | Description |
|---|---|
ChartAlignment.LEFT | Align the chart to the left |
ChartAlignment.RIGHT | Align the chart to the right |
ChartAlignment.CENTER | Center the chart |
ChartColor
| Attribute | Description |
|---|---|
ChartColor.RED | Color the series red |
ChartColor.BLUE | Color the series blue |
ChartColor.GREEN | Color the series green |
ChartColor.PURPLE | Color the series purple |
ChartColor.ORANGE | Color the series orange |
ChartColor.PINK | Color the series pink |
ChartColor.TEAL | Color the series teal |
ChartColor.AMBER | Color the series amber |
ChartColor.CYAN | Color the series cyan |
ChartColor.INDIGO | Color the series indigo |
ChartColor.LIME | Color the series lime |
ChartDataSerieType
| Attribute | Description |
|---|---|
ChartDataSerieType.NONE | The serie type is not defined |
ChartDataSerieType.LINE | The serie type is a line |
ChartDataSerieType.AREA | The serie type is an area |
ChartDataSerieType.SCATTER | The serie type is a scatter |
ChartDataType
| Attribute | Description |
|---|---|
ChartDataType.STRING | Defines the data type as a string |
ChartDataType.DATETIME | Defines the data type as a datetime |
ChartDataType.NUMBER | Defines the data type as a number |
ChartRenderTechnology
| Attribute | Description |
|---|---|
ChartRenderTechnology.CANVAS_JS | Use CanvasJS to render the graphs. Exclusive for line charts |
ChartRenderTechnology.GRAPHIC | Use graphic to render the graphs |
ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTS | Use syncfusion_flutter_charts to render the graphs |
ChartRenderTechnology.FLUTTER_MAP | Use flutter_map to render the graphs |
ChartRenderTechnology.APEX_CHARTS | Use apex_charts to render the graphs. Exclusive for maps |
ChartRenderTechnology.FLUTTER | Use native flutter to render the graphs. Exclusive to number and table charts |
MapCenterType
| Attribute | Description |
|---|---|
MapCenterType.FIXED | Set the map center to a fixed point |
MapCenterType.CONTAIN | Set the map center dynamically to contain all points |
Classes
AreaChart
This class will be removed in the next version. Use LineChart instead.
| Attribute | Description | Field Type |
|---|---|---|
AreaChart.title | Defines the title of the chart | str |
AreaChart.align | Defines the alignment of the chart | ChartAlignment |
AreaChart.x_axis | Defines the X axis (Horizontal) | ChartDataSerie |
AreaChart.y_axis | Defines the Y Axis (Vertical) | list[ChartDataSerie] |
AreaChart.x_axis_config | Defines the configuration for the X Axis (Horizontal) | AxisConfig |
AreaChart.y_axis_config | Defines the configuration for the Y Axis (Vertical) | AxisConfig |
Let's look an example:
from layrz_sdk.entities import AreaChart, ChartDataType
area_chart = AreaChart(
title="My Area Chart",
align=ChartAlignment.LEFT,
x_axis=ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"]),
y_axis=[
ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])
],
x_axis_config=AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING),
y_axis_config=AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)
)
area_chart.title
#> "My Area Chart"
area_chart.align
#> "LEFT"
area_chart.x_axis
#> ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
area_chart.x_axis_config
#> AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING)
area_chart.y_axis
#> [ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])]
area_chart.y_axis_config
#> AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)AxisConfig
| Attribute | Description | Field Type |
|---|---|---|
AxisConfig.label | Label to display on the axis | str |
AxisConfig.measure_unit | Measure unit of the axis | str |
AxisConfig.min_value | Minimum value of the axis | float |
AxisConfig.max_value | Maximum value of the axis | float |
AxisConfig.data_type | Data type of the axis | ChartDataType |
Let's look at an example:
from layrz_sdk.entities import AxisConfig, ChartDataType
axis_config = AxisConfig(
label="My axis",
measure_unit="seconds (s)",
min_value=0.,
max_value=10.,
data_type=ChartDataType.DATETIME
)
axis_config.label
#> "My axis"
axis_config.measure_unit
#> "seconds (s)"
axis_config.min_value
#> 0.0
axis_config.max_value
#> 10.0
axis_config.data_type
#> "DATETIME"BarChart
| Attribute | Description | Field Type |
|---|---|---|
BarChart.title | Defines the title of the chart | str |
BarChart.align | Defines the alignment of the chart | ChartAlignment |
BarChart.x_axis | Defines the X axis (Horizontal) | ChartDataSerie |
BarChart.y_axis | Defines the Y Axis (Vertical) | list[ChartDataSerie] |
AreaChart.x_axis_config | Defines the configuration for the X Axis (Horizontal) | AxisConfig |
AreaChart.y_axis_config | Defines the configuration for the Y Axis (Vertical) | AxisConfig |
Let's look an example:
from layrz_sdk.entities import BarChart
bar_chart = BarChart(
title="My Bar Chart",
align=ChartAlignment.LEFT,
x_axis=ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"]),
y_axis=[
ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])
],
x_axis_config=AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING),
y_axis_config=AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)
)
bar_chart.title
#> "My Bar Chart"
bar_chart.align
#> "LEFT"
bar_chart.x_axis
#> ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
bar_chart.y_axis
#> [ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])]
bar_chart.x_axis_config
#> AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING)
bar_chart.y_axis_config
#> AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)ChartConfiguration
| Attribute | Description | Field Type |
|---|---|---|
ChartConfiguration.name | Defines the name of the chart | str |
ChartConfiguration.description | Defines the description of the chart | str |
Let's look an example:
from layrz_sdk.entities import ChartConfiguration
chart_configuration = ChartConfiguration(
name="My Chart Configuration",
description="My Chart Configuration Description"
)
chart_configuration.name
#> "My Chart Configuration"
chart_configuration.description
#> "My Chart Configuration Description"ChartDataSerie
| Attribute | Description | Field Type |
|---|---|---|
ChartDataSerie.data | List of data points | any |
ChartDataSerie.serie_type | Type of the serie. Only used for mixed range charts | ChartDataSerieType |
ChartDataSerie.dashed | If the serie should be dashed | bool |
ChartDataSerie.color | Color of the serie as a hexadecimal color code | str |
ChartDataSerie.label | Label of the serie | str |
ChartDataSerie.data_type | Type of the data | ChartDataType |
Let's look an example:
from layrz_sdk.entities import ChartDataSerie
chart_data_serie = ChartDataSerie(
data=[1, 2, 3],
serie_type=ChartDataSerieType.LINE,
dashed=True,
color="#ff0000",
label="My Serie",
data_type=ChartDataType.NUMBER
)
chart_data_serie.data
#> [1, 2, 3]
chart_data_serie.serie_type
#> "LINE"
chart_data_serie.dashed
#> True
chart_data_serie.color
#> "#ff0000"
chart_data_serie.label
#> "My Serie"
chart_data_serie.data_type
#> "NUMBER"ChartException
| Attribute | Description | Field Type |
|---|---|---|
ChartException.message | Defines an exception of the chart | str |
Inherits
This class inherits from the Python BaseException class, you can handle this exception as a regular Python exception with a try and except block.
Let's look an example:
from layrz_sdk.entities import ChartException
chart_exception = ChartException(
message="My Chart Exception"
)
chart_exception.message
#> "My Chart Exception"ColumnChart
| Attribute | Description | Field Type |
|---|---|---|
ColumnChart.title | Defines the title of the chart | str |
ColumnChart.align | Defines the alignment of the chart | ChartAlignment |
ColumnChart.x_axis | Defines the X axis (Horizontal) | ChartDataSerie |
ColumnChart.y_axis | Defines the Y Axis (Vertical) | list[ChartDataSerie] |
ColumnChart.x_axis_config | Defines the configuration for the X Axis (Horizontal) | AxisConfig |
ColumnChart.y_axis_config | Defines the configuration for the Y Axis (Vertical) | AxisConfig |
Let's look an example:
from layrz_sdk.entities import ColumnChart
column_chart = ColumnChart(
title="My Column Chart",
align=ChartAlignment.LEFT,
x_axis=ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"]),
y_axis=[
ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])
],
x_axis_config=AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING),
y_axis_config=AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)
)
column_chart.title
#> "My Column Chart"
column_chart.align
#> "LEFT"
column_chart.x_axis
#> ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
column_chart.y_axis
#> [ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])]
column_chart.x_axis_config
#> AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING)
column_chart.y_axis_config
#> AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)HTMLChart
| Attribute | Description | Field Type |
|---|---|---|
HTMLChart.title | Defines the title of the chart | str |
HTMLChart.content | Defines the content of the chart, this content should be HTML | str |
Let's look an example:
from layrz_sdk.entities import HTMLChart
html_chart = HTMLChart(
title="My HTML Chart",
content="<html><body><h1>My HTML Chart</h1></body></html>"
)
html_chart.title
#> "My HTML Chart"
html_chart.content
#> "<html><body><h1>My HTML Chart</h1></body></html>"LineChart
| Attribute | Description | Field Type |
|---|---|---|
LineChart.title | Defines the title of the chart | str |
LineChart.align | Defines the alignment of the chart | ChartAlignment |
LineChart.x_axis | Defines the X axis (Horizontal) | ChartDataSerie |
LineChart.y_axis | Defines the Y Axis (Vertical) | list[ChartDataSerie] |
LineChart.x_axis_config | Defines the configuration for the X Axis (Horizontal) | AxisConfig |
LineChart.y_axis_config | Defines the configuration for the Y Axis (Vertical) | AxisConfig |
Let's look an example:
from layrz_sdk.entities import LineChart
line_chart = LineChart(
title="My Line Chart",
align=ChartAlignment.LEFT,
x_axis=ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"]),
y_axis=[
ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])
],
x_axis_config=AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING),
y_axis_config=AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)
)
line_chart.title
#> "My Line Chart"
line_chart.align
#> "LEFT"
line_chart.x_axis
#> ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
line_chart.y_axis
#> [ChartDataSerie(name="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(name="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])]
line_chart.x_axis_config
#> AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING)
line_chart.y_axis_config
#> AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)MapChart
| Attribute | Description | Field Type |
|---|---|---|
MapChart.title | Defines the title of the chart | str |
MapChart.center | Defines where is the center of the map | MapCenterType |
MapChart.points | Defines the list of points to display | list[MapPoint] |
MapChart.center_latlng | Defines the fixed center of the map. This property only works when center is MapCenterType.FIXED. If a list is used, it should have a length of two | tuple[float, float] | list[float] |
Let's look an example:
from layrz_sdk.entities import MapChart
map_chart = MapChart(
title="My Map Chart",
align=ChartAlignment.LEFT,
center=MapCenterType.FIXED,
points=[
MapPoint(latitude=1.23, longitude=4.56, label="My Point", color="#ff0000"),
MapPoint(latitude=7.89, longitude=10.11, label="My Other Point", color="#00ff00")
],
center_latlng = (1.5, 0.5)
)
map_chart.title
#> "My Map Chart"
map_chart.align
#> "LEFT"
map_chart.center
#> "FIXED"
map_chart.points
#> [MapPoint(latitude=1.23, longitude=4.56, label="My Point", color="#ff0000"), MapPoint(latitude=7.89, longitude=10.11, label="My Other Point", color="#00ff00")]
map_chart.center_latlng
#> (1.5, 0.5)MapPoint
| Attribute | Description | Field Type |
|---|---|---|
MapPoint.latitude | Defines the latitude in decimal degrees | float |
MapPoint.longitude | Defines the longitude in decimal degrees | float |
MapPoint.label | Defines the label or name of the point | str |
MapPoint.color | Defines the color (In HEX) of the point | str |
Let's look an example:
from layrz_sdk.entities import MapPoint
map_point = MapPoint(
latitude=1.23,
longitude=4.56,
label="My Point",
color="#ff0000"
)
map_point.latitude
#> 1.23
map_point.longitude
#> 4.56
map_point.label
#> "My Point"
map_point.color
#> "#ff0000"NumberChart
| Attribute | Description | Field Type |
|---|---|---|
NumberChart.value | Defines the number to display | float |
NumberChart.color | Defines the color to display in hexadecimal code | str |
NumberChart.label | Defines the name or label to display | str |
Let's look an example:
from layrz_sdk.entities import NumberChart
number_chart = NumberChart(
value=1.23,
color="#ff0000",
label="My Number Chart"
)
number_chart.value
#> 1.23
number_chart.color
#> "#ff0000"
number_chart.label
#> "My Number Chart"PieChart
| Attribute | Description | Field Type |
|---|---|---|
PieChart.title | Defines the title of the chart | str |
PieChart.align | Defines the alignment of the chart | ChartAlignment |
PieChart.serie | Defines the series to display | list[ChartDataSerie] |
Let's look an example:
from layrz_sdk.entities import PieChart
pie_chart = PieChart(
title="My Pie Chart",
align=ChartAlignment.LEFT,
serie=[
ChartDataSerie(name="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(name="My Other Serie", type=ChartDataType.NUMBER, data=[4, 5, 6])
]
)
pie_chart.title
#> "My Pie Chart"
pie_chart.align
#> "LEFT"
pie_chart.serie
#> [ChartDataSerie(name="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(name="My Other Serie", type=ChartDataType.NUMBER, data=[4, 5, 6])]RadarChart
| Attribute | Description | Field Type |
|---|---|---|
RadarChart.title | Defines the title of the chart | str |
RadarChart.align | Defines the alignment of the chart | ChartAlignment |
RadarChart.x_axis | Defines the X axis (Horizontal) | ChartDataSerie |
RadarChart.y_axis | Defines the Y Axis (Vertical) | list[ChartDataSerie] |
Let's look an example:
from layrz_sdk.entities import RadarChart
radar_chart = RadarChart(
title="My Radar Chart",
align=ChartAlignment.LEFT,
x_axis=ChartDataSerie(label="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"],),
y_axis=[
ChartDataSerie(label="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(label="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])
]
)
radar_chart.title
#> "My Radar Chart"
radar_chart.align
#> "LEFT"
radar_chart.x_axis
#> ChartDataSerie(label="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
radar_chart.y_axis
#> [ChartDataSerie(label="My Y Axis", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(label="My Other Y Axis", type=ChartDataType.NUMBER, data=[4, 5, 6])]RadialBarChart
| Attribute | Description | Field Type |
|---|---|---|
RadialBarChart.title | Title of the chart | str |
RadialBarChart.align | Alignment of the chart | ChartAlignment |
RadialBarChart.serie | Defines the series of the chart, uses the ChartDataSerie class. | list[ChartDataSerie] |
Let's look an example:
from layrz_sdk.entities import RadialBarChart
radial_bar_chart = RadialBarChart(
title="My Radial Bar Chart",
align=ChartAlignment.LEFT,
serie=[
ChartDataSerie(label="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]),
ChartDataSerie(label="My Other Serie", type=ChartDataType.NUMBER, data=[4, 5, 6])
]
)
radial_bar_chart.title
#> "My Radial Bar Chart"
radial_bar_chart.align
#> "LEFT"
radial_bar_chart.serie
#> [ChartDataSerie(label="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]), ChartDataSerie(label="My Other Serie", type=ChartDataType.NUMBER, data=[4, 5, 6])]ScatterChart
| Attribute | Description | Field Type |
|---|---|---|
ScatterChart.title | Title of the chart | str |
ScatterChart.align | Alignment of the chart | ChartAlignment |
ScatterChart.series | Defines the series of the chart, uses the ScatterSerie class. | list[ScatterSerie] |
ScatterChart.x_axis_config | Defines the configuration for the X Axis (Horizontal) | AxisConfig |
ScatterChart.y_axis_config | Defines the configuration for the Y Axis (Vertical) | AxisConfig |
from layrz_sdk.entities import ScatterChart
scatter_chart = ScatterChart(
title="My Scatter Chart",
align=ChartAlignment.LEFT,
series=[
ScatterSerie(label="My Serie", data=[ScatterSerieItem(x=1, y=2), ScatterSerieItem(x=3, y=4)], color="#ff0000"),
ScatterSerie(label="My Other Serie", data=[ScatterSerieItem(x=5, y=6), ScatterSerieItem(x=7, y=8)], color="#00ff00")
],
x_axis_config=AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING),
y_axis_config=AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)
)
scatter_chart.title
#> "My Scatter Chart"
scatter_chart.align
#> "LEFT"
scatter_chart.series
#> [ScatterSerie(label="My Serie", data=[ScatterSerieItem(x=1, y=2), ScatterSerieItem(x=3, y=4)], color="#ff0000"), ScatterSerie(label="My Other Serie", data=[ScatterSerieItem(x=5, y=6), ScatterSerieItem(x=7, y=8)], color="#00ff00")]
scatter_chart.x_axis_config
#> AxisConfig(label="X Axis", measure_unit="Letters", min_value="A", max_value="C", data_type=ChartDataType.STRING)
scatter_chart.y_axis_config
#> AxisConfig(label="Y Axis", measure_unit="unit", min_value=1, max_value=6, data_type=ChartDataType.NUMBER)ScatterSerie
| Attribute | Description | Field Type |
|---|---|---|
ScatterSerie.label | Label of the serie | str |
ScatterSerie.data | List of data points | list[ScatterSerieItem] |
ScatterSerie.color | Color of the serie in hexadecimal code | str |
ScatterSerie.serie_type | Type of the serie | ChartDataSerieType |
Let's look an example:
from layrz_sdk.entities import ScatterSerie
scatter_serie = ScatterSerie(
label="My Scatter Serie",
data=[
ScatterSerieItem(x=1, y=2),
ScatterSerieItem(x=3, y=4)
],
color="#ff0000"
)
scatter_serie.label
#> "My Scatter Serie"
scatter_serie.data
#> [ScatterSerieItem(x=1, y=2), ScatterSerieItem(x=3, y=4)]
scatter_serie.color
#> "#ff0000"
scatter_serie.serie_type
#> ChartDataSerieType.SCATTERScatterSerieItem
| Attribute | Description | Field Type |
|---|---|---|
ScatterSerieItem.x | X value of the item | float |
ScatterSerieItem.y | Y value of the item | float |
Let's look an example:
from layrz_sdk.entities import ScatterSerieItem
scatter_serie_item = ScatterSerieItem(
x=1,
y=2
)
scatter_serie_item.x
#> 1
scatter_serie_item.y
#> 2TableChart
| Attribute | Description | Field Type |
|---|---|---|
TableChart.columns | List of columns | list[TableHeader] |
TableChart.rows | List of rows | list[TableRow] |
Let's look an example:
from layrz_sdk.entities import TableChart
table_chart = TableChart(
columns=[
TableHeader(label="My Column", key="my_column"),
TableHeader(label="My Other Column", key="my_other_column")
],
rows=[
TableRow(data={"my_column": "A", "my_other_column": 1}),
TableRow(data={"my_column": "B", "my_other_column": 2})
]
)
table_chart.columns
#> [TableHeader(label="My Column", key="my_column"), TableHeader(label="My Other Column", key="my_other_column")]
table_chart.rows
#> [TableRow(data={"my_column": "A", "my_other_column": 1}), TableRow(data={"my_column": "B", "my_other_column": 2})]TableHeader
| Attribute | Description | Field Type |
|---|---|---|
TableHeader.label | The label of the column | str |
TableHeader.key | The key of the column, this key should be present in each row | str |
Let's look an example:
from layrz_sdk.entities import TableHeader
table_header = TableHeader(
label="My Table Header",
key="my_table_header"
)
table_header.label
#> "My Table Header"
table_header.key
#> "my_table_header"TableRow
| Attribute | Description | Field Type |
|---|---|---|
TableRow.data | The data of the row, the keys comes from the headers | Any |
Let's look an example:
from layrz_sdk.entities import TableRow
table_row = TableRow(
data={"key1": "value1", "key2": "value2"}
)
table_row.data
#> {"key1": "value1", "key2": "value2"}TimelineChart
| Attribute | Description | Field Type |
|---|---|---|
TimelineChart.title | Title of the chart | str |
TimelineChart.align | Alignment of the chart | ChartAlignment |
TimelineChart.series | Defines the series of the chart, uses the TimelineSerie class. | list[TimelineSerie] |
Let's look an example:
from layrz_sdk.entities import TimelineChart
timeline_chart = TimelineChart(
title="My Timeline Chart",
align=ChartAlignment.LEFT,
series=[
TimelineSerie(label="My Serie", data=[TimelineSerieItem(start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))]),
TimelineSerie(label="My Other Serie", data=[TimelineSerieItem(start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))])
]
)
timeline_chart.title
#> "My Timeline Chart"
timeline_chart.align
#> "LEFT"
timeline_chart.series
#> [TimelineSerie(label="My Serie", data=[TimelineSerieItem(start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)]), TimelineSerie(label="My Other Serie", data=[TimelineSerieItem(start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)])]TimelineSerie
| Attribute | Description | Field Type |
|---|---|---|
TimelineSerie.label | Label of the serie. | str |
TimelineSerie.data | List of data points. | list[TimelineSerieItem] |
Let's look an example:
from layrz_sdk.entities import TimelineSerie
timeline_serie = TimelineSerie(
label="My Timeline Serie",
data=[TimelineSerieItem(start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))]
)
timeline_serie.label
#> "My Timeline Serie"
timeline_serie.data
#> [TimelineSerieItem(start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)]TimelineSerieItem
| Attribute | Description | Field Type |
|---|---|---|
TimelineSerieItem.start_at | Start date of the item. | datetime |
TimelineSerieItem.end_at | End date of the item. | datetime |
TimelineSerieItem.color | Color of the item in hexadecimal code. | str |
TimelineSerieItem.name | Label of the item. | str |
Let's look an example:
from layrz_sdk.entities import TimelineSerieItem
timeline_serie_item = TimelineSerieItem(
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
color="#ff0000",
name="My Timeline Serie Item"
)
timeline_serie_item.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
timeline_serie_item.end_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
timeline_serie_item.color
#> "#ff0000"
timeline_serie_item.name
#> "My Timeline Serie Item"Checkpoints
Enums
CheckpointOperationMode
| Value | Description |
|---|---|
ChartAlignment.FLEX | Defines a flexible operation mode for the checkpoint |
ChartAlignment.STRICT | Defines a strict operation mode for the checkpoint |
Classes
Checkpoint
| Attribute | Description | Datatype |
|---|---|---|
Checkpoint.pk | Checkpoint ID | int |
Checkpoint.asset_id | Active harassed at the checkpoint | int |
Checkpoint.waypoints | Checkpoint waypoint list | list[Waypoint] |
Checkpoint.start_at | Checkpoint start date | datetime |
Checkpoint.end_at | Waypoint end date | datetime |
Let's look an example:
from layrz_sdk.entities import Checkpoint
checkpoint = Checkpoint(
pk=1,
asset_id=1,
waypoints=[
Waypoint(pk=1, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC'))),
Waypoint(pk=2, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))
],
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
checkpoint.pk
#> 1
checkpoint.asset_id
#> 1
checkpoint.waypoints
#> [
# Waypoint(pk=1, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)),
# Waypoint(pk=2, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>))
# ]
checkpoint.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
checkpoint.end_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)CheckpointRef
| Attribute | Description | Datatype |
|---|---|---|
CheckpointRef.pk | Checkpoint ID | int |
CheckpointRef.name | Checkpoint name | str |
CheckpointRef.waypoints | List of waypoints | list[Waypoint] |
CheckpointRef.operation_mode | Operation mode | CheckpointOperationMode |
Let's look an example:
from layrz_sdk.entities import CheckpointRef
checkpoint_ref = CheckpointRef(
pk=1,
name="My Checkpoint",
waypoints=[
Waypoint(pk=1, geofence=Geofence(pk=1, name="My Geofence",
color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC'))),
Waypoint(pk=2, geofence=Geofence(pk=1, name="My Geofence",
color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))
],
operation_mode=CheckpointOperationMode.FLEX
)
checkpoint_ref.pk
#> 1
checkpoint_ref.name
#> "My Checkpoint"
checkpoint_ref.waypoints
#> [
# Waypoint(pk=1, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)),
# Waypoint(pk=2, geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"), sequence_real=1, sequence_ideal=1, start_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>), end_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>))
#]
checkpoint_ref.operation_mode
#> CheckpointOperationMode.FLEXWaypoint
| Attribute | Description | Field Type |
|---|---|---|
Waypoint.pk | Waypoint ID | int |
Waypoint.geofence | Associated geofence | Geofence |
Waypoint.sequence_real | Actual or executed sequence | int |
Waypoint.sequence_ideal | Ideal or planned sequence | int |
Waypoint.start_at | Date of entry to waypoint | datetime |
Waypoint.end_at | Waypoint exit date | datetime |
Let's look an example:
from layrz_sdk.entities import Waypoint
waypoint = Waypoint(
pk=1,
geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"),
sequence_real=1,
sequence_ideal=1,
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
waypoint.pk
#> 1
waypoint.geofence
#> Geofence(pk=1, name="My Geofence", color="#ff0000")
waypoint.sequence_real
#> 1
waypoint.sequence_ideal
#> 1
waypoint.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
waypoint.end_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)Events
Classes
Event
| Attribute | Description | Datatype |
|---|---|---|
Event.pk | Event ID | int |
Event.trigger | Trigger object that fired the event | Trigger |
Event.asset_id | ID of the asset associated with the event | int |
Event.message | Event telemetry information | Message |
Event.activated_at | Event activation date | datetime |
Event.geofence | Geofence where the event ocurred | Geofence |
Event.presence_type | Presence type of the event | PresenceType |
Let's look an example:
from layrz_sdk.entities import Event
event = Event(
pk=1,
trigger=Trigger(pk=1, name="My Trigger", code="my_trigger"),
asset_id=1,
message=Message(
pk=1,
asset_id=1,
position=Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56),
payload={"device1.param1": "value1", "device1.param2": "value2", "device2.param1": "value3", "device2.param2": "value4"},
sensors={"sensor1": "value1", "sensor2": "value2"},
received_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
),
activated_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"),
presence_type=PresenceType.ENTRANCE,
)
event.pk
#> 1
event.asset_id
#> 1
event.trigger
#> Trigger(pk=1, name="My Trigger", code="my_trigger")
event.message
#> Message(
# pk=1,
# asset_id=1,
# position=Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56),
# payload={"device1.param1": "value1","device1.param2": "value2","device2.param1": "value3","device2.param2": "value4"},
# sensors={"sensor1": "value1","sensor2": "value2"},
# received_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
# )
event.activated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
event.geofence
#> Geofence(pk=1, name="My Geofence", color="#ff0000")
event.presence_type
#> PresenceType.ENTRANCEFormatting
Enums
TextAlignment
| Attribute | Description |
|---|---|
TextAlignment.CENTER | Align the text to the center |
TextAlignment.LEFT | Align the text to the left |
TextAlignment.RIGHT | Align the text to the right |
TextAlignment.JUSTIFY | Justify the text |
General
Enums
AssetOperationMode
| Attribute | Description |
|---|---|
AssetOperationMode.SINGLE | Refers to single device operation mode |
AssetOperationMode.MULTIPLE | Refers to operation mode with more than one device, when this is the operation mode, in list devices, one of then will be indicated as main device |
AssetOperationMode.ASSETMULTIPLE | This refers to the operation mode with one or more assets, when this is the operation mode, list will be empty |
AssetOperationMode.DISCONNECTED | Disconnected operation mode, means the telemetry is not provided by any device |
AssetOperationMode.STATIC | Static operation mode, means that the position information is provided by the user and the telemetry is provided by any device (Not mandatory) |
AssetOperationMode.ZONE | Zone operation mode, means that the telemetry is provided by a zone, the zone is a polygonal area that is defined by the user. In the telemetry, you can get the path of the zone using the raw parameter zone.path, and the position.latitude and position.longitude will be the centroid of the zone |
PresenceType
| Attribute | Description |
|---|---|
PresenceType.ENTRANCE | Entrance to a geofence |
PresenceType.EXIT | Exit out of a geofence |
CommandSeriesTicketStatus
| Attribute | Description |
|---|---|
CommandSeriesTicketStatus.PENDING | The ticket is pending to be processed |
CommandSeriesTicketStatus.IN_SERVICE | The ticket is currently being processed |
CommandSeriesTicketStatus.TO_JOB | The ticket is ready to be executed by the job |
CommandSeriesTicketStatus.AT_JOB | The ticket is currently being executed by the job |
CommandSeriesTicketStatus.POURING | The ticket is currently being poured |
CommandSeriesTicketStatus.TO_PLANT | The ticket is ready to be sent to the plant |
CommandSeriesTicketStatus.IN_YARD | The ticket is currently in the yard |
CommandSeriesTicketStatus.OUT_OF_SERVICE | The ticket is out of service, it means that the ticket is not being processed anymore |
GeofenceCategory
| Attribute | Description |
|---|---|
GeofenceCategory.NONE | Classic or uncategorized geofence |
GeofenceCategory.CUSTOM | Geofence with non-standard category |
GeofenceCategory.ADMINISTRATIVE | Geofence as administrative area |
GeofenceCategory.CUSTOMER | Geofence as customer location |
GeofenceCategory.PROSPECT | Similar to customer location but not yet a customer |
GeofenceCategory.OTHER | Geofence as other location |
GeofenceCategory.POLYGON | Geofence as search geozone |
GeofenceCategory.LEAD | Geofence as lead location, not yet a prospect or customer |
TwilioNotificationType
| Attribute | Description |
|---|---|
TwilioNotificationType.SMS | Short Message Service (SMS) notification type, used for sending text messages |
TwilioNotificationType.VOICE | Voice notification type, used for making phone calls |
TwilioNotificationType.WHATSAPP | WhatsApp notification type, used for sending messages via WhatsApp |
Platform
| Attribute | Description |
|---|---|
Platform.ANDROID | Android platform |
Platform.IOS | iOS platform |
Platform.WEB | Web platform |
Platform.WINDOWS | Windows platform |
Platform.MACOS | macOS platform |
Platform.LINUX | Linux platform |
Platform.LAYRZ_OS | Layrz OS for embedding systems |
HttpRequestType
| Attribute | Description |
|---|---|
HttpRequestType.GET | HTTP GET request type, used to retrieve data from a server |
HttpRequestType.POST | HTTP POST request type, used to send data to a server |
HttpRequestType.PUT | HTTP PUT request type, used to update data on a server |
HttpRequestType.PATCH | HTTP PATCH request type, used to partially update data on a server |
SoundEffect
| Attribute | Description |
|---|---|
SoundEffect.NONE | No sound effect |
SoundEffect.BEEP | A short, sharp electronic sound, often associated with alerts or signals |
SoundEffect.MECHANICAL | A sound resembling a machine or device, characterized by clicking, whirring, or other industrial tones |
SoundEffect.PEAL | A clear, ringing sound, reminiscent of a bell or a chime |
SoundEffect.SIREN | A loud, wailing sound, typically used for emergency alerts or warnings |
SoundEffect.POP | A quick, soft burst-like sound, similar to a bubble popping |
SoundEffect.RESONANT | A deep, echoing tone with a lasting vibration or reverberation |
SoundEffect.TONE | A steady, smooth sound with a consistent pitch, often used in signals or melodies |
SoundEffect.CUSTOM | A custom sound effect that can be set by the user |
Classes
Asset
| Attribute | Description | Datatype |
|---|---|---|
Asset.pk | Unique identifier of the asset, this ID is unique throughout the entire Layrz ecosystem. | int |
Asset.name | Asset name | str |
Asset.devices | List of devices of the asset. It will return an empty list in case the operation mode is AssetOperationMode.ASSETMULTIPLE. Otherwise, it will return a list of Device, where only one of them will have the primary device identifier Device.is_primary | list[Device] |
Asset.vin | It is equivalent to the body serial number of a vehicle, machinery serial number, or any type of unique serial number. | str, none |
Asset.plate | It is equivalent to a vehicle license plate, tax registration number, citizen identification number, or any other type of unique identifier. | str |
Asset.asset_type | Indicates the type of asset, this value will be an ID. | int |
Asset.operation_mode | Indicates the operating mode of the asset. | AssetOperationMode |
Asset.custom_fields | List of custom fields for the asset. | list[CustomField] |
Asset.children | List of assets associated with this asset, it will only return a list with values when the operation mode is AssetOperationMode.ASSETMULTIPLE. | list[Asset] |
Asset.sensors | List of sensors of the asset. | list[Sensor] |
Asset.kind_id | Indicates the kind of asset, this value will be an ID. | int |
Asset.static_position | Indicates the static position of the asset. | StaticPosition |
Asset.points | Indicates the points associated with the asset. | list[StaticPosition] |
Asset.primary_id | Indicates the primary device ID of the asset, this value will be an ID. | int, none |
Asset.contacts | List of contacts associated with the asset. | list[AssetContact] |
Asset.owner_id | Indicates the owner ID of the asset, this value will be an ID. | int, none |
Let's look an example:
from layrz_sdk.entities import Asset
asset = Asset(
pk=1,
name="My Asset",
vin="12345678901234567",
plate="ABC-123",
asset_type=1,
operation_mode=AssetOperationMode.MULTIPLE,
custom_fields=[
CustomField(name="My Custom Field", value="My Value"),
CustomField(name="My Other Custom Field", value="My Other Value")
],
devices=[
Device(pk=1, ident="123456", name="My Device", protocol="alpharest", is_primary=True),
Device(pk=2, ident="789012", name="My Other Device", protocol="alpharest", is_primary=False)
],
children=[],
sensors=[
Sensor(pk=1, name="My Sensor", slug="my.sensor"),
Sensor(pk=2, name="My Other Sensor", slug="my.other.sensor")
]
kind_id=1,
static_position=StaticPosition(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56),
points=[
StaticPosition(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56),
StaticPosition(latitude=7.89, longitude=10.11, altitude=13.14, speed=16.17, direction=18.19, hdop=20.21)
],
primary_id=1,
contacts=[
AssetContact(name="Contact 1", phone="1234567890", email="contact1@example.com")
],
owner_id=1
)
asset.pk
#> 1
asset.name
#> "My Asset"
asset.vin
#> "12345678901234567"
asset.plate
#> "ABC-123"
asset.asset_type
#> 1
asset.operation_mode
#> "MULTIPLE"
asset.custom_fields
#> [CustomField(name="My Custom Field", value="My Value"),CustomField(name="My Other Custom Field", value="My Other Value")]
asset.devices
#> [Device(pk=1, ident="123456", name="My Device", protocol="alpharest", is_primary=True),Device(pk=2, ident="789012", name="My Other Device", protocol="alpharest", is_primary=False)]
asset.children
#> []
asset.sensors
#> [Sensor(pk=1, name="My Sensor", slug="my.sensor"), Sensor(pk=2, name="My Other Sensor", slug="my.other.sensor")]
asset.kind_id
#> 1
asset.static_position
#> StaticPosition(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56)
asset.points
#> [StaticPosition(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56), StaticPosition(latitude=7.89, longitude=10.11, altitude=13.14, speed=16.17, direction=18.19, hdop=20.21)]
asset.primary_id
#> 1
asset.contacts
#> [AssetContact(name="Contact 1", phone="1234567890", email="contact1@example.com")]
asset.owner_id
#> 1AssetConstants
| Attribute | Description | Datatype |
|---|---|---|
AssetContact.distance_traveled | Total distance traveled by the asset in meters | float |
AssetContact.primary_device | Primary device associated with the asset | str |
AssetContact.elapsed_time | Total elapsed time for the asset in seconds | timedelta |
Let's look an example:
from layrz_sdk.entities import AssetConstants
asset_constants = AssetConstants(
distance_traveled=1000.0,
primary_device="Device 1",
elapsed_time=datetime.timedelta(hours=1, minutes=30)
)
asset_constants.distance_traveled
#> 1000.0
asset_constants.primary_device
#> "Device 1"
asset_constants.elapsed_time
#> datetime.timedelta(seconds=5400)AssetContact
| Attribute | Description | Datatype |
|---|---|---|
AssetContact.name | Name of the contact associated with the asset | str |
AssetContact.phone | Phone number of the contact associated with the asset | str |
AssetContact.email | Email address of the contact associated with the asset | str |
Let's look an example:
from layrz_sdk.entities import AssetContact
asset_contact = AssetContact(
name="John Doe",
phone="1234567890",
email="john.doe@example.com"
)
asset_contact.name
#> "John Doe"
asset_contact.phone
#> "1234567890"
asset_contact.email
#> "john.doe@example.com"AssetOperationMode
| Attribute | Description |
|---|---|
AssetOperationMode.SINGLE | Refers to single device operation mode |
AssetOperationMode.MULTIPLE | Refers to operation mode with more than one device, when this is the operation mode, in list devices, one of then will be indicated as main device |
AssetOperationMode.ASSETMULTIPLE | This refers to the operation mode with one or more assets, when this is the operation mode, list will be empty |
AssetOperationMode.DISCONNECTED | Disconnected operation mode, means the telemetry is not provided by any device |
AssetOperationMode.STATIC | Static operation mode, means that the position information is provided by the user and the telemetry is provided by any device (Not mandatory) |
AssetOperationMode.ZONE | Zone operation mode, means that the telemetry is provided by a zone, the zone is a polygonal area that is defined by the user. In the telemetry, you can get the path of the zone using the raw parameter zone.path, and the position .latitude and position.longitude will be the centroid of the zone |
CustomField
| Attribute | Description | Field Type |
|---|---|---|
CustomField.pk | Primary key of the custom field | int |
CustomField.name | Refers to the name or key with which this custom field is identified. It is always the same data type | str |
CustomField.value | Refers to the value of the custom field. It is always the same data type | str |
CustomField.is_fixed | Indicates if the custom field is fixed or not. Fixed custom fields cannot be modified or deleted, they are created by the system and are used to store important information about the asset. | bool |
Let's look an example:
from layrz_sdk import CustomField
custom_field = CustomField(name="My Custom Field", value="My Value", is_fixed=True, pk=1)
custom_field.pk
#> 1
custom_field.name
#> "My Custom Field"
custom_field.value
#> "My Value"
custom_field.is_fixed
#> TrueDevice
| Attribute | Description | Field Type |
|---|---|---|
Device.pk | This is the Device ID, this ID is unique on all Layrz ecosystem | int |
Device.name | Device's name | str |
Device.ident | Unique identifier or IMEI's Device | str |
Device.protocol | This is the unique protocol's identifier | str |
Device.protocol_id | This is the unique protocol's ID, this ID is unique on all Layrz ecosystem | int, none |
Device.is_primary | Primary device indicator. This value will only be true if it is a primary device of the asset. In a list of devices in an asset, only one device with this value set to true will exist. | bool |
Device.modbus | Modbus configuration | ModbusConfig |
Let's look an example:
from layrz_sdk import Device
device = Device(pk=1, ident="123456789", name="My Device", protocol="alpharest", is_primary=True)
device.pk
#> 1
device.ident
#> "123456789"
device.name
#> "My Device"
device.protocol
#> "alpharest"
device.is_primary
#> TrueGeofence
| Attribute | Description | Field Type |
|---|---|---|
Geofence.pk | Geofence id | int |
Geofence.name | Geofence Name | str |
Geofence.color | Geofence Color (In Hexadecimal format) | str |
Let's look an example:
from layrz_sdk.entities import Geofence
geofence = Geofence(
pk=1,
name="My Geofence",
color="#ff0000"
)
geofence.pk
#> 1
geofence.name
#> "My Geofence"
geofence.color
#> "#ff0000"StaticPosition
| Attribute | Description | Datatype |
|---|---|---|
StaticPosition.latitude | Latitude of the static position | float |
StaticPosition.longitude | Longitude of the static position | float |
StaticPosition.altitude | Altitude of the static position | float |
Let's look an example:
from layrz_sdk.entities import StaticPosition
static_position = StaticPosition(
latitude=1.23,
longitude=4.56,
altitude=7.89
)
static_position.latitude
#> 1.23
static_position.longitude
#> 4.56
static_position.altitude
#> 7.89Sensor
| Attribute | Description | Datatype |
|---|---|---|
Sensor.pk | Unique sensor ID, this ID is unique throughout the entire Layrz ecosystem. | int |
Sensor.name | Refers to the name of the sensor. | str |
Sensor.slug | Refers to the parameter or key of the sensor, this value cannot overlap with other sensors of the same asset. | str |
Sensor.formula | Defines the formula of the sensor, used for calculations | str |
Let's look an example:
from layrz_sdk.entities import Sensor
sensor = Sensor(pk=1, name="My Sensor", slug="my.sensor")
sensor.pk
#> 1
sensor.name
#> "My Sensor"
sensor.slug
#> "my.sensor"
sensor.formula
#> "temperature * 2"User
| Attribute | Description | Field Type |
|---|---|---|
User.pk | User ID | int |
User.name | User name | str |
Let's look an example:
from layrz_sdk.entities import User
user = User(
pk=1,
name="User"
)
user.pk
#> 1
user.name
#> "User"Comment
| Attribute | Description | Field Type |
|---|---|---|
Comment.pk | Comment ID | int |
Comment.content | Content of the comment | str |
Comment.user | User who made the comment | User |
Comment.submitted_at | Date and time when the comment was submitted | datetime |
Let's look an example:
from layrz_sdk.entities import Comment
comment = Comment(
pk=1,
content="This is a comment",
user=User(pk=1, name="User"),
submitted_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
comment.pk
#> 1
comment.content
#> "This is a comment"
comment.user
#> User(pk=1, name="User")
comment.submitted_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)CommandSeriesTicket
| Attribute | Description | Field Type |
|---|---|---|
CommandSeriesTicket.pk | Ticket ID | int |
CommandSeriesTicket.service_id | Service ID associated with the ticket | int |
CommandSeriesTicket.status | Status of the ticket | CommandSeriesTicketStatus |
CommandSeriesTicket.ticket_id | Ticket ID associated with the command series | str |
CommandSeriesTicket.ticket_code | Ticket code associated with the command series | str |
CommandSeriesTicket.ticket_at | Date and time when the ticket was created | datetime |
CommandSeriesTicket.source_id | Source ID associated with the ticket | int, none |
CommandSeriesTicket.source | Source name associated with the ticket | Geofence , none |
CommandSeriesTicket.job_id | Job ID associated with the command series | int, none |
CommandSeriesTicket.job | Job name associated with the command series | Geofence, none |
CommandSeriesTicket.destination_id | Destination ID associated with the command series | int, none |
CommandSeriesTicket.destination | Destination name associated with the command series | Geofence, none |
CommandSeriesTicket.asset_id | Asset ID associated with the command series | int, none |
CommandSeriesTicket.asset | Asset name associated with the command series | Asset |
CommandSeriesTicket.trigger_id | Trigger ID associated with the command series | int, none |
CommandSeriesTicket.trigger | Trigger name associated with the command series | Trigger , none |
CommandSeriesTicket.action_id | Action ID associated with the command series | int, none |
CommandSeriesTicket.action | Action name associated with the command series | [Action, none] (#action) |
CommandSeriesTicket.created_at | Date and time when the command series was created | datetime |
CommandSeriesTicket.updated_at | Date and time when the command series was last updated | datetime |
Let's look an example:
from layrz_sdk.entities import CommandSeriesTicket, CommandSeriesTicketStatus, Geofence, Asset
command_series_ticket = CommandSeriesTicket(
pk=1,
service_id=1,
status=CommandSeriesTicketStatus.PENDING,
ticket_id="TICKET123",
ticket_code="CODE123",
ticket_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
source_id=1,
source=Geofence(pk=1, name="Source Geofence", color="#ff0000"),
job_id=1,
job=Geofence(pk=2, name="Job Geofence", color="#00ff00"),
destination_id=1,
destination=Geofence(pk=3, name="Destination Geofence", color="#0000ff"),
asset_id=1,
asset=Asset(pk=1, name="My Asset"),
trigger_id=1,
trigger=None,
action_id=None,
action=None,
created_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
updated_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
command_series_ticket.pk
#> 1
command_series_ticket.service_id
#> 1
command_series_ticket.status
#> CommandSeriesTicketStatus.PENDING
command_series_ticket.ticket_id
#> "TICKET123"
command_series_ticket.ticket_code
#> "CODE123"
command_series_ticket.ticket_at
#> datetime.datetime(2022, 2, 24, 7, 22
, 52, 317161, tzinfo=<UTC>)
command_series_ticket.source_id
#> 1
command_series_ticket.source
#> Geofence(pk=1, name="Source Geofence", color="#ff0000")
command_series_ticket.job_id
#> 1
command_series_ticket.job
#> Geofence(pk=2, name="Job Geofence", color="#00ff00")
command_series_ticket.destination_id
#> 1
command_series_ticket.destination
#> Geofence(pk=3, name="Destination Geofence", color="#0000ff")
command_series_ticket.asset_id
#> 1
command_series_ticket.asset
#> Asset(pk=1, name="My Asset")
command_series_ticket.trigger_id
#> 1
command_series_ticket.trigger
#> None
command_series_ticket.action_id
#> None
command_series_ticket.action
#> None
command_series_ticket.created_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
command_series_ticket.updated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)DestinationPhone
| Attribute | Description | Field Type |
|---|---|---|
DestinationPhone.phone_number | Phone number of the destination | str |
DestinationPhone.country_code | Country code of the destination phone number | str |
Let's look an example:
from layrz_sdk.entities import DestinationPhone
destination_phone = DestinationPhone(
phone_number="+1234567890",
country_code="US"
)
destination_phone.phone_number
#> "+1234567890"
destination_phone.country_code
#> "US"Function
| Attribute | Description | Field Type |
|---|---|---|
Function.pk | Function ID | int |
Function.name | Function name | str |
Function.maximum_time | Maximum execution time for the function | timedelta, none |
Function.minutes_delta | Time interval in minutes for the function to be executed | timedelta, none |
Function.external_identifiers | External identifiers for the function | list[str] |
Function.credentials | Credentials required for the function | dict[str, Any] |
Function.assets | Assets used by the function | list[Asset] |
Function.owner_id | Owner ID of the function | int, none |
Function.algorithm_id | Algorithm ID used by the function | int, none |
Let's look an example:
from layrz_sdk.entities import Function
function = Function(
pk=1,
name="My Function",
maximum_time=datetime.timedelta(hours=1),
minutes_delta=datetime.timedelta(minutes=30),
external_identifiers=["ext_id_1", "ext_id_2"],
credentials={"key": "value"},
assets=[Asset(pk=1, name="My Asset")],
owner_id=1,
algorithm_id=1
)
function.pk
#> 1
function.name
#> "My Function"
function.maximum_time
#> datetime.timedelta(seconds=3600)
function.minutes_delta
#> datetime.timedelta(seconds=1800)
function.external_identifiers
#> ["ext_id_1", "ext_id_2"]
function.credentials
#> {"key": "value"}
function.assets
#> [Asset(pk=1, name="My Asset")]
function.owner_id
#> 1
function.algorithm_id
#> 1Preset
| Attribute | Description | Field Type |
|---|---|---|
Preset.pk | Preset ID | int |
Preset.name | Preset name | str |
Preset.valid_before | Expiration date of the preset | datetime |
Preset.comment | Comment associated with the preset | str |
Preset.owner_id | Owner ID of the preset | int |
Let's look an example:
from layrz_sdk.entities import Preset
preset = Preset(
pk=1,
name="My Preset",
valid_before=datetime.datetime.now(tz=ZoneInfo('UTC')) + datetime.timedelta(days=30),
comment="This is a preset comment",
owner_id=1
)
preset.pk
#> 1
preset.name
#> "My Preset"
preset.valid_before
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
preset.comment
#> "This is a preset comment"
preset.owner_id
#> 1Timezone
| Attribute | Description | Field Type |
|---|---|---|
Timezone.pk | Timezone ID | int |
Timezone.name | Timezone name | str |
Timezone.utc_offset | UTC offset of the timezone | int |
Let's look an example:
from layrz_sdk.entities import Timezone
timezone = Timezone(
pk=1,
name="UTC",
utc_offset=0
)
timezone.pk
#> 1
timezone.name
#> "UTC"
timezone.utc_offset
#> 0Modbus
Enums
ModbusSchema
| Attribute | Description |
|---|---|
ModbusSchema.SINGLE | Defines a single Modbus request |
ModbusSchema.MULTIPLE | Defines multiple Modbus requests |
ModbusStatus
| Attribute | Description |
|---|---|
ModbusStatus.PENDING | Defines the pending state, indicating that the request is waiting to be processed |
ModbusStatus.WAITING_FOR_SEND | Defines the waiting state, indicating that the request is ready to be sent but has not yet been dispatched |
ModbusStatus.SENT | Defines the sent state, indicating that the request has been sent to the device |
ModbusStatus.ACK_RECEIVED | Defines the acknowledgment received state, Indicates that an acknowledgment has been received from the device |
ModbusStatus.CANCELLED | Defines the error state, Indicates that the request has been cancelled |
Classes
ModbusConfig
| Attribute | Description | Field Type |
|---|---|---|
ModbusConfig.port_id | Defines the port ID for the Modbus request | str |
ModbusConfig.is_enabled | Defines whether the Modbus request is enabled | bool |
ModbusConfig.parameters | List of Modbus parameters to be used in communication | list[ModbusParameter] |
Let's look an example:
from layrz_sdk.entities.modbus import ModbusConfig, ModbusParameter
modbus_config = ModbusConfig(
port_id="COM3",
is_enabled=True,
parameters=[
ModbusParameter(
name="temperature",
unit="C",
address=1,
data_type="float"
),
ModbusParameter(
name="humidity",
unit="%",
address=2,
data_type="float"
)
]
)
modbus_config.port_id
#> "COM3"
modbus_config.is_enabled
#> True
modbus_config.parameters
#> [ModbusParameter(name="temperature", unit="C", address=1, data_type="float"),
#> ModbusParameter(name="humidity", unit="%", address=2, data_type="float")]ModbusParameter
| Attribute | Description | Field Type |
|---|---|---|
ModbusParameter.schema_ | Defines the Modbus parameter | ModbusSchema |
ModbusParameter.split_each | Number of bytes to split each Modbus parameter | int |
ModbusParameter.data_length | Length of data for the Modbus parameter, from Hexadecimal representation | int |
ModbusParameter.data_address | Address of the data for the Modbus parameter | int |
ModbusParameter.function_code | Function code for the Modbus parameter | int |
ModbusParameter.controller_address | Address of the controller for the Modbus parameter | int |
Let's look an example:
from layrz_sdk.entities.modbus import ModbusParameter, ModbusSchema
modbus_parameter = ModbusParameter(
schema_=ModbusSchema.SINGLE,
split_each=2,
data_length=4,
data_address=1,
function_code=3,
controller_address=1
)
modbus_parameter.schema_
#> ModbusSchema.SINGLE
modbus_parameter.split_each
#> 2
modbus_parameter.data_length
#> 4
modbus_parameter.data_address
#> 1
modbus_parameter.function_code
#> 3
modbus_parameter.controller_address
#> 1ModbusWait
| Attribute | Description | Field Type |
|---|---|---|
ModbusWait.status | Defines the status of the Modbus wait operation | ModbusStatus |
ModbusWait.structure | Defines the structure of the Modbus wait operation | ModbusSchema |
ModbusWait.port_id | Defines the port ID for the Modbus wait operation | int |
ModbusWait.split_each | Number of bytes to split each Modbus parameter | int |
ModbusWait.data_length | Length of data for the Modbus wait operation, from Hexadecimal representation | int |
ModbusWait.data_address | Address of the data for the Modbus wait operation | int |
ModbusWait.function_code | Function code for the Modbus wait operation | int |
ModbusWait.controller_address | Address of the controller for the Modbus wait operation | int |
Let's look an example:
from layrz_sdk.entities.modbus import ModbusWait, ModbusStatus, ModbusSchema
modbus_wait = ModbusWait(
status=ModbusStatus.PENDING,
structure=ModbusSchema.SINGLE,
port_id="COM3",
split_each=2,
data_length=4,
data_address=1,
function_code=3,
controller_address=1
)
modbus_wait.status
#> ModbusStatus.PENDING
modbus_wait.structure
#> ModbusSchema.SINGLE
modbus_wait.port_id
#> "COM3"
modbus_wait.split_each
#> 2
modbus_wait.data_length
#> 4
modbus_wait.data_address
#> 1
modbus_wait.function_code
#> 3
modbus_wait.controller_address
#> 1Operations
Enums
OperationType
| Attribute | Description |
|---|---|
OperationType.WEBHOOKS | All the operations by http request |
OperationType.SEND_EMAIL | Send notifications emails |
OperationType.REGISTER_ON_ASSET | Register an event for the asset |
OperationType.IN_APP_NOTIFICATION | Send notifications inside the app |
OperationType.TWILIO | Send notifications using Twilio |
OperationType.MOBILE_POPUP_NOTIFICATION | Send mobile popup notifications |
OperationType.BHS_PUSH | Send notifications using Firebase Push Notifications of Brickhouse Tracking Platform |
Classes
Operation
| Attribute | Description | Field Type |
|---|---|---|
Operation.pk | Defines the primary key of the trigger | int |
Operation.name | Defines the name of the trigger | str |
Operation.cooldown_time | Defines the cooldown time for the trigger | timedelta |
Operation.operation_type | Defines the type of the operation | OperationType |
Operation.request_type | Defines the request type for the operation | HttpRequestType |
Operation.url | Defines the request URL for the operation | str, none |
Operation.headers | Defines the request headers for the operation | list[dict[str, Any]] |
Operation.reception_emails | Defines the reception emails for the operation | list[str] |
Operation.language_id | Defines the language ID for the operation | int |
Operation.payload | Defines the payload for the operation | str |
Operation.timezone_id | Defines the timezone ID for the operation | int, none |
Operation.email_subject | Defines the email subject for the operation | str |
Operation.color | Defines the color for the operation | str |
Operation.account_id | Defines the account ID for the operation | int, str, none |
Operation.notification_type | Defines the notification type for the operation | TwilioNotificationType |
Operation.host_phone | Defines the destination phone for the operation | DestinationPhone |
Operation.username | Defines the username for the operation | str, none |
Operation.token | Defines the token for the operation | str, none |
Operation.destination_phones | Defines the destination phones for the operation | list[DestinationPhone] |
Operation.attach_image | Defines the image attachment for the operation | bool |
Operation.use_asset_contacts_instead | Defines if the operation should use asset contacts instead of reception emails | bool |
Operation.email_template_id | Defines the email template ID for the operation | int, none |
Operation.push_platforms | Defines the push platforms for the operation | list[Platform] |
Operation.push_title | Defines the push title for the operation | str |
Operation.requires_bhs_validation | Defines if the operation requires BHS validation | bool |
Operation.bhs_tier_id | Defines the BHS tier ID for the operation | int, none |
Operation.sound_effect | Defines the sound effect for the operation | SoundEffect |
Operation.sound_effect_uri | Defines the URI for the sound effect | str, none |
Operation.duration | Defines the duration for the operation | timedelta |
Operation.credentials | Defines the credentials for the operation | dict[str, Any] |
Operation.timezone | Defines the timezone for the operation | timezone, none |
Operation.icon | Defines the icon for the operation | str, none |
Let's look an example:
from layrz_sdk.entities import Operation, OperationType, HttpRequestType, TwilioNotificationType
operation = Operation(
pk=1,
name="My Operation",
cooldown_time=datetime.timedelta(minutes=5),
operation_type=OperationType.COMMAND,
request_type=HttpRequestType.POST,
url="https://example.com/api/operation",
headers=[{"Content-Type": "application/json"}],
reception_emails=["example@example.com"],
payload="Hello World",
timezone_id=1,
email_subject="Operation Email",
color="#FF0000",
account_id=1,
notification_type=TwilioNotificationType.SMS,
host_phone=DestinationPhone(number="+1234567890"),
username="user",
token="token",
destination_phones=[DestinationPhone(number="+1234567890")],
attach_image=True,
use_asset_contacts_instead=False,
email_template_id=1,
push_platforms=[Platform.IOS],
push_title="Push Notification",
requires_bhs_validation=True,
bhs_tier_id=1,
sound_effect=SoundEffect.DEFAULT,
sound_effect_uri="https://example.com/sound.mp3",
duration=datetime.timedelta(seconds=30),
credentials={"username": "user", "password": "pass"},
timezone=datetime.timezone.utc,
icon="https://example.com/icon.png"
)
operation.pk
#> 1
operation.name
#> "My Operation"
operation.cooldown_time
#> datetime.timedelta(seconds=300)
operation.operation_type
#> OperationType.COMMAND
operation.request_type
#> HttpRequestType.POST
operation.url
#> "https://example.com/api/operation"
operation.headers
#> [{"Content-Type": "application/json"}]
operation.reception_emails
#> ["example@example.com"]
operation.payload
#> "Hello World"
operation.timezone_id
#> 1
operation.email_subject
#> "Operation Email"
operation.color
#> "#FF0000"
operation.account_id
#> 1
operation.notification_type
#> TwilioNotificationType.SMS
operation.host_phone
#> DestinationPhone(phone_number="+1234567890", country_code=None)
operation.username
#> "user"
operation.token
#> "token"
operation.destination_phones
#> [DestinationPhone(phone_number="+1234567890", country_code=None)]
operation.attach_image
#> True
operation.use_asset_contacts_instead
#> False
operation.email_template_id
#> 1
operation.push_platforms
#> [Platform.IOS]
operation.push_title
#> "Push Notification"
operation.requires_bhs_validation
#> True
operation.bhs_tier_id
#> 1
operation.sound_effect
#> SoundEffect.DEFAULT
operation.sound_effect_uri
#> "https://example.com/sound.mp3"
operation.duration
#> datetime.timedelta(seconds=30)
operation.credentials
#> {"username": "user", "password": "pass"}
operation.timezone
#> datetime.timezone.utc
operation.icon
#> "https://example.com/icon.png"OperationPayload
| Attribute | Description | Field Type |
|---|---|---|
OperationPayload.kind | Defines the kind of payload | OperationType |
OperationPayload.asset | Defines the asset associated with the payload | Asset |
OperationPayload.trigger | Defines the trigger associated with the payload | Trigger |
OperationPayload.operation | Defines the operation associated with the payload | Operation |
OperationPayload.activated_at | Defines the date and time when the payload was activated | datetime |
OperationPayload.position | Defines the position associated with the payload | dict[str, Any] |
OperationPayload.sensors | Defines the sensors associated with the payload | dict[str, Any] |
OperationPayload.geofence | Defines the geofence associated with the payload | Geofence |
OperationPayload.presence_type | Defines the presence type associated with the payload | PresenceType |
OperationPayload.case_ | Defines the case associated with the payload | OperationCasePayload |
OperationPayload.language_id | Defines the language ID associated with the payload | int |
OperationPayload.payload | Defines the payload data | str |
OperationPayload.use_asset_contacts_instead | Defines if the operation should use asset contacts instead of reception emails | bool |
OperationPayload.account_id | Defines the account ID associated with the payload | int, str, none |
OperationPayload.http_url | Defines the HTTP URL associated with the payload | str, none |
OperationPayload.http_method | Defines the HTTP method associated with the payload | HttpRequestType |
OperationPayload.http_headers | Defines the HTTP headers associated with the payload | list[dict[str, Any]] |
OperationPayload.email_subject | Defines the email subject associated with the payload | str |
OperationPayload.attach_image | Defines if the operation should attach an image | bool |
OperationPayload.reception_emails | Defines the reception emails associated with the payload | list[str] |
OperationPayload.template_id | Defines the template ID associated with the payload | int, none |
OperationPayload.destinations | Defines the destinations associated with the payload | list[DestinationPhone] |
OperationPayload.twilio_host_phone | Defines the Twilio host phone associated with the payload | DestinationPhone |
OperationPayload.twilio_notification_type | Defines the Twilio notification type associated with the payload | TwilioNotificationType |
OperationPayload.username | Defines the username associated with the payload | str, none |
OperationPayload.token | Defines the token associated with the payload | str, none |
OperationPayload.requires_bhs_validation | Defines if the payload requires BHS validation | bool |
OperationPayload.bhs_tier_id | Defines the BHS tier ID associated with the payload | int, none |
OperationPayload.push_title | Defines the push title associated with the payload | str |
OperationPayload.push_platforms | Defines the push platforms associated with the payload | list[Platform] |
OperationPayload.destinations_ids | Defines the destination IDs associated with the payload | list[int] |
OperationPayload.sound_effect | Defines the sound effect associated with the payload | SoundEffect |
OperationPayload.sound_effect_uri | Defines the sound effect URI associated with the payload | str, none |
OperationPayload.duration | Defines the duration associated with the payload | timedelta, none |
OperationPayload.icon | Defines the icon associated with the payload | str, none |
Let's look an example:
from layrz_sdk.entities import OperationPayload, OperationType, Trigger, Geofence, PresenceType
operation_payload = OperationPayload(
kind=OperationType.COMMAND,
asset=Asset(pk=1, name="My Asset"),
trigger=Trigger(pk=1, name="My Trigger"),
operation=Operation(pk=1, name="My Operation"),
activated_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
position={"latitude": 1.23, "longitude": 4.56},
sensors={"sensor1": 10.0, "sensor2": 20.0},
geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"),
presence_type=PresenceType.INSIDE,
case_=None,
language_id=1,
payload="Hello World",
use_asset_contacts_instead=False,
account_id=1,
http_url="https://example.com/api/operation",
http_method=HttpRequestType.POST,
http_headers=[{"Content-Type": "application/json"}],
email_subject="Operation Email",
attach_image=True,
reception_emails=["recipient@example.com"],
template_id=1,
destinations=[DestinationPhone(phone_number="+1234567890", country_code="US")],
twilio_host_phone=DestinationPhone(phone_number="+1234567890", country_code="US"),
twilio_notification_type=TwilioNotificationType.SMS,
username="user",
token="token",
requires_bhs_validation=True,
bhs_tier_id=1,
push_title="Push Notification",
push_platforms=[Platform.IOS],
destinations_ids=[1, 2],
sound_effect=SoundEffect.DEFAULT,
sound_effect_uri="https://example.com/sound.mp3",
duration=datetime.timedelta(seconds=30),
icon="https://example.com/icon.png"
)
operation_payload.kind
#> OperationType.COMMAND
operation_payload.asset
#> Asset(pk=1, name="My Asset")
operation_payload.trigger
#> Trigger(pk=1, name="My Trigger")
operation_payload.operation
#> Operation(pk=1, name="My Operation")
operation_payload.activated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
operation_payload.position
#> {"latitude": 1.23, "longitude": 4.56}
operation_payload.sensors
#> {"sensor1": 10.0, "sensor2": 20.0}
operation_payload.geofence
#> Geofence(pk=1, name="My Geofence", color="#ff0000")
operation_payload.presence_type
#> PresenceType.INSIDE
operation_payload.case_
#> None
operation_payload.language_id
#> 1
operation_payload.payload
#> "Hello World"
operation_payload.use_asset_contacts_instead
#> False
operation_payload.account_id
#> 1
operation_payload.http_url
#> "https://example.com/api/operation"
operation_payload.http_method
#> HttpRequestType.POST
operation_payload.http_headers
#> [{"Content-Type": "application/json"}]
operation_payload.email_subject
#> "Operation Email"
operation_payload.attach_image
#> True
operation_payload.reception_emails
#> ["recipient@example.com"]
operation_payload.template_id
#> 1
operation_payload.destinations
#> [DestinationPhone(phone_number="+1234567890", country_code="US")]
operation_payload.twilio_host_phone
#> DestinationPhone(phone_number="+1234567890", country_code="US")
operation_payload.twilio_notification_type
#> TwilioNotificationType.SMS
operation_payload.username
#> "user"
operation_payload.token
#> "token"
operation_payload.requires_bhs_validation
#> True
operation_payload.bhs_tier_id
#> 1
operation_payload.push_title
#> "Push Notification"
operation_payload.push_platforms
#> [Platform.IOS]
operation_payload.destinations_ids
#> [1, 2]
operation_payload.sound_effect
#> SoundEffect.DEFAULT
operation_payload.sound_effect_uri
#> "https://example.com/sound.mp3"
operation_payload.duration
#> datetime.timedelta(seconds=30)
operation_payload.icon
#> "https://example.com/icon.png"OperationCaseCommentPayload
| Attribute | Description | Field Type |
|---|---|---|
OperationCaseCommentPayload.pk | Defines the primary key of the comment | int |
OperationCaseCommentPayload.content | Defines the content of the operation case comment | str |
OperationCaseCommentPayload.user | Defines the user who created the operation case comment | str |
OperationCaseCommentPayload.created_at | Defines the date and time when the operation case comment was created | datetime |
Let's look an example:
from layrz_sdk.entities import OperationCaseCommentPayload
operation_case_comment_payload = OperationCaseCommentPayload(
pk=1,
content="This is a comment",
user="User",
created_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
operation_case_comment_payload.pk
#> 1
operation_case_comment_payload.content
#> "This is a comment"
operation_case_comment_payload.user
#> "User"
operation_case_comment_payload.created_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)OperationCasePayload
| Attribute | Description | Field Type |
|---|---|---|
OperationCasePayload.pk | Defines the primary key of the operation case | int |
OperationCasePayload.created_at | Defines the date and time when the operation case was created | datetime |
OperationCasePayload.updated_at | Defines the date and time when the operation case was last updated | datetime |
OperationCasePayload.trigger | Defines the trigger associated with the operation case | Trigger |
OperationCasePayload.file_id | Defines the file ID associated with the operation case | int, none |
OperationCasePayload.file_created_at | Defines the date and time when the file was created | datetime, none |
OperationCasePayload.comment | Defines the comment associated with the operation case | OperationCaseCommentPayload |
Let's look an example:
from layrz_sdk.entities import OperationCasePayload, Trigger, OperationCaseCommentPayload
operation_case_payload = OperationCasePayload(
pk=1,
created_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
updated_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
trigger=Trigger(pk=1, name="My Trigger"),
file_id=None,
file_created_at=None,
comment=OperationCaseCommentPayload(
pk=1,
content="This is a comment",
user="User",
created_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
)
)
operation_case_payload.pk
#> 1
operation_case_payload.created_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
operation_case_payload.updated_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
operation_case_payload.trigger
#> Trigger(pk=1, name="My Trigger")
operation_case_payload.file_id
#> None
operation_case_payload.file_created_at
#> None
operation_case_payload.comment
#> OperationCaseCommentPayload(pk=1, content="This is a comment", user="User", created_at=datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>))Repcom
Classes
Transaction
| Attribute | Description | Field type |
|---|---|---|
| pk | Transaction ID | int |
| asset | Asset related to the transaction | Asset |
| amount | Amount of the transaction | float |
| quantity | Quantity of the transaction | float |
| mileage | Mileage in kilometers | float |
| distance | Distance traveled in kilometers | float |
| engine_time | Time with the engine on | timedelta |
| idle_time | Time with the engine on without movement | timedelta |
| in_geofence | Flag to indicate if transaction occurred inside a geofence | bool |
| geofence_name | Name of the geofence where transaction occurred | str |
| received_at | Transaction reception date and time | datetime |
| is_wildcard | Wildcard indicator for transaction | bool |
Let's look an example:
from layrz_sdk.entities import Transaction
transaction = Transaction(
pk=1,
asset=Asset(pk=1, name="My Asset"),
amount=100.00,
quantity=10.00,
mileage=100.00,
distance=100.00,
engine_time=datetime.timedelta(hours=1),
idle_time=datetime.timedelta(minutes=30),
in_geofence=True,
geofence_name="My Geofence",
received_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
is_wildcard=False
)
transaction.pk
#> 1
transaction.asset
#> Asset(pk=1, name="My Asset")
transaction.amount
#> 100.00
transaction.quantity
#> 10.00
transaction.mileage
#> 100.00
transaction.distance
#> 100.00
transaction.engine_time
#> datetime.timedelta(hours=1)
transaction.idle_time
#> datetime.timedelta(minutes=30)
transaction.in_geofence
#> True
transaction.geofence_name
#> "My Geofence"
transaction.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
transaction.is_wildcard
#> FalseReports
Enums
ReportDataType
| Attribute | Description |
|---|---|
ReportDataType.STR | Defines the data type as a string |
ReportDataType.INT | Defines the data type as an integer |
ReportDataType.FLOAT | Defines the data type as a float |
ReportDataType.DATETIME | Defines the data type as a datetime |
ReportDataType.BOOL | Defines the data type as a boolean |
ReportDataType.CURRENCY | Defines the data type as a currency |
ReportFormat
| Attribute | Description |
|---|---|
ReportFormat.MICROSOFT_EXCEL | Defines the report format as Microsoft Excel (xlsx) |
ReportFormat.JSON | Defines the report format as JSON |
ReportFormat.PDF | Defines the report format as PDF |
Classes
CustomReportPage
| Attribute | Description | Field Type |
|---|---|---|
CustomReportPage.name | Defines the name of the page. Length should be less than 60 characters | str |
CustomReportPage.builder | Function to build the page, the builder receives a [Worksheet](https://xlsxwriter.readthedocs.io/worksheet.html) entity as an argument and shouldn't return anything. | [callable(Worksheet)](https://xlsxwriter.readthedocs.io/worksheet.html) |
CustomReportPage.extended_builder | Function to build the page with extended functionality, the extended builder receives a [Worksheet](https://xlsxwriter.readthedocs.io/worksheet.html) entity as an argument and shouldn't return anything. This function is used to add additional functionality to the page, such as adding charts or images. | [callable(Worksheet)](https://xlsxwriter.readthedocs.io/worksheet.html) |
Let's look an example:
from layrz_sdk.entities import CustomReportPage
def build_page(worksheet):
worksheet.write('A1', 'Hello')
worksheet.write('B1', 'World')
worksheet.write('A2', 'This')
worksheet.write('B2', 'is')
worksheet.write('C2', 'an')
worksheet.write('D2', 'example')
worksheet.merge_range('A4:D4', 'Merged cells')
bold = worksheet.add_format({'bold': True})
worksheet.write('A6', 'Bold text', bold)
format1 = worksheet.add_format({'bg_color': '#FFC7CE', 'font_color': '#9C0006'})
worksheet.write('A8', 'Text with red background', format1)
page = CustomReportPage(
name="My Custom Report Page",
builder=build_page,
extended_builder=build_page
)
page.name
#> "My Custom Report Page"
page.builder
#> <function build_page at 0x7f8e3e3e3d30>
page.extended_builder
#> <function build_page at 0x7f8e3e3e3d30>Report
| Attribute | Description | Field Type |
|---|---|---|
Report.pages | Defines the pages of the report | list[ReportPage] | list[CustomReportPage] |
Report.name | Defines the name of the report | str |
Report.export_format | export_format is deprecated, submit the export format in the export() method instead | ReportFormat |
Let's look an example:
from layrz_sdk.entities import Report
report = Report(
pages=[
ReportPage(name="My Report Page", headers=[ReportHeader(content="My Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER)], rows=[ReportRow(content=[ReportCol(content="My Report Col", color="#ff0000", data_type=ReportDataType.STRING, text_color="#00ff00", align=TextAlignment.CENTER, datetime_format="YYYY-MM-DD", currency_symbol="USD")], height=100, compact=True)]),
ReportPage(name="My Other Report Page", headers=[ReportHeader(content="My Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER)], rows=[ReportRow(content=[ReportCol(content="My Report Col", color="#ff0000", data_type=ReportDataType.STRING, text_color="#00ff00", align=TextAlignment.CENTER, datetime_format="YYYY-MM-DD", currency_symbol="USD")], height=100, compact=True)])
],
name="My Report"
)
report.pages
#> [ReportPage(name="My Report Page", headers=[ReportHeader(content="My Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER)], rows=[ReportRow(content=[ReportCol(content="My Report Col", color="#ff0000", data_type=ReportDataType.STRING, text_color="#00ff00", align=TextAlignment.CENTER, datetime_format="YYYY-MM-DD", currency_symbol="USD")], height=100, compact=True)]), ReportPage(name="My Other Report Page", headers=[ReportHeader(content="My Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER)], rows=[ReportRow(content=[ReportCol(content="My Report Col", color="#ff0000", data_type=ReportDataType.STRING, text_color="#00ff00", align=TextAlignment.CENTER, datetime_format="YYYY-MM-DD", currency_symbol="USD")], height=100, compact=True)]
report.name
#> "My Report"ReportCol
| Attribute | Description | Field Type |
|---|---|---|
ReportCol.content | Defines the content to display | any* |
ReportCol.color | Defines the color of the cell (Not the text color, in HEX) | str |
ReportCol.data_type | Defines the data type of the content | ReportDataType |
ReportCol.align | Defines the alignment of the text in the cell | TextAlignment |
ReportCol.datetime_format | Defines the datetime format, uses the default Python datetime strftime() | str |
ReportCol.currency_symbol | Defines the currency symbol | str |
ReportCol.bold | Defines if the text is bold | bool |
ReportCol.text_color | Property text_color deprecated in ReportCol, replaced by a luminance-based color using the background color | str |
ReportCol.lock | Defines if the column is locked | bool |
Let's look an example:
from layrz_sdk.entities import ReportCol
report_col = ReportCol(
content="My Report Col",
color="#ff0000",
data_type=ReportDataType.STRING,
align=TextAlignment.CENTER,
datetime_format="YYYY-MM-DD",
currency_symbol="USD",
bold=True,
lock=False
)
report_col.content
#> "My Report Col"
report_col.color
#> "#ff0000"
report_col.data_type
#> "STRING"
report_col.align
#> "CENTER"
report_col.datetime_format
#> "YYYY-MM-DD"
report_col.currency_symbol
#> "USD"
report_col.lock
#> False
report_col.bold
#> TrueReportConfiguration
| Attribute | Description | Field Type |
|---|---|---|
ReportConfiguration.title | Report title | str |
ReportConfiguration.pages_count | Number of pages to display | int |
Let's look an example:
from layrz_sdk.entities import ReportConfiguration
report_configuration = ReportConfiguration(
pages_count=1,
title="My Report"
)
report_configuration.pages_count
#> 1
report_configuration.title
#> "My Report"ReportHeader
| Attribute | Description | Field Type |
|---|---|---|
ReportHeader.content | Display name | any* |
ReportHeader.color | Cell color in hexadecimal code | str |
ReportHeader.align | Text Alignment | TextAlignment |
ReportHeader.bold | Bold text | bool |
ReportHeader.width | Property width deprecated in ReportHeader, replaced by the function autofit() to automatically fit the header width | float |
ReportHeader.text_color | Property text_color deprecated in ReportHeader, replaced by a luminance-based color using the background color | str |
Let's look an example:
from layrz_sdk.entities import ReportHeader
report_header = ReportHeader(
content="My Report Header",
color="#ff0000",
align=TextAlignment.CENTER,
bold=True
)
report_header.content
#> "My Report Header"
report_header.autofit()
report_header.color
#> "#ff0000"
report_header.align
#> "CENTER"ReportPage
| Attribute | Description | Field Type |
|---|---|---|
ReportPage.name | Defines the name of the page | str |
ReportPage.headers | Defines the headers of the page | list[ReportHeader] |
ReportPage.rows | Defines the rows of the page | list[ReportRow] |
ReportPage.freeze_header | Specifies if the header should appear frozen | bool |
Let's look an example:
from layrz_sdk.entities import ReportPage
report_page = ReportPage(
name="My Report Page",
headers=[
ReportHeader(content="My Report Header", color="#ff0000", align=TextAlignment.CENTER),
ReportHeader(content="My Other Report Header", color="#ff0000", align=TextAlignment.CENTER)
],
rows=[
ReportRow(data=["A", "B"]),
ReportRow(data=["C", "D"])
],
freeze_header=False
)
report_page.name
#> "My Report Page"
report_page.headers
#> [ReportHeader(content="My Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER), ReportHeader(content="My Other Report Header", width=100, color="#ff0000", text_color="#00ff00", align=TextAlignment.CENTER)]
report_page.rows
#> [ReportRow(data=["A", "B"]), ReportRow(data=["C", "D")]
report_page.freeze_header
#> FalseReportRow
| Attribute | Description | Field Type |
|---|---|---|
ReportRow.content | Defines the content of the row | list[ReportCol] |
ReportRow.compact | Defines if the row is compact | bool |
ReportRow.height | Height is deprecated | float |
Let's look an example:
from layrz_sdk.entities import ReportRow
report_row = ReportRow(
content=[
ReportCol(content="My Report Col", color="#ff0000", align=TextAlignment.CENTER),
ReportCol(content="My Other Report Col", color="#ff0000", align=TextAlignment.CENTER)
],
compact=True
)
report_row.content
#> [ReportCol(content="My Report Col", color="#ff0000", align=TextAlignment.CENTER), ReportCol(content="My Other Report Col", color="#ff0000", align=TextAlignment.CENTER)]
report_row.compact
#> TrueTelemetry
Classes
LastMessage
| Attribute | Description | Field Type |
|---|---|---|
LastMessage.asset | The asset entity that generated the message | Asset |
Let's look an example:
from layrz_sdk.entities import LastMessage
asset = Asset(pk=1, name="My Asset", vin="12345678901234567", plate="ABC-123",
asset_type=1, operation_mode=AssetOperationMode.MULTIPLE)
last_message = LastMessage(
asset=asset
last_message.asset
#> Asset(pk=1, name="My Asset", vin="12345678901234567", plate="ABC-123", asset_type=1, operation_mode=AssetOperationMode.MULTIPLE, custom_fields=None, children=None, sensors=None)'Message
| Attribute | Description | Field Type |
|---|---|---|
Message.pk | Unique message identifier | int |
Message.asset_id | Unique identifier of the asset, owner of the message | int |
Message.position | Geolocation information | Position |
Message.payload | Raw content of the asset's raster | dict |
Message.sensors | Calculated/processed values from the asset's sensors | dict |
Message.received_at | Date of receipt of the message. Defined in UTC | datetime |
Message.geofences | List of geofences associated with the message | list[Geofence] |
Let's look an example:
from layrz_sdk.entities import Message
message = Message(
pk=1,
asset_id=1,
position=Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56),
payload={
"device1.param1": "value1",
"device1.param2": "value2",
"device2.param1": "value3",
"device2.param2": "value4"
},
sensors={
"sensor1": "value1",
"sensor2": "value2"
},
received_at=datetime.datetime.now(tz=ZoneInfo('UTC'))
geofences=[
Geofence(pk=1, name="Geofence 1", color="#ff0000"),
Geofence(pk=2, name="Geofence 2", color="#00ff00")
]
)
message.pk
#> 1
message.asset_id
#> 1
message.position
#> Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56)
message.payload
#> {"device1.param1": "value1","device1.param2": "value2","device2.param1": "value3","device2.param2": "value4"}
message.sensors
#> {"sensor1": "value1","sensor2": "value2"}
message.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
message.geofences
#> [Geofence(pk=1, name="Geofence 1", color="#ff0000"), Geofence(pk=2, name="Geofence 2", color="#00ff00")]Position
| Attribute | Description | Datatype |
|---|---|---|
Position.latitude | Latitude in decimal degrees format | float, none |
Position.longitude | Length in decimal degrees format | float, none |
Position.altitude | Altitude in meters above sea level | float, none |
Position.speed | Speed in kilometers per hour | float, none |
Position.direction | Direction in degrees | float, none |
Position.hdop | Horizontal dilution of precision | float, none |
Position.satellites | Number of satellites | int, none |
Let's look an example:
from layrz_sdk.entities import Position
position = Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56, satellites=10)
position.latitude
#> 1.23
position.longitude
#> 4.56
position.altitude
#> 7.89
position.speed
#> 10.11
position.direction
#> 12.34
position.hdop
#> 15.56
position.satellites
#> 10AssetMessage
| Attribute | Description | Field Type |
|---|---|---|
AssetMessage.pk | Unique identifier of the asset message | int, none |
AssetMessage.asset_id | Unique identifier of the asset | int |
AssetMessage.position | Current position of the device | dict[str, float, int] |
AssetMessage.payload | Raw content of the asset's raster | dict[str, any] |
AssetMessage.sensors | Calculated/processed values from the asset's sensors | dict[str, any] |
AssetMessage.geofences_ids | List of geofence IDs associated with the message | list[int] |
AssetMessage.distance_traveled | Distance traveled by the asset in kilometers | float |
AssetMessage.received_at | Date of receipt of the message. Defined in UTC | datetime |
AssetMessage.elapsed_time | Elapsed time since the message was received | timedelta |
Let's look an example:
from layrz_sdk.entities.telemetry import AssetMessage
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
asset_message = AssetMessage(
pk=1,
asset_id=1,
position={"latitude": 1.23, "longitude": 4.56, "altitude": 7.89, "speed": 10.11, "direction": 12.34, "hdop": 15.56},
payload={
"device1.param1": "value1",
"device1.param2": "value2",
"device2.param1": "value3",
"device2.param2": "value4"
},
sensors={
"sensor1": "value1",
"sensor2": "value2"
},
geofences_ids=[1, 2],
distance_traveled=100.0,
received_at=datetime.now(tz=ZoneInfo('UTC')),
elapsed_time=timedelta(minutes=30)
)
asset_message.pk
#> 1
asset_message.asset_id
#> 1
asset_message.position
#> {"latitude": 1.23, "longitude": 4.56, "altitude": 7.89, "speed": 10.11, "direction": 12.34, "hdop": 15.56}
asset_message.payload
#> {"device1.param1": "value1", "device1.param2": "value2", "device2.param1": "value3", "device2.param2": "value4"}
asset_message.sensors
#> {"sensor1": "value1", "sensor2": "value2"}
asset_message.geofences_ids
#> [1, 2]
asset_message.distance_traveled
#> 100.0
asset_message.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
asset_message.elapsed_time
#> datetime.timedelta(seconds=1800)DeviceMessage
| Attribute | Description | Field Type |
|---|---|---|
DeviceMessage.pk | Unique identifier of the device message | int |
DeviceMessage.ident | Unique identifier of the device | str |
DeviceMessage.device_id | Unique identifier of the device | int |
DeviceMessage.protocol_id | Unique identifier of the protocol | int |
DeviceMessage.position | Current position of the device | dict[str, float, int] |
DeviceMessage.payload | Raw content of the device's raster | dict[str, any] |
DeviceMessage.received_at | Date of receipt of the message. Defined in UTC | datetime |
Let's look an example:
from layrz_sdk.entities.telemetry import DeviceMessage
from datetime import datetime
from zoneinfo import ZoneInfo
device_message = DeviceMessage(
pk=1,
ident="device123",
device_id=1,
protocol_id=1,
position={"latitude": 1.23, "longitude": 4.56, "altitude": 7.89, "speed": 10.11, "direction": 12.34, "hdop": 15.56},
payload={
"device1.param1": "value1",
"device1.param2": "value2",
"device2.param1": "value3",
"device2.param2": "value4"
},
received_at=datetime.now(tz=ZoneInfo('UTC'))
)
device_message.pk
#> 1
device_message.ident
#> "device123"
device_message.device_id
#> 1
device_message.protocol_id
#> 1
device_message.position
#> {"latitude": 1.23, "longitude": 4.56, "altitude": 7.89, "speed": 10.11, "direction": 12.34, "hdop": 15.56}
device_message.payload
#> {"device1.param1": "value1", "device1.param2": "value2", "device2.param1": "value3", "device2.param2": "value4"}
device_message.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)Enums
WaypointKind
| Attribute | Description |
|---|---|
WaypointKind.PATHWAY | This is the identification of the time between one waypoint and another |
WaypointKind.POINT | This refer the time inside of a geofence |
WaypointKind.DOWNLOADING | Downloading phase of Tenvio |
WaypointKind.WASHING | Washing phase of Tenvio |
Classes
Waypoint
| Attribute | Description | Field Type |
|---|---|---|
Waypoint.pk | Unique identifier of the waypoint | int |
Waypoint.geofence | Geofence associated with the waypoint | Geofence |
Waypoint.geofence_id | Unique identifier of the geofence | int, none |
Waypoint.start_at | Start date and time of the waypoint | datetime |
Waypoint.end_at | End date and time of the waypoint | datetime |
Waypoint.sequence_real | Real sequence number | int |
Waypoint.sequence_ideal | Ideal sequence number | int |
Let's look an example:
from layrz_sdk.entities import Waypoint, Geofence
waypoint = Waypoint(
pk=1,
geofence=Geofence(pk=1, name="My Geofence", color="#ff0000"),
geofence_id=1,
start_at=datetime.datetime.now(tz=ZoneInfo('UTC')),
end_at=datetime.datetime.now(tz=ZoneInfo('UTC')) + datetime.timedelta(hours=1),
sequence_real=1,
sequence_ideal=2
)
waypoint.pk
#> 1
waypoint.geofence
#> Geofence(pk=1, name="My Geofence", color="#ff0000")
waypoint.geofence_id
#> 1
waypoint.start_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)
waypoint.end_at
#> datetime.datetime(2022, 2, 24, 8, 22, 52, 317161, tzinfo=<UTC>)
waypoint.sequence_real
#> 1
waypoint.sequence_ideal
#> 2WaypointRef
| Attribute | Description | Field Type |
|---|---|---|
WaypointRef.pk | Unique identifier of the waypoint reference | int |
WaypointRef.geofence_id | Unique identifier of the geofence | int, none |
WaypointRef.time | Time associated with the waypoint reference | timedelta |
WaypointRef.kind | Kind of waypoint reference | WaypointKind |
Let's look an example:
from layrz_sdk.entities import WaypointRef, WaypointKind
waypoint_ref = WaypointRef(
pk=1,
geofence_id=1,
time=datetime.timedelta(seconds=300),
kind=WaypointKind.PATHWAY
)
waypoint_ref.pk
#> 1
waypoint_ref.geofence_id
#> 1
waypoint_ref.time
#> datetime.timedelta(seconds=300)
waypoint_ref.kind
#> WaypointKind.PATHWAY