new ZiBase(ipAddr, deviceId, token, callback)
Parameters:
| Name | Type | Description |
|---|---|---|
ipAddr |
string | IP address of the zibase |
deviceId |
string | Device ID of the zibase |
token |
string | Token of the zibase |
callback |
function | Callback to call when the connection to the zibase is established. |
Extends
- events.EventEmitter
Methods
-
deregisterListener()
-
Asks the Zibase to unregister the caller client
-
getDescriptor(id)
-
retrieves the descriptor with a given id
Parameters:
Name Type Description idstring ID of the descriptor to retrieve
-
getSensorInfo(idSensor, callback)
-
retrieves the information about a given sensor
Parameters:
Name Type Description idSensorstring ID of the sensor
callbackfunction Callback to be called when the info is retrieved
-
getState(adress, callback)
-
Gets the state of an activator from the Zibase
Parameters:
Name Type Description adressstring X10 formatted address of the activator
callbackfunction Callback to be called when the state is received
-
getVariable(numVar, callback)
-
Get the value of a Vx variable of the Zibase
Parameters:
Name Type Description numVarint number of the variable (0 to 31)
callbackfunction Callback to be called when the value is retrieved
-
loadDescriptors(cb)
-
Loads the descriptors of declared devices and scenarios
Parameters:
Name Type Description cbfunction Callback to be called when the descriptors are loaded
-
on(event [, id], callback)
-
listens to events
Parameters:
Name Type Argument Description eventstring Event to be listened to
idstring <optional>
The ID of the device that triggers the event. Don't specify any when the event is triggered by the zibase
callbackfunction Callback to be called when the event is triggered. The parameters of the callback depend on the event
-
once(event [, id], callback)
-
same as method on but only for one event
Parameters:
Name Type Argument Description eventstring Event to be listened to
idstring <optional>
The ID of the device that triggers the event. Don't specify any when the event is triggered by the zibase
callbackfunction Callback to be called when the event is triggered. The parameters of the callback depend on the event
-
processZiBaseData(response)
-
process the information messages sent by the zibase.
Emits events depending on the content of the response.Parameters:
Name Type Description responseResponse A response to process, as sent by the zibase
-
registerListener(port)
-
Asks the Zibase to register the caller client as a listener.
After this call, the Zibase will send its activity log to the caller, on the given port.Parameters:
Name Type Description portint The port to listen in order to receive the messages
-
runScenario(scenario)
-
Asks the zibase to run the scenario specified by its number
Parameters:
Name Type Description scenarioint | string the scenario number or name
Returns:
false if scenario doesn't resolve to a scenario number
- Type
- boolean
-
sendCommand(address, action, protocol, dimLevel, nbBurst)
-
Ask the zibase to send a command to an activator specified by its ID and protocol
Parameters:
Name Type Description addressstring Address of the activator in X10 format (e.g. B5)
actionZbAction Action to execute
protocolZbProtocol Protocol RF to be used
dimLevelint Not supported by the Zibase for now
nbBurstint Number of RF emissions
-
sendRequest(request, withResponse, callback)
-
Sends a request to the zibase
Parameters:
Name Type Description requestZbRequest Request to be sent
withResponseboolean Indicates if a response is to be expected
callbackfunction Callback to be called when the response is received
-
setEvent(action, address)
-
Positions a Zibase alert to the state ON or OFF, or simulates a sensor ID message in the activity log of the Zibase
Parameters:
Name Type Description actionint The action: 0 - deactivate an alert, 1 - activate an alert, 2 - simulate a sensor ID message (can trigger the execution of a scenario)
addressstring Address of the activator in X10 format (e.g. B5 or ZA14)