Skip to content

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

AttributeDescriptionField Type
AtsEntry.pkDefines the ID of the ATS entryint
AtsEntry.old_tank_levelDefines the old tank level in litersfloat
AtsEntry.new_tank_levelDefines the new tank level in litersfloat
AtsEntry.densityDensity of the fuel in kg/m3float
AtsEntry.temperatureTemperature of the fuel in Celsiusfloat
AtsEntry.is_executed_by_commandDefines if the entry was executed by a commandbool

Let's look an example:

python
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
#> True

AtsExitExecutionHistory

AttributeDescriptionField Type
AtsExitExecutionHistory.pkDefines the ID of the ATS exit execution historyint
AtsExitExecutionHistory.from_asset_idDefines the ID of the asset from which the exit was executedint
AtsExitExecutionHistory.to_asset_idDefines the ID of the asset to which the exit was executedint
AtsExitExecutionHistory.statusDefines the status of the exit executionLiteral['PENDING', 'FAILED', 'SUCCESS']
AtsExitExecutionHistory.from_appDefines the ID of the app from which the exit was executedLiteral['ATSWEB', 'ATSMOBILE', 'NFC'] , none
AtsExitExecutionHistory.error_responseDefines the error response of the exit execution, if anystr, none
AtsExitExecutionHistory.generated_by_idDefines the ID of the user who generated the exit executionint
AtsExitExecutionHistory.queue_idDefines the ID of the queue in which the exit execution was placedint , none
AtsExitExecutionHistory.to_asset_mileageDefines the mileage of the asset to which the exit was executedfloat, none
AtsExitExecutionHistory.created_atDefines the date of creation of the exit executiondatetime
AtsExitExecutionHistory.updated_atDefines the date of last update of the exit executiondatetime

Let's look an example:

python
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>)

AtsPossibleEntry

AttributeDescriptionField Type
AtsPossibleEntry.initial_tank_levelDefines the initial tank level in litersfloat
AtsPossibleEntry.tank_accumulatorDefines the tank accumulator in litersfloat
AtsPossibleEntry.is_readyDefines whether the entry is ready for processingbool
AtsPossibleEntry.is_validatedDefines whether the entry is validatedbool
AtsPossibleEntry.start_atDefines the start time of the entrydatetime
AtsPossibleEntry.end_atDefines the end time of the entrydatetime
AtsPossibleEntry.accumulator_historyDefines the history of the tank accumulatorlist[float]
AtsPossibleEntry.is_recalculatedDefines whether the entry is recalculatedbool
AtsPossibleEntry.is_blackboxDefines whether the entry is a blackboxbool
AtsPossibleEntry.is_executed_by_commandDefines whether the entry is executed by commandbool
AtsPossibleEntry.is_ready_by_receptionDefines whether the entry is ready by receptionbool, none
AtsPossibleEntry.false_positive_countDefines the count of false positive detectionsint
AtsPossibleEntry.reception_idDefines the ID of the reception associated with the entryint

Let's look an example:

python
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
#> 1

AtsPossibleExit

AttributeDescriptionField Type
AtsPossibleExit.pkDefines the primary key of the exit entryint
AtsPossibleExit.identifierDefines the identifier of the exit entrystr, none
AtsPossibleExit.initial_tank_volumeDefines the initial tank volume of the exit entryfloat, none
AtsPossibleExit.initial_fluxometerDefines the initial fluxometer of the exit entryfloat, none
AtsPossibleExit.total_litersTotal liters of fuel involved in the exitfloat
AtsPossibleExit.is_readyDefines if the exit entry is ready for processingbool
AtsPossibleExit.is_validatedDefines if the exit entry is validatedbool
AtsPossibleExit.in_progressDefines if the exit entry is in progressbool
AtsPossibleExit.start_atDefines the start time of the exit entrydatetime
AtsPossibleExit.end_atDefines the end time of the exit entrydatetime, none
AtsPossibleExit.is_recalculatedDefines if the exit entry is recalculatedbool
AtsPossibleExit.is_blackboxDefines if the exit entry is a blackboxbool, none
AtsPossibleExit.false_positive_countDefines the count of false positive detectionsint, none

Let's look an example:

python
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
#> 0

AtsReception

AttributeDescriptionField Type
AtsReception.pkDefines the primary key of the receptionint
AtsReception.real_volumeDefines the real volume of the receptionfloat, none
AtsReception.received_atDefines the received time of the receptiondatetime
AtsReception.fuel_typeDefines the fuel type of the receptionstr
AtsReception.is_mergedDefines if the reception is mergedbool
AtsReception.order_idDefines the order ID of the receptionint, none

Let's look an example:

python
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
#> None

Actions

Enums

ActionGeofenceOwnership

AttributeDescription
ActionGeofenceOwnership.NONENot assigned to any owner (Orphan)
ActionGeofenceOwnership.ASSETAssigns the geofence to the owner of the asset
ActionGeofenceOwnership.ACTIONAssigns the geofence to the owner of the action

ActionKind

AttributeDescription
ActionKind.LINKLinks or unkinks an asset or device to the parent asset
ActionKind.PERFORM_OPERATIONPerforms an operation over the activation
ActionKind.SEND_TO_OUTBOUNDSends the action to the outbound service
ActionKind.PERFORM_COMMANDPerforms a command over the activation
ActionKind.TO_MONITOR_CENTERSends the action to the monitor center
ActionKind.TO_CHECKPOINT_ROUTESends the action to the checkpoint route
ActionKind.CORE_PROCESSCore process of the action
ActionKind.CREATE_GEOFENCECreates a geofence for the action
ActionKind.PURCHASE_ORDER_STATUSUpdates the purchase order status
ActionKind.EXCHANGESends the activation to the exchange service

ActionSubKind

AttributeDescription
ActionSubKind.LINKLink asset or user to the parent asset
ActionSubKind.UNUSEDUnused action sub kind, not linked to any action kind
ActionSubKind.UNLINKUnlink asset or user from the parent asset
ActionSubKind.BOTHLink and unlink asset or user to the parent asset

Classes

Action

AttributeDescriptionField Type
Action.pkDefines the ID of the actionint
Action.nameDefines the name of the actionstr
Action.command_idDefines the ID of the command associated with the actionint, none
Action.subkindDefines the subkind of the actionActionSubKind
Action.wait_for_imageWhether to wait for an image to be taken before executing the actionbool
Action.geofence_categoryDefines the category of the geofence associated with the actionGeofenceCategory
Action.geofence_name_formulaDefines the name formula of the geofence associated with the actionstr
Action.geofence_radiusDefines the radius of the geofence associated with the actionfloat , none
Action.mappit_route_idRoute ID for Mappit integrationint, none
Action.new_geofence_ownershipDefines the new ownership of the geofence associated with the actionActionGeofenceOwnership

Let's look an example:

python
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.ASSET

Broadcasts

Enums

BroadcastStatus

AttributeDescription
BroadcastStatus.OKThe message was sent successfully
BroadcastStatus.BADREQUESTThe message was sent but was rejected by the service
BroadcastStatus.INTERNALERRORThe message cannot be send due a internal error
BroadcastStatus.UNAUTHORIZEDThe message cannot be send due an issue with credentials or service is down
BroadcastStatus.UNPROCESSABLEThe message was sent but was rejected by the service (Unexpected rejection)
BroadcastStatus.DISCONNECTEDThe message was sent successfully and performed a disconnection procedure

Classes

BroadcastRequest

AttributeDescriptionField Type
BroadcastRequest.parsedDefines the JSON data sent to the servicedict
BroadcastRequest.rawDefines the raw data sent to the servicestr

Let's look an example:

python

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

AttributeDescriptionField Type
BroadcastResponse.parsedDefines the JSON structure of the service's responsedict
BroadcastResponse.rawDefines the raw data of the service's responsestr

Let's look an example:

python

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

AttributeDescriptionField Type
BroadcastResult.service_idIt's the ID of the outbound serviceint
BroadcastResult.asset_idIt's the ID of the assetint
BroadcastResult.statusDefines the status of the submissionBroadcastStatus
BroadcastResult.requestDefines the data sent to the serviceBroadcastRequest
BroadcastResult.responseDefines the response of the serviceBroadcastResponse
BroadcastResult.submitted_atDefines the date of the submissiondatetime

Let's look an example:

python
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

AttributeDescriptionField Type
BroadcastService.pkDefines the ID of the serviceint
BroadcastService.nameDefines the name of the servicestr
BroadcastService.credentialsDefines the credentials of the servicedict[str, Any]

Let's look an example:

python
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

AttributeDescriptionField Type
BroadcastPayload.assetIt's Asset objectAsset
BroadcastPayload.primary_deviceIt's Primary device objectDevice
BroadcastPayload.triggerTrigger object, if availableTrigger
BroadcastPayload.message_idIt's the ID of the messageint, str
BroadcastPayload.serviceIt's the ID of the serviceBroadcastService
BroadcastPayload.positionIt's the position data, if availabledict[str, Any]
BroadcastPayload.sensorsIt's the sensor data, if availabledict[str, Any]
BroadcastPayload.payloadIt's the payload data, if availabledict[str, Any]
BroadcastPayload.received_atIt's Broadcast payload received datedatetime

Let's look an example:

python
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

AttributeDescriptionField Type
OutboundService.pkDefines the ID of the outbound serviceint
OutboundService.nameDefines the name of the outbound servicestr
OutboundService.protocol_nameDefines the protocol name of the outbound servicestr, none
OutboundService.mqtt_topicDefines the MQTT topic of the outbound servicestr, none
OutboundService.is_consumptedDefines if the outbound service is consumptedbool
OutboundService.credentialsDefines the credentials of the outbound servicedict[str, Any]

Let's look an example:

python
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

AttributeDescriptionField Type
ExchangeService.pkDefines the ID of the exchange serviceint
ExchangeService.nameDefines the name of the exchange servicestr
ExchangeService.credentialsDefines the credentials of the exchange servicedict[str, Any]
ExchangeService.protocol_idDefines the protocol ID of the exchange serviceint, none
ExchangeService.flespi_tokenDefines the Flespi token of the exchange servicestr, none
ExchangeService.owner_idDefines the owner ID of the exchange serviceint, none

Let's look an example:

python
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
#> None

Cases

Enums

CaseIgnoredStatus

AttributeDescription
CaseIgnoredStatus.NORMALThe case was closed normally.
CaseIgnoredStatus.IGNOREDThe case was ignored in our monitors
CaseIgnoredStatus.PRESSETThe case was closed automatically by a preset
CaseIgnoredStatus.AUTOThe case was closed automatically by a expiry time

CaseStatus

AttributeDescription
CaseStatus.PENDINGThe case is pending or waiting for attention
CaseStatus.FOLLOWEDThe case is in following state, or a user is currently following the case
CaseStatus.CLOSEDThe case was closed

Classes

Case

AttributeDescriptionDatatype
Case.pkCase IDint
Case.triggerTrigger that activated the caseTrigger
Case.asset_idID of the asset associated with the caseint
Case.opened_atCase receipt datedatetime
Case.closed_atCase closing datedatetime
Case.commentsList of case comments submittedlist[Comment]
Case.statusStatus of the caseCaseStatus
Case.ignored_statusIgnored status of the caseCaseIgnoredStatus
Case.sequenceSequence of the case, This is a unique identifier for the caseint, str

Let's look an example:

python
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
#> 1

Comment

AttributeDescriptionField Type
Comment.pkComment IDint
Comment.contentComment contentstr
Comment.userUser which sent the commentUser
Comment.submitted_atComment date sentdatetime

Let's look an example:

python
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

AttributeDescriptionField Type
Trigger.pkTrigger IDint
Trigger.nameTrigger Namestr
Trigger.codeUnique trigger codestr
Trigger.cooldown_timeTrigger cooldown timetimedelta
Trigger.type_Defines the kind of the triggerTriggerKind
Trigger.presence_typeDefines the geofence kind of the triggerTriggerGeofenceKind
Trigger.case_typeDefines the case kind of the triggerTriggerCaseKind
Trigger.case_comment_patternDefines the comment pattern of the triggerTriggerCommentPattern
Trigger.case_comment_valueDefines the comment pattern value of the triggerstr, none
Trigger.exact_hourDefines the exact hour of the triggertime, none
Trigger.crontab_formatDefines the crontab format of the triggerstr, none
Trigger.weekdaysDefines the weekdays of the triggerlist[Weekday]
Trigger.is_plain_crontabDefines if the trigger is a plain crontabbool
Trigger.timezone_idDefines the timezone ID of the triggerint , none
trigger.parametersDefines the parameters of the triggerlist[str]
Trigger.manual_action_fieldsDefines the fields for manual action in the triggerlist[dict[str, Any]]
Trigger.formulaDefines the formula of the trigger, this formula is only LCL (Layrz Computation Language) compatiblestr, none
Trigger.is_legacyDefines if the trigger is legacy, normally when a version of the trigger is not compatible with the current version of the SDKbool
Trigger.priorityDefines the priority of the triggerint
Trigger.colorDefines the color of the triggerstr , none
Trigger.sequenceDefines the sequence of the triggerint
Trigger.care_protocol_idDefines the care protocol ID of the triggerint, none
Trigger.owner_idOwner IDint, none
Trigger.search_time_deltaDefines the search time delta of the triggertimedelta, none

Let's look an example:

python
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

AttributeDescription
Weekday.MONDAYRepresents Monday
Weekday.TUESDAYRepresents Tuesday
Weekday.WEDNESDAYRepresents Wednesday
Weekday.THURSDAYRepresents Thursday
Weekday.FRIDAYRepresents Friday
Weekday.SATURDAYRepresents Saturday
Weekday.SUNDAYRepresents Sunday

TriggerKind

AttributeDescription
TriggerKind.FORMULATrigger is a formula trigger
TriggerKind.PRESENCE_IN_GEOFENCETrigger is a presence in geofence trigger
TriggerKind.EXACT_TIMETrigger is an exact time trigger
TriggerKind.AUTHENTICATIONTrigger is an authentication trigger
TriggerKind.PYTHON_SCRIPTTrigger is a Python script trigger
TriggerKind.CASES_CHANGESTrigger is a cases changes trigger
TriggerKind.BHS_SPEEDINGTrigger is a BHS speeding trigger
TriggerKind.BHS_PRESENCETrigger is a BHS presence trigger
TriggerKind.MANUAL_ACTIONTrigger is a manual action trigger
TriggerKind.NESTEDTrigger is a nested trigger

TriggerGeofenceKind

AttributeDescription
TriggerGeofenceKind.ENTRANCETrigger is an entrance geofence trigger
TriggerGeofenceKind.EXITTrigger is an exit geofence trigger
TriggerGeofenceKind.BOTHTrigger is a both geofence trigger (entrance and exit)

TriggerCaseKind

AttributeDescription
TriggerCaseKind.ON_FOLLOWTrigger is activated on follow events
TriggerCaseKind.ON_COMMENT_PATTERNTrigger is activated on comment pattern events
TriggerCaseKind.ON_DISMISSTrigger is activated on dismiss events
TriggerCaseKind.ON_CLOSETrigger is activated on close events

TriggerCommentPattern

AttributeDescription
TriggerCommentPattern.STARTS_WITHTrigger is activated when the comment starts with a specific pattern
TriggerCommentPattern.CONTAINSTrigger is activated when the comment contains a specific pattern
TriggerCommentPattern.ENDS_WITHTrigger is activated when the comment ends with a specific pattern

Charts

Enums

ChartAlignment

AttributeDescription
ChartAlignment.LEFTAlign the chart to the left
ChartAlignment.RIGHTAlign the chart to the right
ChartAlignment.CENTERCenter the chart

ChartColor

AttributeDescription
ChartColor.REDColor the series red
ChartColor.BLUEColor the series blue
ChartColor.GREENColor the series green
ChartColor.PURPLEColor the series purple
ChartColor.ORANGEColor the series orange
ChartColor.PINKColor the series pink
ChartColor.TEALColor the series teal
ChartColor.AMBERColor the series amber
ChartColor.CYANColor the series cyan
ChartColor.INDIGOColor the series indigo
ChartColor.LIMEColor the series lime

ChartDataSerieType

AttributeDescription
ChartDataSerieType.NONEThe serie type is not defined
ChartDataSerieType.LINEThe serie type is a line
ChartDataSerieType.AREAThe serie type is an area
ChartDataSerieType.SCATTERThe serie type is a scatter

ChartDataType

AttributeDescription
ChartDataType.STRINGDefines the data type as a string
ChartDataType.DATETIMEDefines the data type as a datetime
ChartDataType.NUMBERDefines the data type as a number

ChartRenderTechnology

AttributeDescription
ChartRenderTechnology.CANVAS_JSUse CanvasJS to render the graphs. Exclusive for line charts
ChartRenderTechnology.GRAPHICUse graphic to render the graphs
ChartRenderTechnology.SYNCFUSION_FLUTTER_CHARTSUse syncfusion_flutter_charts to render the graphs
ChartRenderTechnology.FLUTTER_MAPUse flutter_map to render the graphs
ChartRenderTechnology.APEX_CHARTSUse apex_charts to render the graphs. Exclusive for maps
ChartRenderTechnology.FLUTTERUse native flutter to render the graphs. Exclusive to number and table charts

MapCenterType

AttributeDescription
MapCenterType.FIXEDSet the map center to a fixed point
MapCenterType.CONTAINSet the map center dynamically to contain all points

Classes

AreaChart

This class will be removed in the next version. Use LineChart instead.

AttributeDescriptionField Type
AreaChart.titleDefines the title of the chartstr
AreaChart.alignDefines the alignment of the chartChartAlignment
AreaChart.x_axisDefines the X axis (Horizontal)ChartDataSerie
AreaChart.y_axisDefines the Y Axis (Vertical)list[ChartDataSerie]
AreaChart.x_axis_configDefines the configuration for the X Axis (Horizontal)AxisConfig
AreaChart.y_axis_configDefines the configuration for the Y Axis (Vertical)AxisConfig

Let's look an example:

python
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

AttributeDescriptionField Type
AxisConfig.labelLabel to display on the axisstr
AxisConfig.measure_unitMeasure unit of the axisstr
AxisConfig.min_valueMinimum value of the axisfloat
AxisConfig.max_valueMaximum value of the axisfloat
AxisConfig.data_typeData type of the axisChartDataType

Let's look at an example:

python
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

AttributeDescriptionField Type
BarChart.titleDefines the title of the chartstr
BarChart.alignDefines the alignment of the chartChartAlignment
BarChart.x_axisDefines the X axis (Horizontal)ChartDataSerie
BarChart.y_axisDefines the Y Axis (Vertical)list[ChartDataSerie]
AreaChart.x_axis_configDefines the configuration for the X Axis (Horizontal)AxisConfig
AreaChart.y_axis_configDefines the configuration for the Y Axis (Vertical)AxisConfig

Let's look an example:

python
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

AttributeDescriptionField Type
ChartConfiguration.nameDefines the name of the chartstr
ChartConfiguration.descriptionDefines the description of the chartstr

Let's look an example:

python
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

AttributeDescriptionField Type
ChartDataSerie.dataList of data pointsany
ChartDataSerie.serie_typeType of the serie. Only used for mixed range chartsChartDataSerieType
ChartDataSerie.dashedIf the serie should be dashedbool
ChartDataSerie.colorColor of the serie as a hexadecimal color codestr
ChartDataSerie.labelLabel of the seriestr
ChartDataSerie.data_typeType of the dataChartDataType

Let's look an example:

python

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

AttributeDescriptionField Type
ChartException.messageDefines an exception of the chartstr
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:

python
from layrz_sdk.entities import ChartException

chart_exception = ChartException(
  message="My Chart Exception"
)

chart_exception.message
#> "My Chart Exception"

ColumnChart

AttributeDescriptionField Type
ColumnChart.titleDefines the title of the chartstr
ColumnChart.alignDefines the alignment of the chartChartAlignment
ColumnChart.x_axisDefines the X axis (Horizontal)ChartDataSerie
ColumnChart.y_axisDefines the Y Axis (Vertical)list[ChartDataSerie]
ColumnChart.x_axis_configDefines the configuration for the X Axis (Horizontal)AxisConfig
ColumnChart.y_axis_configDefines the configuration for the Y Axis (Vertical)AxisConfig

Let's look an example:

python
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

AttributeDescriptionField Type
HTMLChart.titleDefines the title of the chartstr
HTMLChart.contentDefines the content of the chart, this content should be HTMLstr

Let's look an example:

python

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

AttributeDescriptionField Type
LineChart.titleDefines the title of the chartstr
LineChart.alignDefines the alignment of the chartChartAlignment
LineChart.x_axisDefines the X axis (Horizontal)ChartDataSerie
LineChart.y_axisDefines the Y Axis (Vertical)list[ChartDataSerie]
LineChart.x_axis_configDefines the configuration for the X Axis (Horizontal)AxisConfig
LineChart.y_axis_configDefines the configuration for the Y Axis (Vertical)AxisConfig

Let's look an example:

python
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

AttributeDescriptionField Type
MapChart.titleDefines the title of the chartstr
MapChart.centerDefines where is the center of the mapMapCenterType
MapChart.pointsDefines the list of points to displaylist[MapPoint]
MapChart.center_latlngDefines 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 twotuple[float, float] | list[float]

Let's look an example:

python

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

AttributeDescriptionField Type
MapPoint.latitudeDefines the latitude in decimal degreesfloat
MapPoint.longitudeDefines the longitude in decimal degreesfloat
MapPoint.labelDefines the label or name of the pointstr
MapPoint.colorDefines the color (In HEX) of the pointstr

Let's look an example:

python
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

AttributeDescriptionField Type
NumberChart.valueDefines the number to displayfloat
NumberChart.colorDefines the color to display in hexadecimal codestr
NumberChart.labelDefines the name or label to displaystr

Let's look an example:

python

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

AttributeDescriptionField Type
PieChart.titleDefines the title of the chartstr
PieChart.alignDefines the alignment of the chartChartAlignment
PieChart.serieDefines the series to displaylist[ChartDataSerie]

Let's look an example:

python
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

AttributeDescriptionField Type
RadarChart.titleDefines the title of the chartstr
RadarChart.alignDefines the alignment of the chartChartAlignment
RadarChart.x_axisDefines the X axis (Horizontal)ChartDataSerie
RadarChart.y_axisDefines the Y Axis (Vertical)list[ChartDataSerie]

Let's look an example:

python
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

AttributeDescriptionField Type
RadialBarChart.titleTitle of the chartstr
RadialBarChart.alignAlignment of the chartChartAlignment
RadialBarChart.serieDefines the series of the chart, uses the ChartDataSerie class.list[ChartDataSerie]

Let's look an example:

python
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

AttributeDescriptionField Type
ScatterChart.titleTitle of the chartstr
ScatterChart.alignAlignment of the chartChartAlignment
ScatterChart.seriesDefines the series of the chart, uses the ScatterSerie class.list[ScatterSerie]
ScatterChart.x_axis_configDefines the configuration for the X Axis (Horizontal)AxisConfig
ScatterChart.y_axis_configDefines the configuration for the Y Axis (Vertical)AxisConfig
python
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

AttributeDescriptionField Type
ScatterSerie.labelLabel of the seriestr
ScatterSerie.dataList of data pointslist[ScatterSerieItem]
ScatterSerie.colorColor of the serie in hexadecimal codestr
ScatterSerie.serie_typeType of the serieChartDataSerieType

Let's look an example:

python

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.SCATTER

ScatterSerieItem

AttributeDescriptionField Type
ScatterSerieItem.xX value of the itemfloat
ScatterSerieItem.yY value of the itemfloat

Let's look an example:

python

from layrz_sdk.entities import ScatterSerieItem

scatter_serie_item = ScatterSerieItem(
  x=1,
  y=2
)

scatter_serie_item.x
#> 1
scatter_serie_item.y
#> 2

TableChart

AttributeDescriptionField Type
TableChart.columnsList of columnslist[TableHeader]
TableChart.rowsList of rowslist[TableRow]

Let's look an example:

python

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

AttributeDescriptionField Type
TableHeader.labelThe label of the columnstr
TableHeader.keyThe key of the column, this key should be present in each rowstr

Let's look an example:

python

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

AttributeDescriptionField Type
TableRow.dataThe data of the row, the keys comes from the headersAny

Let's look an example:

python

from layrz_sdk.entities import TableRow

table_row = TableRow(
  data={"key1": "value1", "key2": "value2"}
)

table_row.data
#> {"key1": "value1", "key2": "value2"}

TimelineChart

AttributeDescriptionField Type
TimelineChart.titleTitle of the chartstr
TimelineChart.alignAlignment of the chartChartAlignment
TimelineChart.seriesDefines the series of the chart, uses the TimelineSerie class.list[TimelineSerie]

Let's look an example:

python

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

AttributeDescriptionField Type
TimelineSerie.labelLabel of the serie.str
TimelineSerie.dataList of data points.list[TimelineSerieItem]

Let's look an example:

python

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

AttributeDescriptionField Type
TimelineSerieItem.start_atStart date of the item.datetime
TimelineSerieItem.end_atEnd date of the item.datetime
TimelineSerieItem.colorColor of the item in hexadecimal code.str
TimelineSerieItem.nameLabel of the item.str

Let's look an example:

python

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

ValueDescription
ChartAlignment.FLEXDefines a flexible operation mode for the checkpoint
ChartAlignment.STRICTDefines a strict operation mode for the checkpoint

Classes

Checkpoint

AttributeDescriptionDatatype
Checkpoint.pkCheckpoint IDint
Checkpoint.asset_idActive harassed at the checkpointint
Checkpoint.waypointsCheckpoint waypoint listlist[Waypoint]
Checkpoint.start_atCheckpoint start datedatetime
Checkpoint.end_atWaypoint end datedatetime

Let's look an example:

python
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

AttributeDescriptionDatatype
CheckpointRef.pkCheckpoint IDint
CheckpointRef.nameCheckpoint namestr
CheckpointRef.waypointsList of waypointslist[Waypoint]
CheckpointRef.operation_modeOperation modeCheckpointOperationMode

Let's look an example:

python
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.FLEX

Waypoint

AttributeDescriptionField Type
Waypoint.pkWaypoint IDint
Waypoint.geofenceAssociated geofenceGeofence
Waypoint.sequence_realActual or executed sequenceint
Waypoint.sequence_idealIdeal or planned sequenceint
Waypoint.start_atDate of entry to waypointdatetime
Waypoint.end_atWaypoint exit datedatetime

Let's look an example:

python
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

AttributeDescriptionDatatype
Event.pkEvent IDint
Event.triggerTrigger object that fired the eventTrigger
Event.asset_idID of the asset associated with the eventint
Event.messageEvent telemetry informationMessage
Event.activated_atEvent activation datedatetime
Event.geofenceGeofence where the event ocurredGeofence
Event.presence_typePresence type of the eventPresenceType

Let's look an example:

python
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.ENTRANCE

Formatting

Enums

TextAlignment

AttributeDescription
TextAlignment.CENTERAlign the text to the center
TextAlignment.LEFTAlign the text to the left
TextAlignment.RIGHTAlign the text to the right
TextAlignment.JUSTIFYJustify the text

General

Enums

AssetOperationMode

AttributeDescription
AssetOperationMode.SINGLERefers to single device operation mode
AssetOperationMode.MULTIPLERefers 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.ASSETMULTIPLEThis refers to the operation mode with one or more assets, when this is the operation mode, list will be empty
AssetOperationMode.DISCONNECTEDDisconnected operation mode, means the telemetry is not provided by any device
AssetOperationMode.STATICStatic operation mode, means that the position information is provided by the user and the telemetry is provided by any device (Not mandatory)
AssetOperationMode.ZONEZone 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

AttributeDescription
PresenceType.ENTRANCEEntrance to a geofence
PresenceType.EXITExit out of a geofence

CommandSeriesTicketStatus

AttributeDescription
CommandSeriesTicketStatus.PENDINGThe ticket is pending to be processed
CommandSeriesTicketStatus.IN_SERVICEThe ticket is currently being processed
CommandSeriesTicketStatus.TO_JOBThe ticket is ready to be executed by the job
CommandSeriesTicketStatus.AT_JOBThe ticket is currently being executed by the job
CommandSeriesTicketStatus.POURINGThe ticket is currently being poured
CommandSeriesTicketStatus.TO_PLANTThe ticket is ready to be sent to the plant
CommandSeriesTicketStatus.IN_YARDThe ticket is currently in the yard
CommandSeriesTicketStatus.OUT_OF_SERVICEThe ticket is out of service, it means that the ticket is not being processed anymore

GeofenceCategory

AttributeDescription
GeofenceCategory.NONEClassic or uncategorized geofence
GeofenceCategory.CUSTOMGeofence with non-standard category
GeofenceCategory.ADMINISTRATIVEGeofence as administrative area
GeofenceCategory.CUSTOMERGeofence as customer location
GeofenceCategory.PROSPECTSimilar to customer location but not yet a customer
GeofenceCategory.OTHERGeofence as other location
GeofenceCategory.POLYGONGeofence as search geozone
GeofenceCategory.LEADGeofence as lead location, not yet a prospect or customer

TwilioNotificationType

AttributeDescription
TwilioNotificationType.SMSShort Message Service (SMS) notification type, used for sending text messages
TwilioNotificationType.VOICEVoice notification type, used for making phone calls
TwilioNotificationType.WHATSAPPWhatsApp notification type, used for sending messages via WhatsApp

Platform

AttributeDescription
Platform.ANDROIDAndroid platform
Platform.IOSiOS platform
Platform.WEBWeb platform
Platform.WINDOWSWindows platform
Platform.MACOSmacOS platform
Platform.LINUXLinux platform
Platform.LAYRZ_OSLayrz OS for embedding systems

HttpRequestType

AttributeDescription
HttpRequestType.GETHTTP GET request type, used to retrieve data from a server
HttpRequestType.POSTHTTP POST request type, used to send data to a server
HttpRequestType.PUTHTTP PUT request type, used to update data on a server
HttpRequestType.PATCHHTTP PATCH request type, used to partially update data on a server

SoundEffect

AttributeDescription
SoundEffect.NONENo sound effect
SoundEffect.BEEPA short, sharp electronic sound, often associated with alerts or signals
SoundEffect.MECHANICALA sound resembling a machine or device, characterized by clicking, whirring, or other industrial tones
SoundEffect.PEALA clear, ringing sound, reminiscent of a bell or a chime
SoundEffect.SIRENA loud, wailing sound, typically used for emergency alerts or warnings
SoundEffect.POPA quick, soft burst-like sound, similar to a bubble popping
SoundEffect.RESONANTA deep, echoing tone with a lasting vibration or reverberation
SoundEffect.TONEA steady, smooth sound with a consistent pitch, often used in signals or melodies
SoundEffect.CUSTOMA custom sound effect that can be set by the user

Classes

Asset

AttributeDescriptionDatatype
Asset.pkUnique identifier of the asset, this ID is unique throughout the entire Layrz ecosystem.int
Asset.nameAsset namestr
Asset.devicesList 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_primarylist[Device]
Asset.vinIt is equivalent to the body serial number of a vehicle, machinery serial number, or any type of unique serial number.str, none
Asset.plateIt is equivalent to a vehicle license plate, tax registration number, citizen identification number, or any other type of unique identifier.str
Asset.asset_typeIndicates the type of asset, this value will be an ID.int
Asset.operation_modeIndicates the operating mode of the asset.AssetOperationMode
Asset.custom_fieldsList of custom fields for the asset.list[CustomField]
Asset.childrenList of assets associated with this asset, it will only return a list with values ​​when the operation mode is AssetOperationMode.ASSETMULTIPLE.list[Asset]
Asset.sensorsList of sensors of the asset.list[Sensor]
Asset.kind_idIndicates the kind of asset, this value will be an ID.int
Asset.static_positionIndicates the static position of the asset.StaticPosition
Asset.pointsIndicates the points associated with the asset.list[StaticPosition]
Asset.primary_idIndicates the primary device ID of the asset, this value will be an ID.int, none
Asset.contactsList of contacts associated with the asset.list[AssetContact]
Asset.owner_idIndicates the owner ID of the asset, this value will be an ID.int, none

Let's look an example:

python
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
#> 1

AssetConstants

AttributeDescriptionDatatype
AssetContact.distance_traveledTotal distance traveled by the asset in metersfloat
AssetContact.primary_devicePrimary device associated with the assetstr
AssetContact.elapsed_timeTotal elapsed time for the asset in secondstimedelta

Let's look an example:

python
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

AttributeDescriptionDatatype
AssetContact.nameName of the contact associated with the assetstr
AssetContact.phonePhone number of the contact associated with the assetstr
AssetContact.emailEmail address of the contact associated with the assetstr

Let's look an example:

python
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

AttributeDescription
AssetOperationMode.SINGLERefers to single device operation mode
AssetOperationMode.MULTIPLERefers 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.ASSETMULTIPLEThis refers to the operation mode with one or more assets, when this is the operation mode, list will be empty
AssetOperationMode.DISCONNECTEDDisconnected operation mode, means the telemetry is not provided by any device
AssetOperationMode.STATICStatic operation mode, means that the position information is provided by the user and the telemetry is provided by any device (Not mandatory)
AssetOperationMode.ZONEZone 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

AttributeDescriptionField Type
CustomField.pkPrimary key of the custom fieldint
CustomField.nameRefers to the name or key with which this custom field is identified. It is always the same data typestr
CustomField.valueRefers to the value of the custom field. It is always the same data typestr
CustomField.is_fixedIndicates 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:

python

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
#> True

Device

AttributeDescriptionField Type
Device.pkThis is the Device ID, this ID is unique on all Layrz ecosystemint
Device.nameDevice's namestr
Device.identUnique identifier or IMEI's Devicestr
Device.protocolThis is the unique protocol's identifierstr
Device.protocol_idThis is the unique protocol's ID, this ID is unique on all Layrz ecosystemint, none
Device.is_primaryPrimary 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.modbusModbus configurationModbusConfig

Let's look an example:

python
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
#> True

Geofence

AttributeDescriptionField Type
Geofence.pkGeofence idint
Geofence.nameGeofence Namestr
Geofence.colorGeofence Color (In Hexadecimal format)str

Let's look an example:

python
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

AttributeDescriptionDatatype
StaticPosition.latitudeLatitude of the static positionfloat
StaticPosition.longitudeLongitude of the static positionfloat
StaticPosition.altitudeAltitude of the static positionfloat

Let's look an example:

python
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.89

Sensor

AttributeDescriptionDatatype
Sensor.pkUnique sensor ID, this ID is unique throughout the entire Layrz ecosystem.int
Sensor.nameRefers to the name of the sensor.str
Sensor.slugRefers to the parameter or key of the sensor, this value cannot overlap with other sensors of the same asset.str
Sensor.formulaDefines the formula of the sensor, used for calculationsstr

Let's look an example:

python
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

AttributeDescriptionField Type
User.pkUser IDint
User.nameUser namestr

Let's look an example:

python
from layrz_sdk.entities import User

user = User(
  pk=1,
  name="User"
)

user.pk
#> 1
user.name
#> "User"

Comment

AttributeDescriptionField Type
Comment.pkComment IDint
Comment.contentContent of the commentstr
Comment.userUser who made the commentUser
Comment.submitted_atDate and time when the comment was submitteddatetime

Let's look an example:

python
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

AttributeDescriptionField Type
CommandSeriesTicket.pkTicket IDint
CommandSeriesTicket.service_idService ID associated with the ticketint
CommandSeriesTicket.statusStatus of the ticketCommandSeriesTicketStatus
CommandSeriesTicket.ticket_idTicket ID associated with the command seriesstr
CommandSeriesTicket.ticket_codeTicket code associated with the command seriesstr
CommandSeriesTicket.ticket_atDate and time when the ticket was createddatetime
CommandSeriesTicket.source_idSource ID associated with the ticketint, none
CommandSeriesTicket.sourceSource name associated with the ticketGeofence , none
CommandSeriesTicket.job_idJob ID associated with the command seriesint, none
CommandSeriesTicket.jobJob name associated with the command seriesGeofence, none
CommandSeriesTicket.destination_idDestination ID associated with the command seriesint, none
CommandSeriesTicket.destinationDestination name associated with the command seriesGeofence, none
CommandSeriesTicket.asset_idAsset ID associated with the command seriesint, none
CommandSeriesTicket.assetAsset name associated with the command seriesAsset
CommandSeriesTicket.trigger_idTrigger ID associated with the command seriesint, none
CommandSeriesTicket.triggerTrigger name associated with the command seriesTrigger , none
CommandSeriesTicket.action_idAction ID associated with the command seriesint, none
CommandSeriesTicket.actionAction name associated with the command series[Action, none] (#action)
CommandSeriesTicket.created_atDate and time when the command series was createddatetime
CommandSeriesTicket.updated_atDate and time when the command series was last updateddatetime

Let's look an example:

python
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

AttributeDescriptionField Type
DestinationPhone.phone_numberPhone number of the destinationstr
DestinationPhone.country_codeCountry code of the destination phone numberstr

Let's look an example:

python
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

AttributeDescriptionField Type
Function.pkFunction IDint
Function.nameFunction namestr
Function.maximum_timeMaximum execution time for the functiontimedelta, none
Function.minutes_deltaTime interval in minutes for the function to be executedtimedelta, none
Function.external_identifiersExternal identifiers for the functionlist[str]
Function.credentialsCredentials required for the functiondict[str, Any]
Function.assetsAssets used by the functionlist[Asset]
Function.owner_idOwner ID of the functionint, none
Function.algorithm_idAlgorithm ID used by the functionint, none

Let's look an example:

python
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
#> 1

Preset

AttributeDescriptionField Type
Preset.pkPreset IDint
Preset.namePreset namestr
Preset.valid_beforeExpiration date of the presetdatetime
Preset.commentComment associated with the presetstr
Preset.owner_idOwner ID of the presetint

Let's look an example:

python
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
#> 1

Timezone

AttributeDescriptionField Type
Timezone.pkTimezone IDint
Timezone.nameTimezone namestr
Timezone.utc_offsetUTC offset of the timezoneint

Let's look an example:

python
from layrz_sdk.entities import Timezone
timezone = Timezone(
  pk=1,
  name="UTC",
  utc_offset=0
)
timezone.pk
#> 1
timezone.name
#> "UTC"
timezone.utc_offset
#> 0

Modbus

Enums

ModbusSchema

AttributeDescription
ModbusSchema.SINGLEDefines a single Modbus request
ModbusSchema.MULTIPLEDefines multiple Modbus requests

ModbusStatus

AttributeDescription
ModbusStatus.PENDINGDefines the pending state, indicating that the request is waiting to be processed
ModbusStatus.WAITING_FOR_SENDDefines the waiting state, indicating that the request is ready to be sent but has not yet been dispatched
ModbusStatus.SENTDefines the sent state, indicating that the request has been sent to the device
ModbusStatus.ACK_RECEIVEDDefines the acknowledgment received state, Indicates that an acknowledgment has been received from the device
ModbusStatus.CANCELLEDDefines the error state, Indicates that the request has been cancelled

Classes

ModbusConfig

AttributeDescriptionField Type
ModbusConfig.port_idDefines the port ID for the Modbus requeststr
ModbusConfig.is_enabledDefines whether the Modbus request is enabledbool
ModbusConfig.parametersList of Modbus parameters to be used in communicationlist[ModbusParameter]

Let's look an example:

python
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

AttributeDescriptionField Type
ModbusParameter.schema_Defines the Modbus parameterModbusSchema
ModbusParameter.split_eachNumber of bytes to split each Modbus parameterint
ModbusParameter.data_lengthLength of data for the Modbus parameter, from Hexadecimal representationint
ModbusParameter.data_addressAddress of the data for the Modbus parameterint
ModbusParameter.function_codeFunction code for the Modbus parameterint
ModbusParameter.controller_addressAddress of the controller for the Modbus parameterint

Let's look an example:

python
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
#> 1

ModbusWait

AttributeDescriptionField Type
ModbusWait.statusDefines the status of the Modbus wait operationModbusStatus
ModbusWait.structureDefines the structure of the Modbus wait operationModbusSchema
ModbusWait.port_idDefines the port ID for the Modbus wait operationint
ModbusWait.split_eachNumber of bytes to split each Modbus parameterint
ModbusWait.data_lengthLength of data for the Modbus wait operation, from Hexadecimal representationint
ModbusWait.data_addressAddress of the data for the Modbus wait operationint
ModbusWait.function_codeFunction code for the Modbus wait operationint
ModbusWait.controller_addressAddress of the controller for the Modbus wait operationint

Let's look an example:

python
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
#> 1

Operations

Enums

OperationType

AttributeDescription
OperationType.WEBHOOKSAll the operations by http request
OperationType.SEND_EMAILSend notifications emails
OperationType.REGISTER_ON_ASSETRegister an event for the asset
OperationType.IN_APP_NOTIFICATIONSend notifications inside the app
OperationType.TWILIOSend notifications using Twilio
OperationType.MOBILE_POPUP_NOTIFICATIONSend mobile popup notifications
OperationType.BHS_PUSHSend notifications using Firebase Push Notifications of Brickhouse Tracking Platform

Classes

Operation

AttributeDescriptionField Type
Operation.pkDefines the primary key of the triggerint
Operation.nameDefines the name of the triggerstr
Operation.cooldown_timeDefines the cooldown time for the triggertimedelta
Operation.operation_typeDefines the type of the operationOperationType
Operation.request_typeDefines the request type for the operationHttpRequestType
Operation.urlDefines the request URL for the operationstr, none
Operation.headersDefines the request headers for the operationlist[dict[str, Any]]
Operation.reception_emailsDefines the reception emails for the operationlist[str]
Operation.language_idDefines the language ID for the operationint
Operation.payloadDefines the payload for the operationstr
Operation.timezone_idDefines the timezone ID for the operationint, none
Operation.email_subjectDefines the email subject for the operationstr
Operation.colorDefines the color for the operationstr
Operation.account_idDefines the account ID for the operationint, str, none
Operation.notification_typeDefines the notification type for the operationTwilioNotificationType
Operation.host_phoneDefines the destination phone for the operationDestinationPhone
Operation.usernameDefines the username for the operationstr, none
Operation.tokenDefines the token for the operationstr, none
Operation.destination_phonesDefines the destination phones for the operationlist[DestinationPhone]
Operation.attach_imageDefines the image attachment for the operationbool
Operation.use_asset_contacts_insteadDefines if the operation should use asset contacts instead of reception emailsbool
Operation.email_template_idDefines the email template ID for the operationint, none
Operation.push_platformsDefines the push platforms for the operationlist[Platform]
Operation.push_titleDefines the push title for the operationstr
Operation.requires_bhs_validationDefines if the operation requires BHS validationbool
Operation.bhs_tier_idDefines the BHS tier ID for the operationint, none
Operation.sound_effectDefines the sound effect for the operationSoundEffect
Operation.sound_effect_uriDefines the URI for the sound effectstr, none
Operation.durationDefines the duration for the operationtimedelta
Operation.credentialsDefines the credentials for the operationdict[str, Any]
Operation.timezoneDefines the timezone for the operationtimezone, none
Operation.iconDefines the icon for the operationstr, none

Let's look an example:

python
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

AttributeDescriptionField Type
OperationPayload.kindDefines the kind of payloadOperationType
OperationPayload.assetDefines the asset associated with the payloadAsset
OperationPayload.triggerDefines the trigger associated with the payloadTrigger
OperationPayload.operationDefines the operation associated with the payloadOperation
OperationPayload.activated_atDefines the date and time when the payload was activateddatetime
OperationPayload.positionDefines the position associated with the payloaddict[str, Any]
OperationPayload.sensorsDefines the sensors associated with the payloaddict[str, Any]
OperationPayload.geofenceDefines the geofence associated with the payloadGeofence
OperationPayload.presence_typeDefines the presence type associated with the payloadPresenceType
OperationPayload.case_Defines the case associated with the payloadOperationCasePayload
OperationPayload.language_idDefines the language ID associated with the payloadint
OperationPayload.payloadDefines the payload datastr
OperationPayload.use_asset_contacts_insteadDefines if the operation should use asset contacts instead of reception emailsbool
OperationPayload.account_idDefines the account ID associated with the payloadint, str, none
OperationPayload.http_urlDefines the HTTP URL associated with the payloadstr, none
OperationPayload.http_methodDefines the HTTP method associated with the payloadHttpRequestType
OperationPayload.http_headersDefines the HTTP headers associated with the payloadlist[dict[str, Any]]
OperationPayload.email_subjectDefines the email subject associated with the payloadstr
OperationPayload.attach_imageDefines if the operation should attach an imagebool
OperationPayload.reception_emailsDefines the reception emails associated with the payloadlist[str]
OperationPayload.template_idDefines the template ID associated with the payloadint, none
OperationPayload.destinationsDefines the destinations associated with the payloadlist[DestinationPhone]
OperationPayload.twilio_host_phoneDefines the Twilio host phone associated with the payloadDestinationPhone
OperationPayload.twilio_notification_typeDefines the Twilio notification type associated with the payloadTwilioNotificationType
OperationPayload.usernameDefines the username associated with the payloadstr, none
OperationPayload.tokenDefines the token associated with the payloadstr, none
OperationPayload.requires_bhs_validationDefines if the payload requires BHS validationbool
OperationPayload.bhs_tier_idDefines the BHS tier ID associated with the payloadint, none
OperationPayload.push_titleDefines the push title associated with the payloadstr
OperationPayload.push_platformsDefines the push platforms associated with the payloadlist[Platform]
OperationPayload.destinations_idsDefines the destination IDs associated with the payloadlist[int]
OperationPayload.sound_effectDefines the sound effect associated with the payloadSoundEffect
OperationPayload.sound_effect_uriDefines the sound effect URI associated with the payloadstr, none
OperationPayload.durationDefines the duration associated with the payloadtimedelta, none
OperationPayload.iconDefines the icon associated with the payloadstr, none

Let's look an example:

python
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

AttributeDescriptionField Type
OperationCaseCommentPayload.pkDefines the primary key of the commentint
OperationCaseCommentPayload.contentDefines the content of the operation case commentstr
OperationCaseCommentPayload.userDefines the user who created the operation case commentstr
OperationCaseCommentPayload.created_atDefines the date and time when the operation case comment was createddatetime

Let's look an example:

python
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

AttributeDescriptionField Type
OperationCasePayload.pkDefines the primary key of the operation caseint
OperationCasePayload.created_atDefines the date and time when the operation case was createddatetime
OperationCasePayload.updated_atDefines the date and time when the operation case was last updateddatetime
OperationCasePayload.triggerDefines the trigger associated with the operation caseTrigger
OperationCasePayload.file_idDefines the file ID associated with the operation caseint, none
OperationCasePayload.file_created_atDefines the date and time when the file was createddatetime, none
OperationCasePayload.commentDefines the comment associated with the operation caseOperationCaseCommentPayload

Let's look an example:

python
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

AttributeDescriptionField type
pkTransaction IDint
assetAsset related to the transactionAsset
amountAmount of the transactionfloat
quantityQuantity of the transactionfloat
mileageMileage in kilometersfloat
distanceDistance traveled in kilometersfloat
engine_timeTime with the engine ontimedelta
idle_timeTime with the engine on without movementtimedelta
in_geofenceFlag to indicate if transaction occurred inside a geofencebool
geofence_nameName of the geofence where transaction occurredstr
received_atTransaction reception date and timedatetime
is_wildcardWildcard indicator for transactionbool

Let's look an example:

python
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
#> False

Reports

Enums

ReportDataType

AttributeDescription
ReportDataType.STRDefines the data type as a string
ReportDataType.INTDefines the data type as an integer
ReportDataType.FLOATDefines the data type as a float
ReportDataType.DATETIMEDefines the data type as a datetime
ReportDataType.BOOLDefines the data type as a boolean
ReportDataType.CURRENCYDefines the data type as a currency

ReportFormat

AttributeDescription
ReportFormat.MICROSOFT_EXCELDefines the report format as Microsoft Excel (xlsx)
ReportFormat.JSONDefines the report format as JSON
ReportFormat.PDFDefines the report format as PDF

Classes

CustomReportPage

AttributeDescriptionField Type
CustomReportPage.nameDefines the name of the page. Length should be less than 60 charactersstr
CustomReportPage.builderFunction 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_builderFunction 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:

python
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

AttributeDescriptionField Type
Report.pagesDefines the pages of the reportlist[ReportPage] | list[CustomReportPage]
Report.nameDefines the name of the reportstr
Report.export_format export_format is deprecated, submit the export format in the export() method insteadReportFormat

Let's look an example:

python

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

AttributeDescriptionField Type
ReportCol.contentDefines the content to displayany*
ReportCol.colorDefines the color of the cell (Not the text color, in HEX)str
ReportCol.data_typeDefines the data type of the contentReportDataType
ReportCol.alignDefines the alignment of the text in the cellTextAlignment
ReportCol.datetime_formatDefines the datetime format, uses the default Python datetime strftime()str
ReportCol.currency_symbolDefines the currency symbolstr
ReportCol.boldDefines if the text is boldbool
ReportCol.text_color Property text_color deprecated in ReportCol, replaced by a luminance-based color using the background colorstr
ReportCol.lockDefines if the column is lockedbool

Let's look an example:

python

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
#> True

ReportConfiguration

AttributeDescriptionField Type
ReportConfiguration.titleReport titlestr
ReportConfiguration.pages_countNumber of pages to displayint

Let's look an example:

python
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

AttributeDescriptionField Type
ReportHeader.contentDisplay nameany*
ReportHeader.colorCell color in hexadecimal codestr
ReportHeader.alignText AlignmentTextAlignment
ReportHeader.boldBold textbool
ReportHeader.width Property width deprecated in ReportHeader, replaced by the function autofit() to automatically fit the header widthfloat
ReportHeader.text_color Property text_color deprecated in ReportHeader, replaced by a luminance-based color using the background colorstr

Let's look an example:

python

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

AttributeDescriptionField Type
ReportPage.nameDefines the name of the pagestr
ReportPage.headersDefines the headers of the pagelist[ReportHeader]
ReportPage.rowsDefines the rows of the pagelist[ReportRow]
ReportPage.freeze_headerSpecifies if the header should appear frozenbool

Let's look an example:

python

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
#> False

ReportRow

AttributeDescriptionField Type
ReportRow.contentDefines the content of the rowlist[ReportCol]
ReportRow.compactDefines if the row is compactbool
ReportRow.height Height is deprecatedfloat

Let's look an example:

python

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
#> True

Telemetry

Classes

LastMessage

AttributeDescriptionField Type
LastMessage.assetThe asset entity that generated the messageAsset

Let's look an example:

python

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

AttributeDescriptionField Type
Message.pkUnique message identifierint
Message.asset_idUnique identifier of the asset, owner of the messageint
Message.positionGeolocation informationPosition
Message.payloadRaw content of the asset's rasterdict
Message.sensorsCalculated/processed values from the asset's sensorsdict
Message.received_atDate of receipt of the message. Defined in UTCdatetime
Message.geofencesList of geofences associated with the messagelist[Geofence]

Let's look an example:

python

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

AttributeDescriptionDatatype
Position.latitudeLatitude in decimal degrees formatfloat, none
Position.longitudeLength in decimal degrees formatfloat, none
Position.altitudeAltitude in meters above sea levelfloat, none
Position.speedSpeed ​​in kilometers per hourfloat, none
Position.directionDirection in degreesfloat, none
Position.hdopHorizontal dilution of precisionfloat, none
Position.satellitesNumber of satellitesint, none

Let's look an example:

python
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
#> 10

AssetMessage

AttributeDescriptionField Type
AssetMessage.pkUnique identifier of the asset messageint, none
AssetMessage.asset_idUnique identifier of the assetint
AssetMessage.positionCurrent position of the devicedict[str, float, int]
AssetMessage.payloadRaw content of the asset's rasterdict[str, any]
AssetMessage.sensorsCalculated/processed values from the asset's sensorsdict[str, any]
AssetMessage.geofences_idsList of geofence IDs associated with the messagelist[int]
AssetMessage.distance_traveledDistance traveled by the asset in kilometersfloat
AssetMessage.received_atDate of receipt of the message. Defined in UTCdatetime
AssetMessage.elapsed_timeElapsed time since the message was receivedtimedelta

Let's look an example:

python
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

AttributeDescriptionField Type
DeviceMessage.pkUnique identifier of the device messageint
DeviceMessage.identUnique identifier of the devicestr
DeviceMessage.device_idUnique identifier of the deviceint
DeviceMessage.protocol_idUnique identifier of the protocolint
DeviceMessage.positionCurrent position of the devicedict[str, float, int]
DeviceMessage.payloadRaw content of the device's rasterdict[str, any]
DeviceMessage.received_atDate of receipt of the message. Defined in UTCdatetime

Let's look an example:

python
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

AttributeDescription
WaypointKind.PATHWAYThis is the identification of the time between one waypoint and another
WaypointKind.POINTThis refer the time inside of a geofence
WaypointKind.DOWNLOADINGDownloading phase of Tenvio
WaypointKind.WASHINGWashing phase of Tenvio

Classes

Waypoint

AttributeDescriptionField Type
Waypoint.pkUnique identifier of the waypointint
Waypoint.geofenceGeofence associated with the waypointGeofence
Waypoint.geofence_idUnique identifier of the geofenceint, none
Waypoint.start_atStart date and time of the waypointdatetime
Waypoint.end_atEnd date and time of the waypointdatetime
Waypoint.sequence_realReal sequence numberint
Waypoint.sequence_idealIdeal sequence numberint

Let's look an example:

python
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
#> 2

WaypointRef

AttributeDescriptionField Type
WaypointRef.pkUnique identifier of the waypoint referenceint
WaypointRef.geofence_idUnique identifier of the geofenceint, none
WaypointRef.timeTime associated with the waypoint referencetimedelta
WaypointRef.kindKind of waypoint referenceWaypointKind

Let's look an example:

python
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