Skip to content

Commit

Permalink
Merge 05a18d1 into 91a9ddf
Browse files Browse the repository at this point in the history
  • Loading branch information
ottoszika authored Dec 12, 2019
2 parents 91a9ddf + 05a18d1 commit b2f6143
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 0 deletions.
Empty file added docs/.nojekyll
Empty file.
4 changes: 4 additions & 0 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
![eWeLink + Node-RED](https://raw.githubusercontent.com/ottoszika/node-red-contrib-ewelink/master/images/ewelink-node-red.png)

[GitHub](https://github.com/ottoszika/node-red-contrib-ewelink)
[Get Started](/get-started)
4 changes: 4 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* [Get started](get-started.md)
* [Installation](installation.md)
* [Configuration](configuration.md)
* [Nodes](nodes.md)
11 changes: 11 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Configuration

The only things you need to configure are the credentials for the API connection.
Once you use your first eWeLink node, you can set up it's eWeLink Credentials:
* E-mail address
* Password
* Region (eu, us, ...)

[Go to the nodes →](nodes.md)

[← Go back to the installation](installation.md)
10 changes: 10 additions & 0 deletions docs/get-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Get Started

[![Build Status](https://travis-ci.com/ottoszika/node-red-contrib-ewelink.svg?branch=master)](https://travis-ci.com/ottoszika/node-red-contrib-ewelink)
[![Coverage Status](https://coveralls.io/repos/github/ottoszika/node-red-contrib-ewelink/badge.svg?branch=master)](https://coveralls.io/github/ottoszika/node-red-contrib-ewelink?branch=master)
[![StyleCI](https://github.styleci.io/repos/226668450/shield?branch=master)](https://github.styleci.io/repos/226668450)

This package helps you to integrate [eWeLink devices](https://www.ewelink.cc/en/support/) with [Node-RED](https://nodered.org/) without modifying the original firmware.
Everything is done over API calls thanks to [@skydiver](https://github.com/skydiver), the author of the [ewelink-api](https://github.com/skydiver/ewelink-api) NodeJS package.

[Go to the installation →](installation.md)
23 changes: 23 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>node-red-contrib-ewelink - NodeRED nodes for eWeLink smart devices</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="NodeRED nodes for eWeLink smart devices">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
coverpage: true,
loadSidebar: true,
name: 'node-red-contrib-ewelink',
repo: 'https://github.com/ottoszika/node-red-contrib-ewelink'
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Installation

#### You can install this package in two ways:

##### 1. From CLI using NPM
Run the following command in the Node-RED data directory:
```shell
$ npm install node-red-contrib-ewelink
```

##### 2. From Node-RED
Go to Menu → Manager palette → Install and search for ```node-red-contrib-ewelink``` and click **install**.

[Go to the configuration →](configuration.md)

[← Go back to get started](get-started.md)
141 changes: 141 additions & 0 deletions docs/nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Nodes

There are several nodes than can be used to communicate with your devices.

#### Devices node
Using this node you can retrieve all the devices attached to your account.

Result example:
```json
[
{
"_id": "5df2cbda08eb57bea4d6c70f",
"name": "Kitchen Lamp"
"type": "10",
"deviceid: "12345678",
...
},
...
]
```

#### Device node (generic)
You can communicate with your devices using RPC-like syntax.
The input payload should look like:
```json
{
"method": "<method name>",
"params": [<params>],
}
```

Simple example to turn on a **Sonoff Basic** relay:
```json
{
"method": "setDevicePowerState",
"params": ["on"]
}
```

#### Firmware node
Returns the current firmware version of a device.

Result example:
```json
{
"status": "ok",
"fwVersion": "1.6.0"
}
```

#### Power state node (in)
Reads the current power state of a single channel device.

Result example:
```json
{
"status": "ok",
"state": "on"
}
```

#### Power state node (out)
Sets the power state of a single channel device. The payload can be any of the following strings:
* on
* off
* toggle

Result example:
```json
{
"status": "ok",
"state": "on"
}
```

#### Channels node
Returns the number of the channels for the device.

Result example:
```json
{
"status": "ok",
"switchesAmount": 1
}
```

#### Event listener node
Listens to events of a devices. When a change occures it will return the event.
By default it listens for events generated by all the devices, but you can specify a single device ID to listen on.

Result example:
```json
{
"action": "update",
"deviceid": "12345678",
"params": {
switch: "on"
}
}
```

#### Power usage node
Returns the current month power usage on the device.

#### Humidity node
Returns the humidity value from the sensor connected to the device.

Result example:
```json
{
"status": "ok",
"humidity": "40.15"
}
```

#### Temperature node
Returns the temperature value from the sensor connected to the device.

Result example:
```json
{
"status": "ok",
"temperature": "21.79"
}
```

#### Temperature and humidity node
Returns the temperature and humidity value from the sensor connected to the device.

Result example:
```json
{
"status": "ok",
"temperature": "21.79",
"humidity": "40.15"
}
```

[Go to the configuration →](configuration.md)

[← Go back to the installation](installation.md)

0 comments on commit b2f6143

Please sign in to comment.