0.1.1 • Published 8 years ago

ecoplugs v0.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

ECOPlugs

Communicate with ECOPlugs/Wion Woods WiFi-connected outlets. Read the state of plugs and turn them on/off.

Installation

npm install ecoplugs

Usage

Reading plug on/off status:

var plugs = new EcoPlugGroup(config); // config object described below

plugs.getPowerState(config.plugs[0], (err, state) => {
  if (err) console.log("ERROR: ", err);
  else console.log(state ? "ON" : "OFF");
});

Turn plug on or off:

var newState = true; // truthy for on, falsey for off

plugs.setPowerState(config.plugs[0], newState, (err) => {
  if (err) console.log(err);
});

Configuration

Example configuation object:

{
    "plugs": [
        {
            "name": "EcoPlug1",
            "host": "192.168.0.xxx",
            "id": "ECO-xxxxxxxx"
        },
        {
            "name": "EcoPlug2",
            "host": "192.168.0.yyy",
            "id": "ECO-yyyyyyyy"                        
        }
    ]
}
FieldsDescriptionRequired
plugsArray of ECOPlugs to controlYes
Fields for plugs subsection
nameDescriptive name of the ECOPlugYes
hostHostname or IP of the EcoPlugYes
portPort used by the EcoPlug (defaults to 80)No
idThe id of the EcoPlug as shown in the ECO app under settingsYes

License

ISC