layrz-sdk 4.0.2__py3-none-any.whl → 4.0.4__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.
- layrz_sdk/entities/asset.py +15 -1
- layrz_sdk/entities/device.py +12 -1
- {layrz_sdk-4.0.2.dist-info → layrz_sdk-4.0.4.dist-info}/METADATA +1 -1
- {layrz_sdk-4.0.2.dist-info → layrz_sdk-4.0.4.dist-info}/RECORD +7 -7
- {layrz_sdk-4.0.2.dist-info → layrz_sdk-4.0.4.dist-info}/WHEEL +0 -0
- {layrz_sdk-4.0.2.dist-info → layrz_sdk-4.0.4.dist-info}/licenses/LICENSE +0 -0
- {layrz_sdk-4.0.2.dist-info → layrz_sdk-4.0.4.dist-info}/top_level.txt +0 -0
layrz_sdk/entities/asset.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Any, Self
|
|
4
4
|
|
|
5
|
-
from pydantic import BaseModel, Field, model_validator
|
|
5
|
+
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
6
6
|
|
|
7
7
|
from .asset_contact import AssetContact
|
|
8
8
|
from .asset_operation_mode import AssetOperationMode
|
|
@@ -42,6 +42,20 @@ class Asset(BaseModel):
|
|
|
42
42
|
description='Static position of the asset',
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
+
@field_validator('static_position', mode='before')
|
|
46
|
+
def _validate_static_position(cls: Self, value: Any) -> StaticPosition | None:
|
|
47
|
+
"""Validate static position"""
|
|
48
|
+
if isinstance(value, dict):
|
|
49
|
+
try:
|
|
50
|
+
return StaticPosition.model_validate(value)
|
|
51
|
+
except Exception:
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
if isinstance(value, StaticPosition):
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
return None
|
|
58
|
+
|
|
45
59
|
points: list[StaticPosition] = Field(
|
|
46
60
|
default_factory=list,
|
|
47
61
|
description='List of static positions for the asset. The altitude of StaticPosition is not used in this case.',
|
layrz_sdk/entities/device.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""Device entitiy"""
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field, field_validator
|
|
4
6
|
|
|
5
7
|
from .modbus import ModbusConfig
|
|
6
8
|
|
|
@@ -18,4 +20,13 @@ class Device(BaseModel):
|
|
|
18
20
|
protocol: str = Field(description='Defines the protocol of the device')
|
|
19
21
|
is_primary: bool = Field(default=False, description='Defines if the device is the primary device')
|
|
20
22
|
|
|
23
|
+
@field_validator('is_primary', mode='before')
|
|
24
|
+
def validate_is_primary(cls, value: Any) -> bool:
|
|
25
|
+
"""Validate that is_primary is a boolean value."""
|
|
26
|
+
if isinstance(value, str):
|
|
27
|
+
return value.lower() in ('true', '1', 'yes')
|
|
28
|
+
if isinstance(value, bool):
|
|
29
|
+
return value
|
|
30
|
+
return False
|
|
31
|
+
|
|
21
32
|
modbus: ModbusConfig | None = Field(default=None, description='Modbus configuration')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: layrz-sdk
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.4
|
|
4
4
|
Summary: Layrz SDK for Python
|
|
5
5
|
Author-email: "Golden M, Inc." <software@goldenm.com>
|
|
6
6
|
Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>, Luis Reyes <lreyes@goldenm.com>, Kasen Li <kli@goldenm.com>, Miguel Zauzich <miguel@goldenm.com>, Angel Prieto <aprieto@goldenm.com>
|
|
@@ -6,7 +6,7 @@ layrz_sdk/entities/action.py,sha256=cbyrfeBsUpdv5ipMtIDvFNJj-FE6whPt7I22BnEZ2sU,
|
|
|
6
6
|
layrz_sdk/entities/action_geofence_ownership.py,sha256=xP_JG2qY7ogJtbCv-jE1xWAdc2oA0icoRIOAI6acicA,590
|
|
7
7
|
layrz_sdk/entities/action_kind.py,sha256=2PR4MesAyKssdWAwOGE4hYfzyhGd9pW78H9rlyXu28Q,1189
|
|
8
8
|
layrz_sdk/entities/action_subkind.py,sha256=lNsX3C_YTI3aui4AIe0lD86IcjAqwfxsUSf7blRbtgA,635
|
|
9
|
-
layrz_sdk/entities/asset.py,sha256=
|
|
9
|
+
layrz_sdk/entities/asset.py,sha256=NkYk0c1BBv8Vzmanrdc7TRLGAhZ93FEZqQ3QMwG_yEY,3356
|
|
10
10
|
layrz_sdk/entities/asset_constants.py,sha256=m2pL4FKgPVVHxGKfmF80xv4W-rTh9NL7ClksfEcFkx8,600
|
|
11
11
|
layrz_sdk/entities/asset_contact.py,sha256=ptxItpob4VdQeM6qMUtSZgZxBw5DfKp3kVfBVlXpujo,422
|
|
12
12
|
layrz_sdk/entities/asset_operation_mode.py,sha256=umvmRb8W3kEDUd9dqyKhJ745xe3wssNjPw8gGGcKYO8,551
|
|
@@ -24,7 +24,7 @@ layrz_sdk/entities/comment.py,sha256=fqcozjlKiOLrfGxhqbiTPzsOkSp2FMcbIUgDSojTDlM
|
|
|
24
24
|
layrz_sdk/entities/custom_field.py,sha256=ToaQPHP8dmY8MkFLkgxnAyDoyBByExifCu_mpH78Xwc,474
|
|
25
25
|
layrz_sdk/entities/custom_report_page.py,sha256=eqtoFOgip0z4_cMql1tHgaR4JiVEYlfbzd9ZJ7ZLyrM,1231
|
|
26
26
|
layrz_sdk/entities/destination_phone.py,sha256=IFQFtM_wQjlTdsBc-lXnbcJSwNv-yhL1PzTCexw4nNk,556
|
|
27
|
-
layrz_sdk/entities/device.py,sha256=
|
|
27
|
+
layrz_sdk/entities/device.py,sha256=xboiqZ6cuM4Saihv-k5sPAhWlxLfgVe5M3knqfjLKr0,1091
|
|
28
28
|
layrz_sdk/entities/event.py,sha256=iQ73VC7nds3fgdAu6dWsEGFIBgqem3w1bAyUOxUxvqI,732
|
|
29
29
|
layrz_sdk/entities/exchange_service.py,sha256=DOSffjwxZ7tcRA6nk0QCf-dpO981jqP9FX_wjvviSGI,665
|
|
30
30
|
layrz_sdk/entities/function.py,sha256=rmUkw0QxD9NpKb1eL42aSsvEa6zPN41MpD86aIKjyB0,1225
|
|
@@ -109,8 +109,8 @@ layrz_sdk/helpers/__init__.py,sha256=5iW3z2m3jrYhvTfxX-p-QTkR9X9oTKfEsbtVOg9jFFY
|
|
|
109
109
|
layrz_sdk/helpers/color.py,sha256=dlpMafbM-4Wd9D9hMbbnZJf4ALkpie_ZmBR2Vz_YCmM,1203
|
|
110
110
|
layrz_sdk/lcl/__init__.py,sha256=U967AWANkL3u_YVxMNAYlh8jkZ6hqHfStacz7yz6sOA,89
|
|
111
111
|
layrz_sdk/lcl/core.py,sha256=T80A3hL7SeqRNSfl5SrPAgwIEf-enoAVv9ldwJNzqsA,24786
|
|
112
|
-
layrz_sdk-4.0.
|
|
113
|
-
layrz_sdk-4.0.
|
|
114
|
-
layrz_sdk-4.0.
|
|
115
|
-
layrz_sdk-4.0.
|
|
116
|
-
layrz_sdk-4.0.
|
|
112
|
+
layrz_sdk-4.0.4.dist-info/licenses/LICENSE,sha256=d5ZrU--lIPER7QByXDKcrtOTOMk1JvN_9FdYDuoWi7Y,1057
|
|
113
|
+
layrz_sdk-4.0.4.dist-info/METADATA,sha256=XIXqzyUVMJ6OqNvjgNB3lxO9RiBhqiSTL9IoiE8Zotw,1955
|
|
114
|
+
layrz_sdk-4.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
115
|
+
layrz_sdk-4.0.4.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
|
|
116
|
+
layrz_sdk-4.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|