Inventory
Create​
Create a new group, and device and assign the device to the group​
- Shell
- PowerShell (native)
- PowerShell (PSc8y)
$Group = c8y devicegroups create --name "AU_Group" -o csv --select id
c8y devices create --name "myDevice01" |
c8y devicegroups assignDevice --group $Group
$Group = c8y devicegroups create --name "AU_Group" -o csv --select id
c8y devices create --name "myDevice01" |
c8y devicegroups assignDevice --group $Group
$Group = New-DeviceGroup -Name "AU_Group" | fromjson
New-Device -Name "myDevice01" |
Add-DeviceToGroup -Group $Group.id
Update​
Find a managed object by name, and then update it's name​
- Shell
- PowerShell (native)
- PowerShell (PSc8y)
c8y inventory find --query "name eq 'AU_Group'" --pageSize 1 |
c8y inventory update --newName "AUS_Group"
c8y inventory find --query "name eq 'AU_Group'" --pageSize 1 |
c8y inventory update --newName "AUS_Group"
Find-ManagedObjectCollection -Query "name eq 'AU_Group'" -PageSize 1 |
Update-ManagedObject -NewName "AUS_Group"
Adding update firmware and software capabilities (using supported operations)​
- Shell
- PowerShell (native)
- PowerShell (PSc8y)
c8y devices list --query "name eq 'myDevice*'" |
c8y inventory update \
--template "{c8y_SupportedOperations: ['c8y_Firmware', 'c8y_SoftwareList']}"
c8y devices list --query "name eq 'myDevice*'" |
c8y inventory update `
--template "{c8y_SupportedOperations: ['c8y_Firmware', 'c8y_SoftwareList']}"
New-DeviceCollection -Query "name eq 'myDevice*'" |
Update-ManagedObject `
-Template "{c8y_SupportedOperations: ['c8y_Firmware', 'c8y_SoftwareList']}"
Remove a fragment​
- Shell
- PowerShell (native)
- PowerShell (PSc8y)
c8y inventory find --query "name eq 'myDevice*'" |
c8y inventory update --template "{c8y_Hardware: null}"
c8y inventory find --query "name eq 'myDevice*'" |
c8y inventory update --template "{c8y_Hardware: null}"
Find-ManagedObjectCollection -Query "name eq 'myDevice*'" |
Update-ManagedObject -Template "{c8y_Hardware: null}"
Child Assets and Devices​
Get a list of child assets of a group​
- Shell
- PowerShell (native)
- PowerShell (PSc8y)
c8y devicegroups listAssets --id "AUS_Group"
c8y devicegroups listAssets --id "AUS_Group"
Get-DeviceGroupCollectionAssets -Id "AUS_Group"