-
Notifications
You must be signed in to change notification settings - Fork 2
Unified data model
simen edited this page May 4, 2017
·
10 revisions
Freebird uses two unified data models Device Class and Gadget Class to represent the real-world device and gadget respectively.
The instance of this class contains the device network information and attributes, such as its network address, manufacturer name, and hardware version. The network data and attributes are described by netInfoObj and devAttrsObj objects, respectively.
- Use API dev.get() to get the interested information about the device.
- Example:
dev.get('net')
,dev.get('attrs')
,dev.get('permAddr')
,dev.get('status')
, .etc
- Use API dev.set() to set data to the device.
- Use
dev.set('net', netInfoObj)
to set network information of the device. Theaddress
property is a must.
Property | Type | Mandatory | Description |
---|---|---|---|
address | Object | required | Device address object { permanent, dynamic } , where permanent is the permanent address and dynamic is dynamic address for the device. Noted that permanent address must be a string and dynamic address can be either a string or a number. |
role | String | optional | The network role of the device which depends on the protocol, e.g., zigbee may use 'router', 'end-device', and BLE may use 'central', 'peripheral' |
parent | String | optional | The permanent address of the device's parent node. If a device is directly centralized to the netcore (star topology), then this field must be '0'. The default value is '0'. |
maySleep | Boolean | optional | Set this field to true if the device may enter sleep mode. The default value is false . |
sleepPeriod | Number | optional | This field is valid when maySleep is true . Set the number of seconds if you know the sleeping duraiton of the device. Freebird uses this value for device status checking algorithm. |
- Use
dev.set('attrs', devAttrsObj)
to set device attributes. All propertys indevAttrsObj
are optional but you should fill then as much as you can. You may need to remotely read the device attributes to get all data you need.
Property | Type | Mandatory | Description |
---|---|---|---|
manufacturer | String | optional | Manufacturer name or identifier |
model | String | optional | Model name |
serial | String | optional | Serial number |
version | Object | optional | This object in shape of { hw, sw, fw } is to record the hardware (hw), software (sw), and firmware (fw) verions. The version must be a string. |
power | Object | optional | This object in shape of { type, voltage } is to record the power supply type, where type can be 'line', 'battery', or 'harvester', and voltage is a string with an unit. e.g., '5 V' |
The instance of this class contains the application information (panel info) and attributes of a gadget. The application information and attributes are described by panelInfoObj and gadAttrsObj objects, respectively.
- Use API gad.get() to get the interested information about the gadget.
- Example:
gad.get('panel')
,dev.get('attrs')
,dev.get('permAddr')
,dev.get('location')
, .etc
- Use API gad.set() to set data to the gadget.
- Use
gad.set('panel', panelInfoObj)
to set panel information of the gadget. TheclassId
property is a must and it is an IPSO-defined identifier in string, which tells the kind of this gadget is, for example, 'temperature', 'presence', 'buzzer', .etc. Please see panelInfoObj <<Important>> for details.
Property | Type | Mandatory | Description |
---|---|---|---|
classId | String | required | IPSO-defined identifier to classify a gadget |
profile | String | optional | The profile of this object. e.g., 'HA' (which means home automation) |
- Use
gad.set('attrs', gadAttrsObj)
to set gadget attributes. According to which classId the gadget has, some properties ingadAttrsObj
are mandatory and some are optional. You may need to remotely read the gadget attributes to get all data you need.
Property | Type | Description |
---|---|---|
Others | Depends | Remote attributes depend on classId of the gadget. For a temperature sensor, it will have an attribute sensorValue , and may have attributes like units and resetMinMaxMeaValues . The possible attributes are listed here. |
freebird team
Overview
Main Classes
Design Your Own Netcore
- Workflow
- APIs for Implementer
- Unified data model
- What should be implemented
Appendix
- Device data object format
- Gadget data object format