xcomfort-shc-api
v2.3.0
Published
node.js api for Xcomfort smart home controller
Downloads
14
Readme
Xcomfort
This module lets you send commands from node.js to the Xcomfort smart home controller(SHC) made by Eaton. It has no affiliation with Eaton, and is used at your own risk.
If you have xcomfort and a smart home controller at home, this module can be used to create custom software for your system. For example you can create a webpage customized for your home that controls your lighting instead of that generic app that ships with the SHC.
Install
npm install xcomfort-shc-api
Usage
For more details on usage see https://oanylund.github.io/xcomfort-shc-api and the API reference below.
const Xcomfort = require('xcomfort-shc-api');
const xapi = new Xcomfort({
baseUrl: 'http://192.168.0.10', // The url to reach the SHC on your network
username: 'user', // The username to login to the system
password: '1234' // The password for that user
autoSetup: true // Defaults to true.
});
xapi.on('ready', () => {
xapi.setDimState('kitchen light', 20)
.then((status) => {
if(status) {
console.log('Kitchen light set to 20%');
}
});
});
API reference
- Xcomfort ⇐ EventEmitter ⏏
- new Xcomfort(params)
- instance
- .login()
- .query(method, [params], [cb]) ⇒ Promise
- .setDimState(deviceName, state, [cb]) ⇒ Promise
- .dimBrighter(deviceName, cb) ⇒ Promise
- .dimDarker(deviceName, cb) ⇒ Promise
- .dimStop(deviceName, cb) ⇒ Promise
- .triggerScene(sceneName, [cb]) ⇒ Promise
- .getDeviceNames() ⇒ Array.<string>
- .getSceneNames() ⇒ Array.<string>
- .getNameObject() ⇒ Object
- Event: "ready"
- Event: "error"
- inner
- ~initialSetup()
- ~getZoneDevices(zoneId) ⇒ Promise
- ~getZoneScenes(zoneId) ⇒ Promise
- ~importSetup(importPath)
- ~getQueryParams(method, params) ⇒ Object
- ~checkIfDeviceExists(deviceName, deviceType) ⇒ Promise
- ~invokeDCOOperation(id, type, operation, params) ⇒ Promise
- ~deviceDetail : object
- ~sceneDetail : object
- ~callback : function
Xcomfort ⇐ EventEmitter ⏏
Kind: Exported class
Extends: EventEmitter
Emits: error, ready
Properties
new Xcomfort(params)
xcomfort.login()
Sends login request to SHC and stores cookie in sessionId
Kind: instance method of Xcomfort
xcomfort.query(method, [params], [cb]) ⇒ Promise
Request method to run on SHC RPC interface
Kind: instance method of Xcomfort
Returns: Promise - Resolves with result
See: http://dz.prosyst.com/pdoc/mBS_SDK_8.0/modules/hdm/api-json/json_rpc_all.html
xcomfort.setDimState(deviceName, state, [cb]) ⇒ Promise
Sets dimactuator to new state
Kind: instance method of Xcomfort
Returns: Promise - Resolves with true or false. True if SHC confirmed action
xcomfort.dimBrighter(deviceName, cb) ⇒ Promise
Tells DimActuator to start continously dimming brighter. How fast is configured on the device by the MRF software
Kind: instance method of Xcomfort
Returns: Promise - - Resolves undefined
xcomfort.dimDarker(deviceName, cb) ⇒ Promise
Tells DimActuator to start continously dimming darker. How fast is configured on the device by the MRF software
Kind: instance method of Xcomfort
Returns: Promise - - Resolves undefined
xcomfort.dimStop(deviceName, cb) ⇒ Promise
Tells DimActuator to stop the continous dimming.
Kind: instance method of Xcomfort
Returns: Promise - - Resolves undefined
xcomfort.triggerScene(sceneName, [cb]) ⇒ Promise
Triggers scene
Kind: instance method of Xcomfort
Returns: Promise - Resolves with true or false. True if SHC confirmed action
xcomfort.getDeviceNames() ⇒ Array.<string>
Generates list of all device names
Kind: instance method of Xcomfort
xcomfort.getSceneNames() ⇒ Array.<string>
Generates list of all scene names
Kind: instance method of Xcomfort
xcomfort.getNameObject() ⇒ Object
Generates object with list of devices and scenes
Kind: instance method of Xcomfort
Event: "ready"
Ready event gets emitted when autosetup is complete
Kind: event emitted by Xcomfort
Event: "error"
General error event emitted when internal errors occur
Kind: event emitted by Xcomfort
Xcomfort~initialSetup()
Runs on initialisation. Logs in, then fetches devices and scenes from SHC
Kind: inner method of Xcomfort
Emits: ready
Xcomfort~getZoneDevices(zoneId) ⇒ Promise
Gets devices in zone from SHC and adds them to deviceMap with name of device as key and value of type deviceDetail
Kind: inner method of Xcomfort
Returns: Promise - - with no value, only used to tell when its done
Xcomfort~getZoneScenes(zoneId) ⇒ Promise
Gets scenes in zone from SHC and adds them to sceneMap with name of scene as key and value of type sceneDetail
Kind: inner method of Xcomfort
Returns: Promise - - with no value, only used to tell when its done
Xcomfort~importSetup(importPath)
Imports existing setup file and creates new device and scene maps
Kind: inner method of Xcomfort
Emits: ready, error
Xcomfort~getQueryParams(method, params) ⇒ Object
Configure request parameters
Kind: inner method of Xcomfort
Returns: Object - Object to pass to request as options
Xcomfort~checkIfDeviceExists(deviceName, deviceType) ⇒ Promise
Checks if devices with devicetype(optional) exists
Kind: inner method of Xcomfort
Fulfil: Object - Device properties
Reject: String - Error message of one of the following:
Device name must be of type string
: deviceName was not a stringNo device with that name exists
: Device not foundNo deviceType with that name exists
: No device with correct type found
Xcomfort~invokeDCOOperation(id, type, operation, params) ⇒ Promise
Invoke DCO operation on SHC
Kind: inner method of Xcomfort
Returns: Promise - - resolves undefined if no error during query
Xcomfort~deviceDetail : object
Kind: inner typedef of Xcomfort
Properties
Xcomfort~sceneDetail : object
Kind: inner typedef of Xcomfort
Properties
Xcomfort~callback : function
Callback with result or error
Kind: inner typedef of Xcomfort