emnify.modules.device¶
Submodules¶
Classes¶
Manager that allows to get/retrieve/create/update/send_sms to device |
Package Contents¶
- class emnify.modules.device.DeviceManager(client)¶
Manager that allows to get/retrieve/create/update/send_sms to device
- Args:
client: An instance of the EMnify class used for making API requests.
- client¶
- property device_model¶
- property list_sms_model¶
- property device_detailed_model¶
- property sms_create_model¶
- property event_model¶
- property status_model¶
- property device_create_model¶
- property device_update_model¶
- property service_profile_model¶
- property tariff_profile_model¶
- property get_device_sort_enum¶
- property get_device_filter_model: Type[emnify.modules.device.models.FilterDeviceModel]¶
- get_device_sms_list(*, device: emnify.modules.device.models.Device | int) emnify.modules.device.models.ListSms ¶
Returns a list of SMS from the device.
- Parameters:
device – device model or id of device
- Returns:
list of devices
- send_sms(*, device: emnify.modules.device.models.Device | int | emnify.modules.device.models.RetrieveDevice, sms: emnify.modules.device.models.SmsCreateModel) bool ¶
Sends an SMS to the device.
- Parameters:
device – device model or id of device
sms – SmsCreateModel
- Returns:
True if sms was sent
- update_device(*, device_id: int, device: emnify.modules.device.models.UpdateDevice) emnify.modules.device.models.Device ¶
Updates the device.
- Parameters:
device_id – id of device
device – device update model
- Returns:
True if device was updated
- reset_connectivity_network(device_id: int) True ¶
Resets the device’s connectivity network.
- Parameters:
device_id – id of device
- Returns:
True if reset of network was successful
- reset_connectivity_data(device_id: int) True ¶
Resets the device’s connectivity data.
- Parameters:
device_id – id of device
- Returns:
True if reset of data was successful
- get_device_connectivity_status(device_id: int) emnify.modules.device.models.DeviceConnectivityStatus ¶
Returns the device’s connectivity status.
- Parameters:
device_id – id of device
- Returns:
DeviceConnectivityStatus model
- get_devices_list(*args, filter_model: emnify.modules.device.models.FilterDeviceModel = None, sort_enum: emnify.modules.device.models.DeviceSortModel = None, **kwargs) Generator[emnify.modules.device.models.Device, None, None] ¶
Returns a list of devices.
- Parameters:
filter_model – device filter model
sort_enum – device sort enum
- Returns:
list of devices
- delete_device(device_id: int) True ¶
Deletes the device.
- Parameters:
device_id – id of device
- Returns:
True if device was deleted
- add_device_blacklist_operator(device_id: int, operator_id: int) True ¶
Adds an operator to the blacklist.
- Parameters:
device_id – id of device
operator_id – id of operator
- Returns:
True if operator was added to blacklist
- delete_device_blacklist_operator(device_id: int, operator_id: int)¶
Removes an operator from the blacklist.
- Parameters:
device_id – id of device
operator_id – id of operator
- Returns:
True if operator was deleted from blacklist
- get_device_operator_blacklist(device_id: int)¶
Returns a list of blacklisted operators.
- Parameters:
device_id – id of device
- Returns:
list of operators
- get_device_events_list(device: emnify.modules.device.models.Device | int)¶
Returns a list of events for the device.
- Parameters:
device – Device pydantic-model or int
- Returns:
Generator with Device objects
- change_status(device: emnify.modules.device.models.UpdateDevice | emnify.modules.device.models.Device | emnify.modules.device.models.RetrieveDevice | int, enable: bool = None, disable: bool = None) bool ¶
Changes the status of a device and its assigned SIM to enabled or disabled.
- Parameters:
device – The ID or device model to update.
enable – Whether to enable the device.
disable – Whether to disable the device.
- Raises:
ValidationErrorException – If neither enable nor disable is provided, or if both are provided.
- disable_device(device_id: int)¶
Changes a device status to ‘disabled’.
- Parameters:
device_id – id of device
- Returns:
True if device was disabled
- release_sim(device_id: int)¶
Releases the assigned SIM from the device.
- Parameters:
device_id – id of device
- Returns:
True if sim was released
- assign_sim(device_id: int, sim_id: int, enable: bool = False) None ¶
Assigns a SIM to the device
- Parameters:
device_id – id of device
sim_id – id of SIM
enable – boolean value/activate to enable or disable the device
- create_device(device: emnify.modules.device.models.Device) bool ¶
Creates a device
- Parameters:
device – device model
- Returns:
True if device was created
- retrieve_device(device_id: int) emnify.modules.device.models.RetrieveDevice ¶
Retrieves endpoint details for a given ID.
- Parameters:
device_id – id of the device.
- Returns:
Endpoint details associated with the given ID.
- static validate_device(device: emnify.modules.device.models.Device) int ¶
- static __check_device_status(device, status: dict)¶
- __change_device_status(action: str, device)¶
- static __transform_all_devices_filter_params(filter_model: emnify.modules.device.models.FilterDeviceModel = None, sort_enum: emnify.modules.device.models.DeviceSortModel = None) dict ¶