Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pimatic-wifiswitch with all npm packages installed. Try it out:

require("pimatic/package.json"); // pimatic is a peer dependency. var pimaticWifiswitch = require("pimatic-wifiswitch")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pimatic-wifiswitch v0.0.3

Enables custom wifi based switches

pimatic-wifiswitch

Plugin for creating switches using the esp8266 based switches from Sonoff. Of course it is possible to program any device as long as it will understand below protocol.

For now this plugin only supports on/off commands by sending/receiving a '1' or '0'. In the future it can be expanded by adding support for receiving sensor readings and dimmable lights.

Setup

You can load the plugin by editing your config.json to include:

{
    "plugin": "wifiswitch"
}

Devices

Devices can be added by either directly editing the config file or adding devices through the gui.

As of now, only 1 device is available: "WifiSocketSwitch".

Example config:
{
    "id": "wifiswitchtest",
    "name": "wifiSwitchTest",
    "class": "WifiSocketSwitch",
    "port": 8888,   
    "address": "192.168.0.100"
}

Port: This is the receiving port on the device itself to wich UDP command wil be send by this plugin. Address: This is the IP-Adress of the device.

The code for the switch itself wil be added later...

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free