Devices¶
Devices are objects that can be identified, and they are the main entity in a Devicehub. Refer to Device for more info.
Schema¶
The following schema represents all the device types and their properties.
Thing¶
Extends Schema
- type
Text. The name of the type of Thing, like “Device” or “Receive”. This is the same as JSON-LD
@type
.This field is required when submitting values so Devicehub knows the type of object. Devicehub always returns this value.
- sameAs
List.
- Submit
No.
- updated
Date time (ISO 8601 with timezone). The last time Devicehub recorded a change for this thing.
- Submit
No.
- created
Date time (ISO 8601 with timezone). When Devicehub created this.
- Submit
No.
Device¶
Extends Thing
Base class for any type of physical object that can be identified.
Device partly extends Schema’s IndividualProduct, adapting it to our use case.
A device requires an identification method, ideally a serial number, although it can be identified only with tags too. More ideally both methods are used.
Devices can contain Components
, which are just a type of device
(it is a recursive relationship).
- id
Integer. The identifier of the device for this database. Used only internally for software; users should not use this.
- Submit
No.
- hid
Text. The Hardware ID (HID) is the unique ID traceability systems use to ID a device globally. This field is auto-generated from Devicehub using literal identifiers from the device, so it can re-generated offline.
The HID is the result of concatenating, in the following order: the type of device (ex. Computer), the manufacturer name, the model name, and the S/N. It is joined with hyphens, and adapted to comply with the URI specification, so it can be used in the URI identifying the device on the Internet. The conversion is done as follows:
non-ASCII characters are converted to their ASCII equivalent or removed.
Characterst that are not letters or numbers are converted to underscores, in a way that there are no trailing underscores and no underscores together, and they are set to lowercase.
Ex.
laptop-acer-aod270-lusga_0d0242201212c7614
- Submit
No.
- tags
List of Tag. A set of tags that identify the device.
- model
Text. The model of the device in lower case.
The model is the unambiguous, as technical as possible, denomination for the product. This field, among others, is used to identify the product.
- manufacturer
Text. The normalized name of the manufacturer, in lower case.
Although as of now Devicehub does not enforce normalization, users can choose a list of normalized manufacturer names from the own
/manufacturers
REST endpoint.- serialNumber
Text.
- brand
Text. A naming for consumers. This field can represent several models, so it can be ambiguous, and it is not used to identify the product.
- generation
Integer. The generation of the device.
- version
Text. Device.version
- weight
Float (kgm). The weight of the device in Kg.
- width
Float (m). The width of the device in meters.
- height
Float (m). The height of the device in meters.
- depth
Float (m). The depth of the device in meters.
- actions
List of Action. All the actions where the device participated, including:
Actions performed directly to the device.
Actions performed to a component.
Actions performed to a parent device.
Actions are returned by descending
created
time.- Submit
No.
- actions_one
List of Action.
- problems
List of Action. Current actions with severity.Warning or higher.
There can be up to 3 actions: current Snapshot, current Physical action, current Trading action.
- Submit
No.
- url
URL. The URL where to GET this device.
- Submit
No.
- lots
List of Lot. The lots where this device is directly under.
- Submit
No.
- rate
Rate. The last Rate of the device.
- Submit
No.
- price
Price. The actual Price of the device, or None if no price has ever been set.
- Submit
No.
- trading
Trading. The actual trading state, or None if no Trade action has ever been performed to this device.
Trading states.
- cvar Reserved
The device has been reserved.
- cvar Cancelled
The device has been cancelled.
- cvar Sold
The device has been sold.
- cvar Donated
The device is donated.
- cvar Renting
The device is in renting
- cvar ToBeDisposed
The device is disposed. This is the end of life of a device.
- cvar ProductDisposed
The device has been removed from the facility. It does not mean end-of-life.
- Submit
No.
- physical
Physical. The actual physical state, None otherwise.
Physical states.
- cvar ToBeRepaired
The device has been selected for reparation.
- cvar Repaired
The device has been repaired.
- cvar Preparing
The device is going to be or being prepared.
- cvar Prepared
The device has been prepared.
- cvar Ready
The device is in working conditions.
- cvar InUse
The device is being reported to be in active use.
- Submit
No.
- physicalPossessor
Agent.
- Submit
No.
- productionDate
Date time (ISO 8601 with timezone). The last time Devicehub recorded a change for this thing.
- working
List of Action. A list of the current tests with warning or errors. A device is working if the list is empty.
This property returns, for the last test performed of each type, the one with the worst
severity
of them, orNone
if no test has been executed.- Submit
No.
- variant
Text. A variant or sub-model of the device.
- sku
Text. The Stock Keeping Unit (SKU), i.e. a merchant-specific identifier for a product or service.
- image
URL. An image of the device.
Computer¶
Extends Device
A chassis with components inside that can be processed automatically with Workbench Computer.
Computer is broadly extended by Desktop
, Laptop
, and
Server
. The property chassis
defines it more granularly.
- components
List of Component. The components that are inside this computer.
- Submit
No.
- chassis
ComputerChassis. The physical form of the computer.
It is a subset of the Linux definition of DMI / DMI decode.
- Tower
Tower
- Docking
Docking
- AllInOne
All in one
- Microtower
Microtower
- PizzaBox
Pizza box
- Lunchbox
Lunchbox
- Stick
Stick
- Netbook
Netbook
- Handheld
Handheld
- Laptop
Laptop
- Convertible
Convertible
- Detachable
Detachable
- Tablet
Tablet
- Virtual
Non-physical device
- Required
Yes.
- ramSize
Integer. The total of RAM memory the computer has.
- Submit
No.
- dataStorageSize
Integer. The total of data storage the computer has.
- Submit
No.
- processorModel
Text. The model of one of the processors of the computer.
- Submit
No.
- graphicCardModel
Text. The model of one of the graphic cards of the computer.
- Submit
No.
- networkSpeeds
List. Returns two values representing the speeds of the network adapters of the device.
The max Ethernet speed of the computer, 0 if ethernet adaptor exists but its speed is unknown, None if no eth adaptor exists.
The max WiFi speed of the computer, 0 if computer has WiFi but its speed is unknown, None if no WiFi adaptor exists.
- Submit
No.
- privacy
List of Action. Returns the privacy of all
DataStorage
components when it is not None.- Submit
No.
- deposit
Integer. None
- owner_address
Text.
- transfer_state
TransferState. State of transfer for a given Lot of devices.
- Initial
- Initiated
1
- Accepted
2
- Completed
3
- receiver_address
Text.
- deliverynote_address
Text.
Laptop¶
Extends Computer
- layout
Layouts. Layout of a built-in keyboard of the computer, if any.
Keyboard layouts. Taken from Debian’s 9 /usr/share/X11/xkb/rules/evdev.lst.
Mobile¶
Extends Device
A mobile device consisting of smartphones, tablets, and cellphones.
- imei
Integer. The International Mobile Equipment Identity of the smartphone as an integer.
- meid
Text. The Mobile Equipment Identifier as a hexadecimal string.
- ramSize
Integer (mbyte). The total of RAM of the device in MB.
- dataStorageSize
Integer. Mobile.data_storage_size
- displaySize
Float. The total size of the device screen
GraphicCard¶
Extends Component
- memory
Integer (mbyte). The amount of memory of the Graphic Card in MB.
DataStorage¶
Extends Component
A device that stores information.
- size
Integer (mbyte). The size of the data-storage in MB.
- interface
DataStorageInterface.
- ATA
ATA
- USB
USB
- PCI
PCI
- privacy
Action.
- Submit
No.
Motherboard¶
Extends Component
- slots
Integer. PCI slots the motherboard has.
- usb
Integer. None
- firewire
Integer. None
- serial
Integer. None
- pcmcia
Integer. None
- biosDate
Date. Motherboard.bios_date
- ramSlots
Integer.
- ramMaxSize
Integer.
Processor¶
Extends Component
The CPU.
- speed
Float (ghz). The regular CPU speed.
- cores
Integer. The number of regular cores.
- threads
Integer. The number of threads per core.
- address
Integer. The address of the CPU: 8, 16, 32, 64, 128 or 256 bits.
- abi
Text. The Application Binary Interface of the processor.
RamModule¶
Extends Component
A stick of RAM.
- size
Integer (mbyte). The capacity of the RAM stick.
- speed
Integer (mhz).
- interface
RamInterface.
- SDRAM
SDRAM
- DDR
DDR SDRAM
- DDR2
DDR2 SDRAM
- DDR3
DDR3 SDRAM
- DDR4
DDR4 SDRAM
- DDR5
DDR5 SDRAM
- DDR6
DDR6 SDRAM
- format
RamFormat.
- DIMM
DIMM
- SODIMM
SODIMM
Display¶
Extends DisplayMixin
The display of a device. This is used in all devices that have
displays but that it is not their main part, like laptops,
mobiles, smart-watches, and so on; excluding ComputerMonitor
and TelevisionSet
.
Battery¶
Extends Component
- wireless
Boolean. If the battery can be charged wirelessly.
- technology
BatteryTechnology. None
- LiIon
Lithium-ion
- NiCd
Nickel-Cadmium
- NiMH
Nickel-metal hydride
- LiPoly
Lithium-ion Polymer
- LiFe
LiFe
- LiMn
Lithium Manganese
- Al
Alkaline
- size
Integer. Maximum battery capacity by design, in mAh.
Use BatteryTest’s “size” to get the actual size of the battery.
- Required
Yes.
Camera¶
Extends Component
The camera of a device.
- focalLength
Integer.
- videoHeight
Integer.
- videoWidth
Integer.
- horizontalViewAngle
Integer.
- facing
Integer.
- verticalViewAngle
Integer.
- videoStabilization
Integer.
- flash
Integer.
Manufacturer¶
Extends Schema
The normalized information about a manufacturer.
Ideally users should use the names from this list when submitting devices.
- name
Text.
- Submit
No.
- url
URL.
- Submit
No.
- logo
URL.
- Submit
No.
Keyboard¶
Extends ComputerAccessory
- layout
Layouts.
Keyboard layouts. Taken from Debian’s 9 /usr/share/X11/xkb/rules/evdev.lst.
Printer¶
Extends Device
- wireless
Boolean. Whether it is a wireless printer.
- Required
Yes.
- scanning
Boolean. Whether the printer has scanning capabilities.
- Required
Yes.
- technology
PrinterTechnology. Technology used to print.
- Toner
Toner / Laser
- Inkjet
Liquid inkjet
- SolidInk
Solid ink
- Dye
Dye-sublimation
- Thermal
Thermal
- Required
Yes.
- monochrome
Boolean. Whether the printer is only monochrome.
- Required
Yes.
API¶
You can retrieve devices using GET /devices/
, or a specific
device by GET /devices/24
.
You can filter devices GET /devices/?filter={"type": "Computer"}
,
sort them GET /devices/?sort={"created": 1}
, and perform
natural search with ``GET /devices/?search=foo bar. Of course
you can combine them in the same query, returning devices that
only pass all conditions.
Results are paginated; you get up to 30 devices and up to 30
groups in a page. Select the actual page by GET /inventory?page=3
.
By default you get the page number 1
.
Query¶
The query consists of 4 optional params:
search: Filters devices by performing a full-text search over their physical properties, events, and tags. Search is a string.
filter: Filters devices field-by-field. Each field can be filtered in different ways, see them in
ereuse_devicehub.resources.devices.Filters
. Filter is a JSON-encoded object whose keys are the filters. By default is empty (no filter applied).sort: Sorts the devices. You can specify multiple sort clauses as it is a JSON-encoded object whose keys are fields and values are truthy for ascending order, or falsy for descending order. By default it is sorted by
Device.created
descending (newest devices first).page: A natural number that specifies the page to retrieve. By default is
1
; the first page.
Result¶
The result is a JSON object with the following fields:
items: A list of devices.
pagination: - page: The page you requested in the
page
param of the query,or
1
.perPage: How many devices are in every page, fixed to
30
.total: How many total devices passed the filters.
next: The number of the next page, if any.
last: The number of the last page, if any.