References
API
Pythonic interface to interact with the Eurogard backend services.
EurogardAPI is the main class for interacting with the Eurogard m2v IoT platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
An instance of the Settings class containing API configuration. |
required |
max_concurrent_requests
|
int
|
Maximum number of concurrent async requests. Defaults to 5. |
5
|
_create_auth
_create_auth()
Create OAuth2 authentication handler.
Returns:
| Name | Type | Description |
|---|---|---|
OAuth2ResourceOwnerPasswordCredentials |
OAuth2ResourceOwnerPasswordCredentials
|
Configured auth handler. |
aget_frame_from_names
async
aget_frame_from_names(machine_uuid, names, start, end, interval, max_frame_length, timeout=30.0)
Asynchronously retrieve a DataFrame of historical data for a specific machine.
Fetches data in batches concurrently for speedup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
names
|
list[str]
|
List of data definition key item names. |
required |
start
|
datetime
|
Start timestamp. |
required |
end
|
datetime
|
End timestamp. |
required |
interval
|
timedelta
|
Interval between data points. |
required |
max_frame_length
|
timedelta
|
Maximum length of each batch. |
required |
timeout
|
float
|
Timeout in seconds. Defaults to 30.0. |
30.0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: DataFrame of historical data. |
from_env
classmethod
from_env(env_file='.env')
Create an API client from environment variables and an explicit .env file.
get_frame_from_names
get_frame_from_names(machine_uuid, names, start, end, interval)
Retrieve a DataFrame of historical data for a specific machine from measurement names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
names
|
list[str]
|
List of data definition key item names. |
required |
start
|
datetime
|
Start timestamp. |
required |
end
|
datetime
|
End timestamp. |
required |
interval
|
timedelta
|
Interval between data points. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: DataFrame of historical data with timestamp column. |
get_historical_data
get_historical_data(machine_uuid, data_definition_key_item_names, start, end, interval_in_s)
Retrieve historical data for a specific machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
data_definition_key_item_names
|
list[str]
|
List of data definition key item names. |
required |
start
|
int
|
Start timestamp in milliseconds. |
required |
end
|
int
|
End timestamp in milliseconds. |
required |
interval_in_s
|
int
|
Interval in seconds. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Historical data. |
get_long_frame_from_names
get_long_frame_from_names(machine_uuid, names, start, end, interval, max_frame_length, show_progress=False)
Retrieve a long DataFrame of historical data for a specific machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
names
|
list[str]
|
List of data definition key item names. |
required |
start
|
datetime
|
Start timestamp. |
required |
end
|
datetime
|
End timestamp. |
required |
interval
|
timedelta
|
Time interval between data points. |
required |
max_frame_length
|
timedelta
|
Maximum interval length for a single API request. |
required |
show_progress
|
bool
|
Whether to show progress. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: Long DataFrame of historical data. |
get_machine_measurement_names
get_machine_measurement_names(machine_uuid, page=0, size=10, sort='updatedAt', order='desc', filter='__archived:false')
Retrieve measurement names for a specific machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
page
|
int
|
Page number, starting from 0. Defaults to 0. |
0
|
size
|
int
|
Number of items per page. Defaults to 10. |
10
|
sort
|
str
|
Sort field (e.g., updatedAt). Defaults to "updatedAt". |
'updatedAt'
|
order
|
str
|
Sort order (asc or desc). Defaults to "desc". |
'desc'
|
filter
|
str
|
Filter criteria (e.g., __archived:false). Defaults to "__archived:false". |
'__archived:false'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Machine measurements. |
get_machine_setpoints
get_machine_setpoints(machine_uuid, page=0, size=10, sort='updatedAt', order='desc', filter='__archived:false')
Retrieve setpoints for a specific machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_uuid
|
str
|
Machine UUID. |
required |
page
|
int
|
Page number, starting from 0. Defaults to 0. |
0
|
size
|
int
|
Number of items per page. Defaults to 10. |
10
|
sort
|
str
|
Sort field (e.g., updatedAt). Defaults to "updatedAt". |
'updatedAt'
|
order
|
str
|
Sort order (asc or desc). Defaults to "desc". |
'desc'
|
filter
|
str
|
Filter criteria (e.g., __archived:false). Defaults to "__archived:false". |
'__archived:false'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Machine setpoints. |
get_machine_uuid
staticmethod
get_machine_uuid(machine_name, machines)
Get the machine UUID matching the specified name from a list of machines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
machine_name
|
str
|
The name of the machine to search for. |
required |
machines
|
dict[str, Any]
|
A dictionary containing machine data with an 'entities' key that holds a list of machine objects. Each machine object should have 'name' and 'uuid' fields. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: UUID for machine that match the given name. Returns None if no matches are found. |
get_machines
get_machines(page=0, size=10, sort='name', order='asc', filter='__archived:false')
Retrieve a list of machines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
int
|
Page number, starting from 0. Defaults to 0. |
0
|
size
|
int
|
Number of items per page. Defaults to 10. |
10
|
sort
|
str
|
Sort field (e.g., name, companyName, thingName, machineTypeDefinitionName, lastConnection). Defaults to "name". |
'name'
|
order
|
str
|
Sort order (asc or desc). Defaults to "asc". |
'asc'
|
filter
|
str
|
Filter criteria (e.g., __archived:false). Defaults to "__archived:false". |
'__archived:false'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: List of machines. |
get_routers
get_routers(page=0, size=10, sort='name', order='asc', filter='__archived:false')
Retrieve a list of routers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
int
|
Page number, starting from 0. Defaults to 0. |
0
|
size
|
int
|
Number of items per page. Defaults to 10. |
10
|
sort
|
str
|
Sort field (e.g., name, companyName, online, locationName). Defaults to "name". |
'name'
|
order
|
str
|
Sort order (asc or desc). Defaults to "asc". |
'asc'
|
filter
|
str
|
Filter criteria (e.g., __archived:false). Defaults to "__archived:false". |
'__archived:false'
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: List of routers. |
get_user_info
get_user_info()
Retrieve user information.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: User information. |