added shelly example
10
README.md
|
@ -74,9 +74,7 @@ InfluxDb is running here: http://localhost:8086/ (you have to create an initial
|
|||
You can login to Grafana: http://localhost:3000/login (admin:admin)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
## Examples and set-up
|
||||
|
||||
### Setting up a simple flow in Node-RED
|
||||
|
||||
|
@ -86,10 +84,16 @@ A simple introduction to Node-RED can be found - along with the nodes / the code
|
|||
|
||||
A more sophisticated exampe on how to connect Node-RED to influx is also available in [this repository](./docs/flow/docs/node-influx.md).
|
||||
|
||||
|
||||
### Setting up Grafana
|
||||
|
||||
Have a look at the [HowTo in this repository](./docs/dashboard/README.md).
|
||||
|
||||
|
||||
### Attaching a Shelly plug
|
||||
|
||||
As an example you can use a Shelly plug flashed with Tasmota and feed MQTT data with Node-RED into InfluxDB and visualize it with Grafana. Have a look, [here](./docs/shelly/README.md).
|
||||
|
||||
## Contribution
|
||||
|
||||
Feel free to open an issue for bugs, feature requests, or questions. Contributions are welcome.
|
||||
|
|
55
docs/shelly/README.md
Normal file
|
@ -0,0 +1,55 @@
|
|||
# Shelly Plug (S)
|
||||
|
||||
Shelly Plugs S are quite cheap but relatively accurate to measure power consumptions less than 2.5 kW.
|
||||
|
||||
![Shelly Plug](https://shelly.hr/wp-content/uploads/2020/11/shelly_plug_s_1-1.jpg)
|
||||
|
||||
In our [smart-energy-montior](https://code.curious.bio/curious.bio/smart-energy-monitor) project we already have set up a Shelly using Tasmota, on Open Source alternative firmware, that also runs on various other consumer off the shelf devices.
|
||||
|
||||
|
||||
## InfluxDB Bucket
|
||||
|
||||
In Influx I created a bucket called `shelly`in InfluxDB, so we can store the messages in this bucket.
|
||||
|
||||
### Node-RED
|
||||
|
||||
I create a usual flow in Node-RED. A MQTT node fetches the values.
|
||||
|
||||
![Node-RED](./docs/images/node-red.png)
|
||||
|
||||
The message is fed into a filter function to only store usefull information:
|
||||
|
||||
```
|
||||
return {
|
||||
payload: {
|
||||
power: Number(msg.payload.ENERGY.Power),
|
||||
voltage: Number(msg.payload.ENERGY.Voltage),
|
||||
current: Number(msg.payload.ENERGY.Current)
|
||||
}
|
||||
};
|
||||
````
|
||||
|
||||
The `payload` will be stored in InfluxDB in the bucket "shelly".
|
||||
|
||||
### InfluxDB Data Explorer
|
||||
|
||||
In Influx DB Data Explorer you can query the stored data.
|
||||
|
||||
![Data Explorer](./docs/images/data-explorer.png)
|
||||
|
||||
The query created by Data Explorer looks like that:
|
||||
|
||||
```
|
||||
from(bucket: "shelly")
|
||||
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
||||
|> filter(fn: (r) => r["_measurement"] == "msg")
|
||||
|> filter(fn: (r) => r["_field"] == "power" or r["_field"] == "voltage" or r["_field"] == "current")
|
||||
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|
||||
|> yield(name: "mean")
|
||||
```
|
||||
|
||||
### Grafana
|
||||
|
||||
Using this query you can crate a dashboard in Grafana.
|
||||
|
||||
![Grafana](./docs/images/grafana.png)
|
BIN
docs/shelly/docs/images/blitzwolf.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
docs/shelly/docs/images/configure-wifi.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
docs/shelly/docs/images/data-explorer.png
Normal file
After Width: | Height: | Size: 526 KiB |
BIN
docs/shelly/docs/images/grafana.png
Normal file
After Width: | Height: | Size: 556 KiB |
BIN
docs/shelly/docs/images/mqtt.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/shelly/docs/images/node-red.png
Normal file
After Width: | Height: | Size: 358 KiB |
BIN
docs/shelly/docs/images/telemetry-period.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
docs/shelly/docs/images/wifi.png
Normal file
After Width: | Height: | Size: 168 KiB |