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.

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.jsonDefines 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 import BroadcastRequest

broadcast_request = BroadcastRequest(
  json={"key1": "value1", "key2": "value2"},
  raw="My raw content"
)

broadcast_request.json
#> {"key1": "value1", "key2": "value2"}
broadcast_request.raw
#> "My raw content"

BroadcastResponse

AttributeDescriptionField Type
BroadcastResponse.jsonDefines 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 import BroadcastResponse

broadcast_response = BroadcastResponse(
  json={"key1": "value1", "key2": "value2"},
  raw="My raw content"
)

broadcast_response.json
#> {"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 import BroadcastResult

broadcast_result = BroadcastResult(
  service_id=1,
  asset_id=1,
  status=BroadcastStatus.OK,
  request=BroadcastRequest(
    json={"key1": "value1", "key2": "value2"},
    raw="My raw content"
  ),
  response=BroadcastResponse(
    json={"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(json={"key1": "value1", "key2": "value
broadcast_result.response
#> BroadcastResponse(json={"key1": "value1", "key2": "value
broadcast_result.submitted_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)

OutboundService

AttributeDescriptionField Type
OutboundService.pkDefines the ID of the serviceint
OutboundService.nameDefines the name of the servicestr

Let's look an example:

python
from layrz_sdk.entities import OutboundService

outbound_service = OutboundService(
  pk=1,
  name="My Outbound Service"
)

outbound_service.pk
#> 1
outbound_service.name
#> "My Outbound Service"

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

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

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

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

Let's look an example:

python
from layrz_sdk.entities import Trigger

trigger = Trigger(
  pk=1,
  name="My Trigger",
  code="my_trigger"
)

trigger.pk
#> 1
trigger.name
#> "My Trigger"
trigger.code
#> "my_trigger"

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 axisint | float
AxisConfig.max_valueMaximum value of the axisint | float
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 pointslist[float | int | bool]
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.alignDefines the alignment of the chartChartAlignment
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",
  align=ChartAlignment.LEFT,
  content="<html><body><h1>My HTML Chart</h1></body></html>"
)

html_chart.title
#> "My HTML Chart"
html_chart.align
#> "LEFT"
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 displayint
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(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])
  ]
)

radar_chart.title
#> "My Radar Chart"
radar_chart.align
#> "LEFT"
radar_chart.x_axis
#> ChartDataSerie(name="My X Axis", type=ChartDataType.STRING, data=["A", "B", "C"])
radar_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])]

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(name="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]),
    ChartDataSerie(name="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(name="My Serie", type=ChartDataType.NUMBER, data=[1, 2, 3]),  ChartDataSerie(name="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(name="My Column", key="my_column"),
    TableHeader(name="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(name="My Column", key="my_column"), TableHeader(name="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 headersdict

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(name="My Serie", data=[TimelineSerieItem(start_at=datetime.datetime.now(tz=ZoneInfo('UTC')), end_at=datetime.datetime.now(tz=ZoneInfo('UTC')))]),
    TimelineSerie(name="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(name="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(name="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

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

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

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
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]

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")
  ]
)

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")]

CustomField

AttributeDescriptionField Type
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

Let's look an example:

python

from layrz_sdk import CustomField

custom_field = CustomField(name="My Custom Field", value="My Value")

sensor.pk
#> 1
sensor.name
#> "My Sensor"
sensor.slug
#> "my.sensor"

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

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"

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

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"

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"

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

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)

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
)

page.name
#> "My Custom Report Page"
page.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

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
)

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"

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 namestr
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.pkUnique message identifierint
LastMessage.asset_idUnique identifier of the asset, owner of the messageint
LastMessage.assetThe asset entity that generated the messageAsset
LastMessage.positionGeolocation informationPosition
LastMessage.payloadRaw content of the asset's rasterdict
LastMessage.sensorsCalculated/processed values from the asset's sensorsdict
LastMessage.received_atDate of receipt of the message. Defined in UTCdatetime

Disclaimer!

The LastMessage.asset.sensors, LastMessage.asset.children, LastMessage.asset.devices and LastMessage.asset.custom_fields are not provided.

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(
  pk=1,
  asset_id=asset.pk,
  asset=asset
  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'))
)

last_message.pk
#> 1
last_message.asset_id
#> 1
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)'
last_message.position
#> Position(latitude=1.23, longitude=4.56, altitude=7.89, speed=10.11, direction=12.34, hdop=15.56)
last_message.payload
#> {"device1.param1": "value1","device1.param2": "value2","device2.param1": "value3","device2.param2": "value4"}
last_message.sensors
#> {"sensor1": "value1","sensor2": "value2"}
last_message.received_at
#> datetime.datetime(2022, 2, 24, 7, 22, 52, 317161, tzinfo=<UTC>)

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

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

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

Position

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

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