layrz-sdk 3.1.14__py3-none-any.whl → 3.1.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of layrz-sdk might be problematic. Click here for more details.

Files changed (85) hide show
  1. layrz_sdk/__init__.py +1 -1
  2. layrz_sdk/constants.py +19 -5
  3. layrz_sdk/entities/__init__.py +138 -129
  4. layrz_sdk/entities/asset.py +76 -60
  5. layrz_sdk/entities/asset_operation_mode.py +31 -31
  6. layrz_sdk/entities/broadcast_request.py +12 -12
  7. layrz_sdk/entities/broadcast_response.py +12 -12
  8. layrz_sdk/entities/broadcast_result.py +20 -20
  9. layrz_sdk/entities/broadcast_status.py +28 -28
  10. layrz_sdk/entities/case.py +52 -52
  11. layrz_sdk/entities/case_ignored_status.py +26 -26
  12. layrz_sdk/entities/case_status.py +23 -23
  13. layrz_sdk/entities/charts/axis_config.py +15 -15
  14. layrz_sdk/entities/charts/bar_chart.py +175 -175
  15. layrz_sdk/entities/charts/chart_alignment.py +27 -27
  16. layrz_sdk/entities/charts/chart_color.py +44 -44
  17. layrz_sdk/entities/charts/chart_configuration.py +10 -10
  18. layrz_sdk/entities/charts/chart_data_serie.py +19 -19
  19. layrz_sdk/entities/charts/chart_data_serie_type.py +28 -28
  20. layrz_sdk/entities/charts/chart_data_type.py +27 -27
  21. layrz_sdk/entities/charts/chart_render_technology.py +30 -30
  22. layrz_sdk/entities/charts/column_chart.py +201 -201
  23. layrz_sdk/entities/charts/html_chart.py +38 -38
  24. layrz_sdk/entities/charts/line_chart.py +248 -248
  25. layrz_sdk/entities/charts/map_center_type.py +22 -22
  26. layrz_sdk/entities/charts/map_chart.py +108 -108
  27. layrz_sdk/entities/charts/map_point.py +22 -22
  28. layrz_sdk/entities/charts/number_chart.py +54 -54
  29. layrz_sdk/entities/charts/pie_chart.py +131 -131
  30. layrz_sdk/entities/charts/radar_chart.py +81 -81
  31. layrz_sdk/entities/charts/radial_bar_chart.py +131 -131
  32. layrz_sdk/entities/charts/scatter_chart.py +210 -210
  33. layrz_sdk/entities/charts/scatter_serie.py +13 -13
  34. layrz_sdk/entities/charts/scatter_serie_item.py +8 -8
  35. layrz_sdk/entities/charts/table_chart.py +54 -54
  36. layrz_sdk/entities/charts/table_header.py +8 -8
  37. layrz_sdk/entities/charts/table_row.py +9 -9
  38. layrz_sdk/entities/charts/timeline_chart.py +79 -79
  39. layrz_sdk/entities/charts/timeline_serie.py +10 -10
  40. layrz_sdk/entities/charts/timeline_serie_item.py +12 -12
  41. layrz_sdk/entities/checkpoint.py +17 -17
  42. layrz_sdk/entities/comment.py +16 -16
  43. layrz_sdk/entities/custom_field.py +10 -10
  44. layrz_sdk/entities/custom_report_page.py +40 -40
  45. layrz_sdk/entities/device.py +18 -13
  46. layrz_sdk/entities/event.py +23 -23
  47. layrz_sdk/entities/geofence.py +11 -11
  48. layrz_sdk/entities/last_message.py +12 -12
  49. layrz_sdk/entities/message.py +23 -23
  50. layrz_sdk/entities/modbus/__init__.py +9 -0
  51. layrz_sdk/entities/modbus/config.py +19 -0
  52. layrz_sdk/entities/modbus/parameter.py +110 -0
  53. layrz_sdk/entities/modbus/schema.py +10 -0
  54. layrz_sdk/entities/modbus/status.py +16 -0
  55. layrz_sdk/entities/modbus/wait.py +134 -0
  56. layrz_sdk/entities/outbound_service.py +10 -10
  57. layrz_sdk/entities/position.py +116 -116
  58. layrz_sdk/entities/presence_type.py +16 -16
  59. layrz_sdk/entities/report.py +289 -289
  60. layrz_sdk/entities/report_col.py +40 -40
  61. layrz_sdk/entities/report_configuration.py +8 -8
  62. layrz_sdk/entities/report_data_type.py +28 -28
  63. layrz_sdk/entities/report_format.py +27 -27
  64. layrz_sdk/entities/report_header.py +43 -43
  65. layrz_sdk/entities/report_page.py +15 -15
  66. layrz_sdk/entities/report_row.py +28 -28
  67. layrz_sdk/entities/sensor.py +11 -11
  68. layrz_sdk/entities/static_position.py +17 -0
  69. layrz_sdk/entities/telemetry/__init__.py +6 -0
  70. layrz_sdk/entities/telemetry/assetmessage.py +159 -0
  71. layrz_sdk/entities/telemetry/devicemessage.py +122 -0
  72. layrz_sdk/entities/text_alignment.py +26 -26
  73. layrz_sdk/entities/trigger.py +11 -11
  74. layrz_sdk/entities/user.py +10 -10
  75. layrz_sdk/entities/waypoint.py +18 -18
  76. layrz_sdk/helpers/__init__.py +5 -5
  77. layrz_sdk/helpers/color.py +44 -44
  78. layrz_sdk/lcl/__init__.py +5 -5
  79. layrz_sdk/lcl/core.py +848 -848
  80. {layrz_sdk-3.1.14.dist-info → layrz_sdk-3.1.16.dist-info}/METADATA +54 -49
  81. layrz_sdk-3.1.16.dist-info/RECORD +85 -0
  82. {layrz_sdk-3.1.14.dist-info → layrz_sdk-3.1.16.dist-info}/licenses/LICENSE +6 -6
  83. layrz_sdk-3.1.14.dist-info/RECORD +0 -75
  84. {layrz_sdk-3.1.14.dist-info → layrz_sdk-3.1.16.dist-info}/WHEEL +0 -0
  85. {layrz_sdk-3.1.14.dist-info → layrz_sdk-3.1.16.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,110 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel, Field, field_validator
4
+
5
+ from .schema import ModbusSchema
6
+
7
+
8
+ class ModbusParameter(BaseModel):
9
+ """Modbus parameter model"""
10
+
11
+ schema_: ModbusSchema = Field(
12
+ ...,
13
+ description='Modbus schema',
14
+ alias='schema',
15
+ )
16
+
17
+ split_each: int = Field(
18
+ ...,
19
+ description='Number of bytes to split each Modbus parameter',
20
+ )
21
+
22
+ @field_validator('split_each', mode='before')
23
+ def validate_split_each(cls, value: Any) -> int:
24
+ """Validate and convert split_each to integer."""
25
+ if isinstance(value, int):
26
+ return value
27
+
28
+ if isinstance(value, str):
29
+ try:
30
+ return int(value)
31
+ except ValueError as e:
32
+ raise ValueError(f'Invalid Modbus split_each value: {value}') from e
33
+
34
+ raise ValueError(f'Invalid Modbus split_each type: {type(value)}')
35
+
36
+ data_length: int = Field(
37
+ ...,
38
+ description='Length of data for the Modbus parameter, from Hexadecimal representation',
39
+ )
40
+
41
+ @field_validator('data_length', mode='before')
42
+ def validate_data_length(cls, value: Any) -> int:
43
+ """Validate and convert data_length to integer."""
44
+ if isinstance(value, int):
45
+ return value
46
+
47
+ if isinstance(value, str):
48
+ try:
49
+ return int(value, 16) # Convert from hexadecimal string to integer
50
+ except ValueError as e:
51
+ raise ValueError(f'Invalid Modbus data_length value: {value}') from e
52
+
53
+ raise ValueError(f'Invalid Modbus data_length type: {type(value)}')
54
+
55
+ data_address: int = Field(
56
+ ...,
57
+ description='Address of the Modbus parameter, from Hexadecimal representation',
58
+ )
59
+
60
+ @field_validator('data_address', mode='before')
61
+ def validate_data_address(cls, value: Any) -> int:
62
+ """Validate and convert data_address to integer."""
63
+ if isinstance(value, int):
64
+ return value
65
+
66
+ if isinstance(value, str):
67
+ try:
68
+ return int(value, 16) # Convert from hexadecimal string to integer
69
+ except ValueError as e:
70
+ raise ValueError(f'Invalid Modbus data_address value: {value}') from e
71
+
72
+ raise ValueError(f'Invalid Modbus data_address type: {type(value)}')
73
+
74
+ function_code: int = Field(
75
+ ...,
76
+ description='Function code for the Modbus parameter',
77
+ )
78
+
79
+ @field_validator('function_code', mode='before')
80
+ def validate_function_code(cls, value: Any) -> int:
81
+ """Validate and convert function_code to integer."""
82
+ if isinstance(value, int):
83
+ return value
84
+
85
+ if isinstance(value, str):
86
+ try:
87
+ return int(value, 16) # Convert from hexadecimal string to integer
88
+ except ValueError as e:
89
+ raise ValueError(f'Invalid Modbus function_code value: {value}') from e
90
+
91
+ raise ValueError(f'Invalid Modbus function_code type: {type(value)}')
92
+
93
+ controller_address: int = Field(
94
+ ...,
95
+ description='Controller address for the Modbus parameter',
96
+ )
97
+
98
+ @field_validator('controller_address', mode='before')
99
+ def validate_controller_address(cls, value: Any) -> int:
100
+ """Validate and convert controller_address to integer."""
101
+ if isinstance(value, int):
102
+ return value
103
+
104
+ if isinstance(value, str):
105
+ try:
106
+ return int(value, 16) # Convert from hexadecimal string to integer
107
+ except ValueError as e:
108
+ raise ValueError(f'Invalid Modbus controller_address value: {value}') from e
109
+
110
+ raise ValueError(f'Invalid Modbus controller_address type: {type(value)}')
@@ -0,0 +1,10 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class ModbusSchema(StrEnum):
5
+ """Modbus schema enumeration"""
6
+
7
+ SINGLE = 'SINGLE'
8
+ """ Defines a single Modbus request. """
9
+ MULTIPLE = 'MULTIPLE'
10
+ """ Defines multiple Modbus requests. """
@@ -0,0 +1,16 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class ModbusStatus(StrEnum):
5
+ """Modbus schema enumeration"""
6
+
7
+ PENDING = 'PENDING'
8
+ """ Defines the pending state, indicating that the request is waiting to be processed. """
9
+ WAITING_FOR_SEND = 'WAITING_FOR_SEND'
10
+ """ Indicates that the request is ready to be sent but has not yet been dispatched. """
11
+ SENT = 'SENT'
12
+ """ Indicates that the request has been sent to the device. """
13
+ ACK_RECEIVED = 'ACK_RECEIVED'
14
+ """ Indicates that an acknowledgment has been received from the device. """
15
+ CANCELLED = 'CANCELLED'
16
+ """ Indicates that the request has been cancelled. """
@@ -0,0 +1,134 @@
1
+ from typing import Any
2
+
3
+ from pydantic import BaseModel, Field, field_validator
4
+
5
+ from .schema import ModbusSchema
6
+ from .status import ModbusStatus
7
+
8
+
9
+ class ModbusWait(BaseModel):
10
+ """Modbus parameter model"""
11
+
12
+ status: ModbusStatus = Field(
13
+ ...,
14
+ description='Status of the Modbus command',
15
+ )
16
+
17
+ structure: ModbusSchema = Field(
18
+ ...,
19
+ description='Modbus structure schema',
20
+ )
21
+
22
+ port_id: int = Field(
23
+ ...,
24
+ description='Port ID for the Modbus command',
25
+ )
26
+
27
+ @field_validator('port_id', mode='before')
28
+ def validate_port_id(cls, value: Any) -> int:
29
+ """Validate and convert port_id to integer."""
30
+ if isinstance(value, int):
31
+ return value
32
+
33
+ if isinstance(value, str):
34
+ try:
35
+ return int(value)
36
+ except ValueError as e:
37
+ raise ValueError(f'Invalid Modbus port_id value: {value}') from e
38
+
39
+ raise ValueError(f'Invalid Modbus port_id type: {type(value)}')
40
+
41
+ split_each: int = Field(
42
+ ...,
43
+ description='Number of bytes to split each Modbus parameter',
44
+ )
45
+
46
+ @field_validator('split_each', mode='before')
47
+ def validate_split_each(cls, value: Any) -> int:
48
+ """Validate and convert split_each to integer."""
49
+ if isinstance(value, int):
50
+ return value
51
+
52
+ if isinstance(value, str):
53
+ try:
54
+ return int(value)
55
+ except ValueError as e:
56
+ raise ValueError(f'Invalid Modbus split_each value: {value}') from e
57
+
58
+ raise ValueError(f'Invalid Modbus split_each type: {type(value)}')
59
+
60
+ data_length: int = Field(
61
+ ...,
62
+ description='Length of data for the Modbus parameter, from Hexadecimal representation',
63
+ )
64
+
65
+ @field_validator('data_length', mode='before')
66
+ def validate_data_length(cls, value: Any) -> int:
67
+ """Validate and convert data_length to integer."""
68
+ if isinstance(value, int):
69
+ return value
70
+
71
+ if isinstance(value, str):
72
+ try:
73
+ return int(value, 16) # Convert from hexadecimal string to integer
74
+ except ValueError as e:
75
+ raise ValueError(f'Invalid Modbus data_length value: {value}') from e
76
+
77
+ raise ValueError(f'Invalid Modbus data_length type: {type(value)}')
78
+
79
+ data_address: int = Field(
80
+ ...,
81
+ description='Address of the Modbus parameter, from Hexadecimal representation',
82
+ )
83
+
84
+ @field_validator('data_address', mode='before')
85
+ def validate_data_address(cls, value: Any) -> int:
86
+ """Validate and convert data_address to integer."""
87
+ if isinstance(value, int):
88
+ return value
89
+
90
+ if isinstance(value, str):
91
+ try:
92
+ return int(value, 16) # Convert from hexadecimal string to integer
93
+ except ValueError as e:
94
+ raise ValueError(f'Invalid Modbus data_address value: {value}') from e
95
+
96
+ raise ValueError(f'Invalid Modbus data_address type: {type(value)}')
97
+
98
+ function_code: int = Field(
99
+ ...,
100
+ description='Function code for the Modbus parameter',
101
+ )
102
+
103
+ @field_validator('function_code', mode='before')
104
+ def validate_function_code(cls, value: Any) -> int:
105
+ """Validate and convert function_code to integer."""
106
+ if isinstance(value, int):
107
+ return value
108
+
109
+ if isinstance(value, str):
110
+ try:
111
+ return int(value, 16) # Convert from hexadecimal string to integer
112
+ except ValueError as e:
113
+ raise ValueError(f'Invalid Modbus function_code value: {value}') from e
114
+
115
+ raise ValueError(f'Invalid Modbus function_code type: {type(value)}')
116
+
117
+ controller_address: int = Field(
118
+ ...,
119
+ description='Controller address for the Modbus parameter',
120
+ )
121
+
122
+ @field_validator('controller_address', mode='before')
123
+ def validate_controller_address(cls, value: Any) -> int:
124
+ """Validate and convert controller_address to integer."""
125
+ if isinstance(value, int):
126
+ return value
127
+
128
+ if isinstance(value, str):
129
+ try:
130
+ return int(value, 16) # Convert from hexadecimal string to integer
131
+ except ValueError as e:
132
+ raise ValueError(f'Invalid Modbus controller_address value: {value}') from e
133
+
134
+ raise ValueError(f'Invalid Modbus controller_address type: {type(value)}')
@@ -1,10 +1,10 @@
1
- """Service entity"""
2
-
3
- from pydantic import BaseModel, Field
4
-
5
-
6
- class OutboundService(BaseModel):
7
- """Outbound service definition"""
8
-
9
- pk: int = Field(description='Service ID')
10
- name: str = Field(description='Service name')
1
+ """Service entity"""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class OutboundService(BaseModel):
7
+ """Outbound service definition"""
8
+
9
+ pk: int = Field(description='Service ID')
10
+ name: str = Field(description='Service name')
@@ -1,116 +1,116 @@
1
- """Position entity"""
2
-
3
- import sys
4
- from typing import Any, Optional
5
-
6
- from pydantic import BaseModel, Field, field_validator
7
-
8
- if sys.version_info >= (3, 11):
9
- from typing import Self
10
- else:
11
- from typing_extensions import Self
12
-
13
-
14
- class Position(BaseModel):
15
- """Geographic position definition"""
16
-
17
- latitude: Optional[float] = Field(default=None, description='Defines the latitude of the position')
18
- longitude: Optional[float] = Field(default=None, description='Defines the longitude of the position')
19
- altitude: Optional[float] = Field(default=None, description='Defines the altitude of the position')
20
- hdop: Optional[float] = Field(default=None, description='Defines the horizontal dilution of precision')
21
- speed: Optional[float] = Field(default=None, description='Defines the speed of the position')
22
- direction: Optional[float] = Field(default=None, description='Defines the direction of the position')
23
- satellites: Optional[int] = Field(
24
- default=None,
25
- description='Defines the number of satellites used to calculate the position',
26
- )
27
-
28
- @field_validator('latitude', mode='before')
29
- def _validate_latitude(cls: Self, value: Any) -> None | float:
30
- """Validate latitude"""
31
- if value is None:
32
- return None
33
-
34
- if not isinstance(value, (int, float)):
35
- return None
36
-
37
- if isinstance(value, int):
38
- value = float(value)
39
-
40
- if -90 <= value <= 90:
41
- return value
42
-
43
- return None
44
-
45
- @field_validator('longitude', mode='before')
46
- def _validate_longitude(cls: Self, value: Any) -> None | float:
47
- """Validate longitude"""
48
- if value is None:
49
- return None
50
-
51
- if not isinstance(value, (int, float)):
52
- return None
53
-
54
- if isinstance(value, int):
55
- value = float(value)
56
-
57
- if -180 <= value <= 180:
58
- return value
59
-
60
- return None
61
-
62
- @field_validator('altitude', mode='before')
63
- def _validate_altitude(cls: Self, value: Any) -> None | float:
64
- """Validate altitude"""
65
- if value is None:
66
- return None
67
-
68
- if not isinstance(value, (float, int)):
69
- return None
70
-
71
- return value
72
-
73
- @field_validator('hdop', mode='before')
74
- def _validate_hdop(cls: Self, value: Any) -> None | float:
75
- """Validate hdop"""
76
- if value is None:
77
- return None
78
-
79
- if not isinstance(value, (int, float)):
80
- return None
81
-
82
- if isinstance(value, int):
83
- value = float(value)
84
-
85
- return value
86
-
87
- @field_validator('speed', mode='before')
88
- def _validate_speed(cls: Self, value: Any) -> None | float:
89
- """Validate speed"""
90
- if value is None:
91
- return None
92
-
93
- if not isinstance(value, (float, int)):
94
- return None
95
-
96
- if isinstance(value, int):
97
- value = float(value)
98
-
99
- return abs(value)
100
-
101
- @field_validator('direction', mode='before')
102
- def _validate_direction(cls: Self, value: Any) -> None | float:
103
- """Validate direction"""
104
- if value is None:
105
- return None
106
-
107
- if not isinstance(value, (float, int)):
108
- return None
109
-
110
- if isinstance(value, int):
111
- value = float(value)
112
-
113
- if 0 <= value <= 360:
114
- return value
115
-
116
- return None
1
+ """Position entity"""
2
+
3
+ import sys
4
+ from typing import Any, Optional
5
+
6
+ from pydantic import BaseModel, Field, field_validator
7
+
8
+ if sys.version_info >= (3, 11):
9
+ from typing import Self
10
+ else:
11
+ from typing_extensions import Self
12
+
13
+
14
+ class Position(BaseModel):
15
+ """Geographic position definition"""
16
+
17
+ latitude: Optional[float] = Field(default=None, description='Defines the latitude of the position')
18
+ longitude: Optional[float] = Field(default=None, description='Defines the longitude of the position')
19
+ altitude: Optional[float] = Field(default=None, description='Defines the altitude of the position')
20
+ hdop: Optional[float] = Field(default=None, description='Defines the horizontal dilution of precision')
21
+ speed: Optional[float] = Field(default=None, description='Defines the speed of the position')
22
+ direction: Optional[float] = Field(default=None, description='Defines the direction of the position')
23
+ satellites: Optional[int] = Field(
24
+ default=None,
25
+ description='Defines the number of satellites used to calculate the position',
26
+ )
27
+
28
+ @field_validator('latitude', mode='before')
29
+ def _validate_latitude(cls: Self, value: Any) -> None | float:
30
+ """Validate latitude"""
31
+ if value is None:
32
+ return None
33
+
34
+ if not isinstance(value, (int, float)):
35
+ return None
36
+
37
+ if isinstance(value, int):
38
+ value = float(value)
39
+
40
+ if -90 <= value <= 90:
41
+ return value
42
+
43
+ return None
44
+
45
+ @field_validator('longitude', mode='before')
46
+ def _validate_longitude(cls: Self, value: Any) -> None | float:
47
+ """Validate longitude"""
48
+ if value is None:
49
+ return None
50
+
51
+ if not isinstance(value, (int, float)):
52
+ return None
53
+
54
+ if isinstance(value, int):
55
+ value = float(value)
56
+
57
+ if -180 <= value <= 180:
58
+ return value
59
+
60
+ return None
61
+
62
+ @field_validator('altitude', mode='before')
63
+ def _validate_altitude(cls: Self, value: Any) -> None | float:
64
+ """Validate altitude"""
65
+ if value is None:
66
+ return None
67
+
68
+ if not isinstance(value, (float, int)):
69
+ return None
70
+
71
+ return value
72
+
73
+ @field_validator('hdop', mode='before')
74
+ def _validate_hdop(cls: Self, value: Any) -> None | float:
75
+ """Validate hdop"""
76
+ if value is None:
77
+ return None
78
+
79
+ if not isinstance(value, (int, float)):
80
+ return None
81
+
82
+ if isinstance(value, int):
83
+ value = float(value)
84
+
85
+ return value
86
+
87
+ @field_validator('speed', mode='before')
88
+ def _validate_speed(cls: Self, value: Any) -> None | float:
89
+ """Validate speed"""
90
+ if value is None:
91
+ return None
92
+
93
+ if not isinstance(value, (float, int)):
94
+ return None
95
+
96
+ if isinstance(value, int):
97
+ value = float(value)
98
+
99
+ return abs(value)
100
+
101
+ @field_validator('direction', mode='before')
102
+ def _validate_direction(cls: Self, value: Any) -> None | float:
103
+ """Validate direction"""
104
+ if value is None:
105
+ return None
106
+
107
+ if not isinstance(value, (float, int)):
108
+ return None
109
+
110
+ if isinstance(value, int):
111
+ value = float(value)
112
+
113
+ if 0 <= value <= 360:
114
+ return value
115
+
116
+ return None
@@ -1,16 +1,16 @@
1
- from enum import Enum
2
-
3
-
4
- class PresenceType(Enum):
5
- """Presence type enum"""
6
-
7
- ENTRANCE = 'ENTRANCE'
8
- EXIT = 'EXIT'
9
-
10
- def __str__(self) -> str:
11
- """Readable property"""
12
- return self.name
13
-
14
- def __repr__(self) -> str:
15
- """Readable property"""
16
- return f'PresenceType.{self.name}'
1
+ from enum import Enum
2
+
3
+
4
+ class PresenceType(Enum):
5
+ """Presence type enum"""
6
+
7
+ ENTRANCE = 'ENTRANCE'
8
+ EXIT = 'EXIT'
9
+
10
+ def __str__(self) -> str:
11
+ """Readable property"""
12
+ return self.name
13
+
14
+ def __repr__(self) -> str:
15
+ """Readable property"""
16
+ return f'PresenceType.{self.name}'