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

domoticz-js

v0.0.1

Published

A Node.JS module, which provides an object oriented wrapper for the Domoticz API.

Downloads

2

Readme

JavaScript Domoticz API for Node.JS

A Node.JS module, which provides an object oriented wrapper for the Domoticz API.

Installation

Install via git clone:

  $ git clone [email protected]:skauffmann/domoticz-js.git
  $ cd domoticz-js
  $ npm install

Documentation

You can find the docs for the API of this client at http://jirachi.tyneo.net/skauffmann/domoticz-api-nodejs/wikis/home

Additionally, the official Domoticz API documentation is a very useful resource.

Usage

var Domoticz = require("domoticz");

var client = new Domoticz({
    //required
    host: "tamagotchi.tyneo.net",
    // optional
    debug: true, //default: false
    protocol: "https", //default 'http'
    username: "",
    password: ""
});

All Domoticz JS methods has callback function called after request to retreive the result. Don't worry, if the callback function is undefined, the callback will be just ignored.

//callback method usage:
function callback(err, res) {
    console.log(JSON.stringify(res));
}
client.switchLight.turnOn(idx, callback);
//You can do the same thing with :
client.switchLight.turnOn(idx, function(err, res) {
    console.log(JSON.stringify(res));
});
//You can also ignore the callback function
client.switchLight.turnOn(idx, undefined);
client.switchLight.turnOn(idx);

System methods

//Shutdown Domoticz
client.system.shutdown(callback);
//Reboot Domoticz
client.system.restart(callback);
//You can log message to Domoticz
client.system.addLog("Just a hello world from the Domoticz API", callback);

Device methods

//Get the list of all devices
client.device.getDevices({
    filter: 'all', //values: 'all', 'light', 'weather', 'temperature', 'utility'
    used: 'true', //values: undefined, true, false
    order: 'Name'
}, callback);
//Get the list of all lights
//Same methods are availables for weather (getWeathers), temperature (getTemperatures) and utility (getUtilities)
client.device.getLights({
    used: 'true', //values: undefined, true, false
    order: 'Name'
}, callback);

Update devices/sensors methods

client.device.setTemperature(idx, value, callback)
client.device.setHumidity(idx, value, callback)
client.device.setTemperatureHumidity(idx, temperature, humidity, humidityStatus, callback)
client.device.setTemperatureHumidityBarometer(idx, temperature, humidity, humidityStatus, bar, barFor, callback)
client.device.setRain(idx, rainRate, rainCounter, callback) 
client.device.setWind(idx, bearing, direction, speed, gust, temperature, tempWindChill, callback)
client.device.setUV(idx, counter, callback)
client.device.setCounter(idx, counter, callback)
client.device.setEnergy(idx, power, energy, callback)
client.device.setEnergySmartMeter(idx, power, energy, callback)
client.device.setAirQuality(idx, power, energy, callback)
client.device.setPressure(idx, pressure, callback)
client.device.setLux(idx, lux, callback)
client.device.setVoltage(idx, percent, callback)
client.device.setText(idx, text, callback)
client.device.setAlert(idx, level, text, callback)
client.device.setDistance(idx, distance, callback)

SwitchLight methods

//Turn a light/switch on
client.switchLight.turnOn(idx, callback);
//Turn a light/switch off
client.switchLight.turnOff(idx, callback);
//Toggle a switch state between on/off
client.switchLight.toggle(idx, callback);
//Set a dimmable light to a certain level
client.switchLight.setLevel(idx, level, callback);

Scene methods

//Get all the scenes & groups
//same as client.group.getScenesGroups()
client.scene.getScenesGroups(idx, callback);
//Turn a scene / group on
client.scene.turnOn(idx, callback);
//Add a scene (0)
client.scene.addScene(name, callback);
//Delete a scene or group
client.scene.delete(idx, callback);
//List devices in a scene
client.scene.getDevices(idx, callback);
//Add an existing devices to a scene
client.scene.addDevice(idx, devidx, level, hue, callback);
//Delete device from a scene
client.scene.deleteDevice(idx, devidx, callback);
//List timers of a scene
client.scene.getTimers(idx, callback);
//Add timer to a scene
client.scene.getTimers(idx, active, timertype, date, hour, min, randomness, command, level, days, callback);

Group methods

//Get all the scenes & groups
//same as client.scene.getScenesGroups()
client.group.getScenesGroups(idx, callback);
//Turn a scene / group on
client.group.turnOn(idx, callback);
//Turn a scene / group off
client.group.turnOff(idx, callback);

Hardware methods

//Get all hardwares
client.hardware.getHardwares(callback);
//Create virtual hardware
client.hardware.CreateVirtual(name, callback);

User variable methods

//List all variables
client.uservariable.getUserVariables(callback);
//List one variable
client.uservariable.getUserVariable(idx, callback);
//Store a new variable
client.uservariable.create(name, type, value, callback)
//Update an existing variable
client.uservariable.update(idx, name, type, value, callback)
//Delete a variable
client.uservariable.delete(idx, callback) 

LICENSE

MIT license. See the LICENSE file for details.