Kind: global class
- Homecloud
- new Homecloud(options)
- instance
- .start()
- .newNodes(nodes, [onSend], [onError])
- .newData(dataArray, [onSend], [onError])
- .newCommand(dataArray, [onSend], [onError])
- .setNodeState(nodeId, alive, [onSend], [onError])
- .actionResult(action, result, [onSend], [onError])
- .getRules([onSend], [onError])
- .onAction(callback)
- .onRules(callback)
- .onAcceptNode(callback)
- .onRemoveNode(callback)
- inner
- ~onSend :
function - ~onNotification :
function
- ~onSend :
| Param | Type | Description |
|---|---|---|
| options | Object |
Server and controller configurations |
Starts the client. It logins and then connects the websocket. Just call this function one time.
Kind: instance method of Homecloud
Notificates server of new detected nodes
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| nodes | Array.<Homecloud~Node> |
List containing new detected nodes |
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Notificates server of new sensor data
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| dataArray | Array.<Homecloud~Data> |
List containing new sensor data |
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Notificates server of new actuator change (external command or by rules)
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| dataArray | Array.<Homecloud~Data> |
List containing executed commands |
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Notificates server of state change in the node
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| nodeId | number |
Id of the node |
| alive | boolean |
Indicates if the node is alive (true) or dead (false) |
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Notificates server of the result of an action he asked
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| action | Homecloud~Action |
The action executed (or not) |
| result | boolean |
Indicates if the action was executed (true) or not (false) |
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Gets all the accepted rules in the server
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| [onSend] | Homecloud~OnSend |
Callback to call when the message was sent, containing the rules |
| [onError] | Homecloud~OnError |
Callback to call when the server rejected the message |
Defines the function to call when there is an action
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| callback | Homecloud~OnNotification |
Callback to call when server send new action |
Defines the function to call when there is change in rules
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| callback | Homecloud~OnNotification |
Callback to call when there is change in rules |
Defines the function to call when user accepted (or not) a discovered node
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| callback | Homecloud~OnNotification |
Callback to call when a node is accepted (or not) |
Defines the function to call when a node is removed by the user
Kind: instance method of Homecloud
| Param | Type | Description |
|---|---|---|
| callback | Homecloud~OnNotification |
Callback to call when a node is removed |
Callback used by messages to the server
Kind: inner typedef of Homecloud
| Param | Type | Description |
|---|---|---|
| data | Object |
Json object containing the response from server. It contains at least a status property |
Callback used by notifications from the server
Kind: inner typedef of Homecloud
| Param | Type | Description |
|---|---|---|
| data | Object |
Json object containing the notification. |