Device group
Device group resource for grouping devices.
SyncDeviceGroups
SyncDeviceGroups(client: SyncClient)
Bases: BaseResource['SyncClient']
Device groups resource for device grouping.
Methods:
-
create–Create a new device group.
-
delete–Delete a device group.
-
get–Retrieve a device group by its ID.
-
get_all–List all device groups.
-
get_recent–Retrieve devices with recent data in a group.
-
patch–Partially update a device group.
-
update–Update a device group (full replacement).
create
create(data: DeviceGroupCreate) -> str
Create a new device group.
Parameters:
-
(dataDeviceGroupCreate) –The device group creation data.
Returns:
-
str(str) –The ID of the newly created device group.
delete
Delete a device group.
Parameters:
-
(group_idstr) –The unique identifier of the device group to delete.
Returns:
-
None–None
get
get(group_id: str) -> DeviceGroupInstance
Retrieve a device group by its ID.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
Returns:
-
DeviceGroupInstance(DeviceGroupInstance) –The device group instance matching the given ID.
get_all
get_all() -> list[DeviceGroupInstance]
List all device groups.
Returns:
-
list[DeviceGroupInstance]–list[DeviceGroupInstance]: List of all device group instances.
get_recent
get_recent(
group_id: str,
payload: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
) -> list[str]
Retrieve devices with recent data in a group.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(payloadstr | None, default:None) –Optional payload filter.
-
(start_timedatetime | None, default:None) –Optional ISO 8601 formatted start time.
-
(end_timedatetime | None, default:None) –Optional ISO 8601 formatted end time.
Returns:
patch
patch(group_id: str, data: DeviceGroupPatch) -> bool
Partially update a device group.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(dataDeviceGroupPatch) –The partial device group data to update.
Returns:
-
DeviceGroupInstance(bool) –The updated device group instance.
update
update(group_id: str, data: DeviceGroupUpdate) -> bool
Update a device group (full replacement).
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(dataDeviceGroupUpdate) –The complete device group data for replacement.
Returns:
-
DeviceGroupInstance(bool) –The updated device group instance.
AsyncDeviceGroups
AsyncDeviceGroups(client: AsyncClient)
Bases: BaseResource['AsyncClient']
Async device groups resource for device grouping.
Methods:
-
create–Create a new device group.
-
delete–Delete a device group.
-
get–Retrieve a device group by its ID.
-
get_all–List all device groups.
-
get_recent–Retrieve devices with recent data in a group.
-
patch–Partially update a device group.
-
update–Update a device group (full replacement).
create
async
create(data: DeviceGroupCreate) -> str
Create a new device group.
Parameters:
-
(dataDeviceGroupCreate) –The device group creation data.
Returns:
-
str(str) –The ID of the newly created device group.
delete
async
Delete a device group.
Parameters:
-
(group_idstr) –The unique identifier of the device group to delete.
Returns:
-
None–None
get
async
get(group_id: str) -> DeviceGroupInstance
Retrieve a device group by its ID.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
Returns:
-
DeviceGroupInstance(DeviceGroupInstance) –The device group instance matching the given ID.
get_all
async
get_all() -> list[DeviceGroupInstance]
List all device groups.
Returns:
-
list[DeviceGroupInstance]–list[DeviceGroupInstance]: List of all device group instances.
get_recent
async
get_recent(
group_id: str,
payload: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
) -> list[str]
Retrieve devices with recent data in a group. TODO: define payload filter better.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(payloadstr | None, default:None) –Optional payload filter.
-
(start_timedatetime | None, default:None) –Optional start time.
-
(end_timedatetime | None, default:None) –Optional end time.
Returns:
patch
async
patch(group_id: str, data: DeviceGroupPatch) -> bool
Partially update a device group.
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(dataDeviceGroupPatch) –The partial device group data to update.
Returns:
-
bool(bool) –True if the patch was successful.
update
async
update(group_id: str, data: DeviceGroupUpdate) -> bool
Update a device group (full replacement).
Parameters:
-
(group_idstr) –The unique identifier of the device group.
-
(dataDeviceGroupUpdate) –The complete device group data for replacement.
Returns:
-
bool(bool) –True if the update was successful.
Request and response types: Device group models.