-
Notifications
You must be signed in to change notification settings - Fork 0
Appendix
simen edited this page May 11, 2017
·
6 revisions
-
Properties
Property Type Description name String Netcore name enabled Boolean Is this netcore enabled? protocol Object Network protocol of this netcore. startTime Number Start time of this netcore. (UNIX time in secs) traffic Object Accumulated inbound and outbound data since netcore started. { in: { hits: 6, bytes: 24 }, out: { hits: 3, bytes: 30 } } (unit: bytes) numDevs Number Number of devices managed by this netcore numGads Number Number of gadgets managed by this netcore -
Example
{ name: 'zigbee-core', enabled: true, protocol: { // required phy: 'ieee802.15.4', // required, physical layer dll: '', // optional, data link layer nwk: 'zigbee', // required, network layer tl: '', // optional, transportation layer sl: '', // optional, session layer pl: '', // optional, presentation layer apl: 'zcl', // optional, application layer }, startTime: 1458008208, defaultJoinTime: 180, traffic: { in: { hits: 6, bytes: 24 }, out: { hits: 3, bytes: 30 } }, numDevs: 32, numGads: 46 }
-
Properties
Property Type Description id Number Device id netcore String Name of the netcore that holds this device gads Number[] A list of gadget ids that this device owns net Object Network information of the device. props Object Meta-properties of the device. This is for client users to set something to the device attrs Object Attributes of the device. This is attributes of the remote device. -
net
object
Property Type Description enabled Boolean Is this device enabled? joinTime Number Device join time. UNIX time in secs timestamp Number Device last activity. UNIX time in secs role String Device role. Depends on protocol, i.e., 'peripheral' for BLE devices, 'router' for zigbee devices parent String Parent device permanent address. It is string '0' if device parent is its netcore status String Device status, can be 'online', 'sleep', 'offline', or 'unknown' address Object Device permanent and dynamic addresses. { permanent: '00:0c:29:ff:ed:7c', dynamic: '192.168.1.101' } traffic Object Accumulated inbound and outbound data since device joined. { in: { hits: 6, bytes: 24 }, out: { hits: 3, bytes: 30 } } (unit: bytes) -
props
object
Property Type Description name String Device name. This is not on the remote device and can be set by end-users. description String Device description. This is not on the remote device and can be set by end-users. location String Device location. This is not on the remote device and can be set by end-users. others Any Anything end-users like to set to device props
by setProps API.-
attrs
object
Property Type Description manufacturer String Manufacturer name model String Model name version Object Version tags. { hw: '', sw: 'v1.2.2', fw: 'v0.0.8' } power Object Power source. { type: 'battery', voltage: '5V' }. The type can be 'line', 'battery' or 'harvester' -
-
Example
{ id: 6, netcore: 'mqtt-core', gads: [ 116, 117 ], net: { enabled: true, joinTime: 1458008208, timestamp: 1458008617, role: 'client', // depends on protocol parent: '0', // parent is the netcore status: 'online' address: { permanent: '00:0c:29:ff:ed:7c', dynamic: '192.168.1.73' }, traffic: { // accumulated data since device joined in: { hits: 6, bytes: 72 }, out: { hits: 12, bytes: 96 } } }, props: { // props: name, description, and location are writable and can be modified by users name: 'sample_device', description: 'This is a device example', location: 'balcony' }, attrs: { manufacturer: 'freebird', model: 'lwmqn-7688-duo', serial: 'lwmqn-2016-03-15-01', version: { hw: 'v1.2.0', sw: 'v0.8.4', fw: 'v2.0.0' }, power: { type: 'line', voltage: '5V' } } }
-
Properties
Property Type Description id Number Gadget id netcore String Name of the netcore that holds this gadget dev Object Id and permanent address of which device owns this gadget. { id: 3, permAddr: '0x00124b0001ce4b89' } auxId String The auxiliary id to identify the gadget on a device panel Object Basic information about the gadget. { enabled: true, profile: 'home', classId: 'temperature' } props Object Meta-properties of this gadget. This is for client users to set something to the gadget attrs Object Attributes of this gadget -
panel
object
Property Type Description enabled Boolean Is this gadget enabled? profile String Optional. The profile defines the application environment, may mot be given. classId String The classId defines what application the gadget is. The gadget class to denote its application, i.e. 'illuminance', 'temperature', 'lightCtrl' -
props
object
Property Type Description name String Gadget name. This is not on the remote device and can be set by end-users. description String Gadget description. This is not on the remote device and can be set by end-users. others Any Anything end-users like to set to gadget props
by setProps API.-
attrs
object
Property Type Description Depends Any The gadget attributes that could be read, written, or excuted on the remote device. -
-
Example
{ id: 308, netcore: 'zb-core', dev: { id: 26, permAddr: '0x00124b0001ce4b89' }, panel: { enabled: true, profile: 'home_automation', // it will be an empty string '' if no profile given classId: 'lightCtrl' }, props: { // props: name and description writable and can be modified by end-users name: 'sampleLight', description: 'This is a simple light controller' }, attrs: { onOff: 1, dimmer: 80 } }
-
Properties
Property Type Mandatory Description pmin Number optional Minimum Period. Minimum time in seconds the gadget should wait from the time when sending the last notification to the time when sending a new notification. pmax Number optional Maximum Period. Maximum time in seconds the gadget should wait from the time when sending the last notification to the time sending the next notification (regardless if the value has changed). gt Number optional Greater Than. The gadget should notify its attribute when the value is greater than this setting. Only valid for the attribute typed as a number. lt Number optional Less Than. The gadget should notify its attribute when the value is smaller than this setting. Only valid for the attribute typed as a number. step Number optional Step. The gadget should notify its value when the change of the attribute value, since the last report happened, is greater than this setting. enable Boolean required It is set to true for the gadget to start reporting an attribute. Set to false to stop reporting. -
Example
// start reporting with the following settings { pmin: 10, pmax: 60, lt: 120 gt: 260 enable: true } // the time chart of reporting: (O: report triggered, xxxxx: pmin, -----: pmax) // O O O O O O O O // |xxxxx|-------------|xxxxx|-------------|xxxxx|-------------|xxxxx|-------------| // 0s 10s 70s 80s 140s 150s 210s 220s 280s // <10s> < 60s > // note: // 1. only in |---------| duration, any change meets lt or gt condition will be reported // 2. In this example, the attribute will be reported when its value is greater than 260 or is less than 120
// start periodical reporting { pmin: 0, pmax: 30, enable: true } // the time chart of reporting: (O: report triggered, xxxxx: pmin, -----: pmax) // O O O O O 0 // |-------------|-------------|-------------|-------------|-------------| // 0s 30s 60s 90s 120s 150s // note: // 1. In this example, the attribute will be reported every 30 seconds
// set but not start reporting { gt: 50 enable: false }
// start reporting with the current settings { enable: true }
// stop reporting { enable: false }
Freebird framework uses the classId
property on a gadget to define its application. The classes are Smart Object Identfiers defined by IPSO SmartObject Guideline(Smart Objects Starter Pack1.0). Here is the table of Object ids from lwm2m-id library.
Class Id | Description |
---|---|
'dIn' | Digital Input |
'dOut' | Digital Output |
'aIn' | Analogue Input |
'aOut' | Analogue Output |
'generic' | Generic Sensor |
'illuminance' | Illuminance Sensor |
'presence' | Presence Sensor |
'temperature' | Temperature Sensor |
'humidity' | Humidity Sensor |
'pwrMea' | Power Measurement |
'actuation' | Actuation |
'setPoint' | Set Point |
'loadCtrl' | Load Control |
'lightCtrl' | Light Control |
'pwrCtrl' | Power Control |
'accelerometer' | Accelerometer |
'magnetometer' | Magnetometer |
'barometer' | Barometer |
'voltage' | Voltage |
'current' | Current |
'frequency' | Frequency |
'depth' | Depth |
'percentage' | Percentage |
'altitude' | Altitude |
'load' | Load |
'pressure' | Pressure |
'loudness' | Loudness |
'concentration' | Concentration |
'acidity' | Acidity |
'conductivity' | Conductivity |
'power' | Power |
'powerFactor' | Power Factor |
'distance' | Distance |
'energy' | Energy |
'direction' | Direction |
'time' | Time |
'gyrometer' | Gyrometer |
'colour' | Colour |
'gpsLocation' | GPS Location |
'positioner' | Positioner |
'buzzer' | Buzzer |
'audioClip' | Audio Clip |
'timer' | Timer |
'addressableTextDisplay' | Addressable Text Display |
'onOffSwitch' | On/Off Switch |
'levelControl' | Level Controller |
'upDownControl' | Up/Down Controller |
'multipleAxisJoystick' | Multiple Axis Joystick |
'rate' | Rate |
'pushButton' | Push Button |
'multistateSelector' | Multi-state Selector |
Code | Description |
---|---|
200 | OK |
201 | Created |
202 | Deleted |
204 | Changed |
205 | Content |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
405 | Method Not Allowed |
408 | Timeout |
409 | Conflict |
500 | Internal Server Error |
Overview
Usage
APIs & Events
- createClient()
- createServer()
- Client Class
- Server Class
- send()
- broadcast()
- 'message' event
Messaging Interface
REQ/RSP Message Model
IND Message Model
Appendix
- Data Objects
- Gadget classId
- Status Code