peer-upnp
peer-upnp is a Node.js module implementing the UPnP protocol as described in the UPnP Device Architecture specification
Setup
- use
npm install peer-upnp
to install the module. - run
binary light
example:- use
node node_modules/peer-upnp/test/binary-light-device.js
to create and advertise a UPnPBinaryLight
Device withSwitchPower
service - use
node node_modules/peer-upnp/test/binary-light-client.js
that discoversBinaryLight
devices and usesSwitchPower
Service to control the light.
- use
- or run the other example using
node node_modules/peer-upnp/test/upnp-test.js
to discover UPnP services on the network.
Usage
The following example shows the discovery and binding process of UPnP devices and services.
var upnp = ;var http = ;var server = http;var PORT = 8080;server;// Peer is an event emittervar peer = upnp;
The following example shows how to create and advertise a BinaryLight device and with a SwitchPower service as specified in UPnP Lighting Controls V 1.0. Please refer to the documentation in the code.
var upnp = ;var http = ;var server = http;var PORT = 8080;// start server on port 8080. please do this step before you create a peerserver; // Create a UPnP Peer. var peer = upnpstart; // Create a BinaryLight device as specified in UPnP http://upnp.org/specs/ha/UPnP-ha-BinaryLight-v1-Device.pdf. // Please refer for device configuration parameters to the UPnP device architecture.var device = peer; // create a SwitchPower service in the BinaryLight device as specified here http://upnp.org/specs/ha/UPnP-ha-SwitchPower-v1-Service.pdfvar service = device;// initialize the Target State Variable with 0service;
License
Free for non commercial use released under the GNU Lesser General Public License v3.0, See LICENSE file.
Contact us for commecial use famecontact@fokus.fraunhofer.de
Copyright (c) 2013 Fraunhofer FOKUS