npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xcomfort-shc-api

v2.3.0

Published

node.js api for Xcomfort smart home controller

Downloads

14

Readme

Xcomfort

Travis Codecov

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

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 string
  • No device with that name exists: Device not found
  • No 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