All Projects → mwittig → edimax-smartplug

mwittig / edimax-smartplug

Licence: MIT License
Unofficial Edimax Smartplug Libary. Control SP-1101W and SP-2101W from Node.js.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to edimax-smartplug

TrueRMS
Average, RMS, Power and Energy measurement library for Arduino.
Stars: ✭ 42 (+68%)
Mutual labels:  energy-monitor, energy-consumption
ESPproMon
ESPproMon © Smartphone App for Energy Monitoring with Appp © Technology
Stars: ✭ 15 (-40%)
Mutual labels:  energy-monitor, energy-consumption
Node Hue Api
Node.js Library for interacting with the Philips Hue Bridge and Lights
Stars: ✭ 1,034 (+4036%)
Mutual labels:  schedule, smarthome
open-energy-view
View resource consumption trends, history, analysis, and insights.
Stars: ✭ 32 (+28%)
Mutual labels:  energy-monitor, energy-consumption
ioBroker.hass
Connects Home Assistant to ioBroker
Stars: ✭ 14 (-44%)
Mutual labels:  smarthome
cbj app
📱 CyBear Jinni App is the app to control CyBear Jinni Hub 💡 remotely from your Android, IOS and Web Browser. If you have ever wondered "Is there an open-source project to make my own smart home?", This is part of one.
Stars: ✭ 68 (+172%)
Mutual labels:  smarthome
ioBroker.ping
Pings configured IPs for ioBroker
Stars: ✭ 18 (-28%)
Mutual labels:  smarthome
super course schedule
微信小程序 - 超级课程表
Stars: ✭ 59 (+136%)
Mutual labels:  schedule
Home-Assistant-Main
My Home Assistant Configuration Be sure to ⭐ my repo so you can keep up to date on the daily progress!
Stars: ✭ 54 (+116%)
Mutual labels:  smarthome
openhab2 pub 001
openhab2_pub_001
Stars: ✭ 29 (+16%)
Mutual labels:  smarthome
ioBroker.fhem
Communication with FHEM over Telnet
Stars: ✭ 15 (-40%)
Mutual labels:  smarthome
fritz-box
📦 Promise-based JavaScript FRITZ!Box API.
Stars: ✭ 14 (-44%)
Mutual labels:  smarthome
Raspberry-Pi-Electricity-Monitor
Software for monitoring the electricity consumption of a home with a Raspberry Pi
Stars: ✭ 33 (+32%)
Mutual labels:  energy-monitor
jekyll-deploy-action
🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
Stars: ✭ 162 (+548%)
Mutual labels:  schedule
ioBroker.sayit
Text to speech for ioBroker
Stars: ✭ 26 (+4%)
Mutual labels:  smarthome
gree-remote
Simple remote control utility for Gree Smart air conditioners
Stars: ✭ 150 (+500%)
Mutual labels:  smarthome
eXperDB-Management
eXperDB-Management is a integrated management tool for PostgreSQL(for efficient operation and management).
Stars: ✭ 38 (+52%)
Mutual labels:  schedule
ha-rhvoice
Home Assistant integration for RHVoice - a local text-to-speech engine.
Stars: ✭ 19 (-24%)
Mutual labels:  smarthome
later
*Maintained fork of Later.* A javascript library for defining recurring schedules and calculating future (or past) occurrences for them. Includes support for using English phrases and Cron schedules. Works in Node and in the browser.
Stars: ✭ 63 (+152%)
Mutual labels:  schedule
Lumos
😴 Smart Lighting for Better Sleep
Stars: ✭ 98 (+292%)
Mutual labels:  smarthome

edimax-smartplug

Greenkeeper badge Build Status

Node module to communicate with Edimax Smart Plugs. The library utilizes Bluebird promises - https://github.com/petkaantonov/bluebird. Device requests will be executed sequentially. This is useful as the Smart Plug REST service does not properly chain incoming requests. It provides the following features:

  • Device Discovery - Smart Plugs can be automatically discovered on a given network (see section "Device Discovery" below for details)
  • Switching - Apart from switching Smart Plugs on and off, it is possible to read the current switch state
  • Schedule - It is not possible to set the schedule for the Smart Plugs, but the current schedule is readable
  • Usage Metering - For 'SP2101W' Smart Plugs it is possible to access the current, accumulated, and historical energy usage metering data
  • Support for digest authentication required with firmware versions SP-2101W v2.08 and SP-1101W v2.04
Important Notice
The recent firmware versions published for EdiSmart/Amazon Alexa Integration
are currently not supported by edimax-smartplug:
  • SP2101W: v2.09 and higher
  • SP1101W: v1.05 and higher

Moreover, please note, the SP-2101W V2 plug is currently not supported. Issue #14 contains a link thread with untested and unsupported downgrade instructions. Use at your own risk!

If you have installed the new version and wish to downgrade you can use the downgrade guide provided as part of the project.

Usage Examples

var smartplug = require('./index');
var options = {
    timeout: 10000,
    name:'edimax',
    host:'192.168.178.65',
    username: 'admin',
    password: '1234'
};


smartplug.getDeviceInfo(options).then(function (info) {
    console.log(info);
}).catch(function(e) {console.log("Request failed: ", e)});

smartplug.getSchedule(options).then(function (schedule) {
    console.log(schedule);
}).catch(function(e) {console.log("Request failed: ", e)});

// set switch ON
smartplug.setSwitchState(true, options).catch(function(e) {console.log("Request failed: ", e)});

smartplug.getSwitchPower(options).then(function (power) {
    console.log("Current switch power", power, "Watts");
}).catch(function(e) {console.log("Request failed: ", e)});

smartplug.getSwitchEnergy(options).then(function (energy) {
    console.log("getSwitchEnergy result:", energy);
}).catch(function(e) {console.log("Request failed: ", e)});

smartplug.getStatusValues(true, options).then(function (all) {
    console.log("getStatusValues result:", all);
}).catch(function(e) {console.log("Request failed: ", e)});

// set switch OFF
smartplug.setSwitchState(false, options).catch(function(e) {console.log("Request failed: ", e)});

// get switch status
smartplug.getSwitchState(options).then(function (state) {
    console.log("Switch status is", state?"ON":"OFF");
}).catch(function(e) {console.log("Request failed: ", e)});

// get schedule status
smartplug.getScheduleState(options).then(function (state) {
    console.log("Schedule status is", state?"ON":"OFF");
}).catch(function(e) {console.log("Request failed: ", e)});

// get the daily history of power measured consumption for the given date range
smartplug.getHistory('DAY', '20160825', '20160830', options).then(function (results) {
    console.log("getHistory result", results);
}).catch(function(e) {console.log("Request failed: ", e)});

// discover devices
smartplug.discoverDevices({
    timeout: 3000,
    address: "192.168.178.255"
}).then(function (results) {
    console.log("Discovery Result:", results);
}).catch(function(e) {console.log("Request failed: ", e)});

Device Discovery

The device discovery implementation is based on the findings summarized in a blog post (thanks, Guntram). As the discovery mechanism may also be used for other Edimax products, e.g. IP cameras, you should filter by model name to make sure the found device is a smart plug ('SP1101W' and 'SP2101W'). The method discoverDevices() accepts the following options:

Property Default Type Description
address "255.255.255.255" String The broadcast address
timeout 3000 Integer The timeout in milliseconds for discovery

Note: Using the global broadcast address on Windows may yield unexpected results. On Windows, global broadcast packets will only be routed via the first network adapter which may cause problems with multi-homed setups and virtual network adapters. If you want to use a broadcast address though, use a network-specific address, e.g. for 192.168.0.1/24 use 192.168.0.255.

A discovery request returns a promise which yields an array with the discovery items on completion. An item is an object with the following properties:

Property Type Example Description
manufacturer String 'EDIMAX' The manufacturer of the device
model String 'SP2101W' The model name
version String '2.03' The firmware version
displayName String 'edimax' The assigned device name
addr String '192.168.178.65' The IP address of the device
dstAddr String '192.168.178.1' The IP address of the gateway

TODO

  • More Documentation
  • Make request chaining optional. In some cases, request/response interleaving does not matter
  • Add tests

History

See Release History.

License

Copyright (c) 2015-2019, Marcus Wittig and contributors. All rights reserved.

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].