wemore
A more awesome library for Belkin WeMo interactions. With acknowledgements to wemo.js for protocol reference.
Usage
Toggle the first device found:
var wemore = // with no args, a Discovery object is returned// that emits device events as they're discoveredvar discovery = wemore;
Toggling a device by its friendly name:
var wemore = // when the friendly name is provided, a Promise is returnedwemore;
Emulate Devices
Wemore also provides a facility for emulating devices, allowing you to transparently respond to toggle events from another device on the network, like perhaps the Amazon Echo.
var wemore = ; // note that each device needs a separate port:var tv = wemore; // choose a portvar stereo = wemore; // automatically assigned stereo; tv; // also, 'on' and 'off' events corresponding to binary statestereo; stereo;
If you need information about who requested the event, it is provided as a "Sender object" that looks something like this:
address: '::ffff:192.168.1.23' port: 12345
See Socket.remoteAddress for more information about these values.
Binary
Installing with -g
provides the wemore-toggle
executable:
usage: wemore-toggle <friendlyName>
It's simply a wrapper around the "toggle by friendly name" example above.