Skip to content

Latest commit

 

History

History
183 lines (127 loc) · 6.76 KB

File metadata and controls

183 lines (127 loc) · 6.76 KB

Homecloud

Kind: global class

new Homecloud(options)

Param Type Description
options Object Server and controller configurations

homecloud.start()

Starts the client. It logins and then connects the websocket. Just call this function one time.

Kind: instance method of Homecloud

homecloud.newNodes(nodes, [onSend], [onError])

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

homecloud.newData(dataArray, [onSend], [onError])

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

homecloud.newCommand(dataArray, [onSend], [onError])

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

homecloud.setNodeState(nodeId, alive, [onSend], [onError])

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

homecloud.actionResult(action, result, [onSend], [onError])

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

homecloud.getRules([onSend], [onError])

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

homecloud.onAction(callback)

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

homecloud.onRules(callback)

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

homecloud.onAcceptNode(callback)

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)

homecloud.onRemoveNode(callback)

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

Homecloud~onSend : function

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

Homecloud~onNotification : function

Callback used by notifications from the server

Kind: inner typedef of Homecloud

Param Type Description
data Object Json object containing the notification.